Clipper_ 1 Posted December 14, 2017 (edited) Big thanks to people that gave me ideas for creating this resource. Developped a mode where you can set/remove the hat, but in the real test, I've found this bug when aiming specific weapons that change your camera. Is there any event that can be called when player aims the weapon, in order to make the hat dissapear from screen? (serverside) Edited December 14, 2017 by Clipper_ Share this post Link to post
aka Blue 146 Posted December 14, 2017 Make the hat alpha 0 when the player is aiming Share this post Link to post
Fist 51 Posted December 14, 2017 (edited) there is no way doing it through server, and you don't want that either, because if you would hide hat through server when player aims then everyone would see it disappear from his head when he aims with sniper rifle. What you want to do is trigger a custom event on client which sends model to client and stores it into a variable when hat is created for that player and when is removed hat then send again to client that hat was removed so it doesn't throw warnings out also there's an easier version, just set player data "santahat" the model of hat, then check if weapon is aiming with getPedTask() on onClientRender event so it's instantenous and if player is aiming set models alpha to 0 like @aka Blue said or just set element position to 0,0,0, boneattach later will reposition to bone when play won't aim anymore. Also don't forget to remove hat when player disconnects or gets banned, otherwise it's gonna stay in air. Edited December 14, 2017 by Fist Share this post Link to post
Clipper_ 1 Posted December 15, 2017 Can you tell me how can I send the hat to client? In this way I can fix other bugs that are related to local player only. Share this post Link to post
Fist 51 Posted December 15, 2017 (edited) 5 hours ago, Clipper_ said: Can you tell me how can I send the hat to client? In this way I can fix other bugs that are related to local player only. with triggerClientEvent and triggerServerEvent on other way around, but i recommend you just setting hat model to an element data so it's easier for you to make it. Element datas are synced between server and client on change, from both sides. Edited December 15, 2017 by Fist Share this post Link to post