TorNix~|nR Posted October 28, 2017 Posted October 28, 2017 (edited) Guys, I need help on this little script! I want a cancelEvent when the skin id is: 308 function tt() triggerServerEvent( "setplayermask", localPlayer, "zombie") if getElementModel( source ) == 308 then cancelEvent() end end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), tt) Edited October 28, 2017 by TorNix~|nR ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Moderators IIYAMA Posted October 28, 2017 Moderators Posted October 28, 2017 Is(And to which skin afterwards?) OR on skin changed? Your code doesn't make sense and should be serverside to prevent de-sync. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TorNix~|nR Posted October 28, 2017 Author Posted October 28, 2017 function maske_ekle(name) if obje[source] then destroyElement(obje[source]) end local objeid = maskTable[name][1] local bodyattach = maskTable[name][2] local zROT = maskTable[name][3] obje[source] = createObject ( objeid, 0, 0, 0, 0, 0, 0 ) exports.bone_attach:attachElementToBone(obje[source],source,bodyattach,0,0,-0.61,0,0,zROT) if getElementModel( source ) == 308 then cancelEvent() end end addEvent("setplayermask",true) addEventHandler("setplayermask", root, maske_ekle) this is the server-side ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
TorNix~|nR Posted October 28, 2017 Author Posted October 28, 2017 anyhelp? ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Moderators IIYAMA Posted October 28, 2017 Moderators Posted October 28, 2017 (edited) The event you cancelled has no relationship with changing the skin, so that will not work. Use, over cancelEvent(). setElementModel( source, 0 ) And this part is incorrect: function tt() triggerServerEvent( "setplayermask", localPlayer, "zombie") if getElementModel( source ) == 308 then cancelEvent() end end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), tt) Edited October 28, 2017 by IIYAMA Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TorNix~|nR Posted October 28, 2017 Author Posted October 28, 2017 Done! thank you I found the solution. ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now