Zcraks Posted June 10, 2019 Share Posted June 10, 2019 (edited) The script performs for all players, how to fix it? client.Lua function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", root) end addEventHandler("onClientMarkerHit",root, work) server.Lua function getAnim (player) setPedAnimation(player, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, player, 4, 0, 0.4, - 0.6, -90, 0, 0 ); end addEvent("setAnim", true) addEventHandler("setAnim", resourceRoot, getAnim) Edited June 10, 2019 by Zcraks Link to comment
Master_MTA Posted June 10, 2019 Share Posted June 10, 2019 (edited) 25 minutes ago, Zcraks said: end function work (element) if element == localPlayer and isElement(marker) and source==marker then triggerServerEvent("setAnim", localPlayer) end end addEventHandler("onClientMarkerHit",root, work) server function getAnim () setPedAnimation(source, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, source, 4, 0, 0.4, - 0.6, -90, 0, 0 ); end addEvent("setAnim", true) addEventHandler("setAnim", resourceRoot, getAnim) Edited June 10, 2019 by Master_MTA Link to comment
Felix5k Posted June 10, 2019 Share Posted June 10, 2019 (edited) 1 hour ago, Zcraks said: function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", localPlayer , localPlayer) end addEventHandler("onClientMarkerHit",root, work) 44 minutes ago, Master_MTA said: function getAnim (player) setPedAnimation(player, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, player, 4, 0, 0.4, - 0.6, -90, 0, 0 ); end addEvent("setAnim", true) addEventHandler("setAnim", resourceRoot, getAnim) Edited June 10, 2019 by Felix5k Link to comment
Zcraks Posted June 10, 2019 Author Share Posted June 10, 2019 7 minutes ago, Felix5k said: Dont working server trigger triggerServerEvent ("setAnim",localPlayer, localPlayer) but this works for all players triggerServerEvent ("setAnim", root, localPlayer) Link to comment
Felix5k Posted June 10, 2019 Share Posted June 10, 2019 2 hours ago, Zcraks said: Dont working server trigger triggerServerEvent ("setAnim",localPlayer, localPlayer) but this works for all players triggerServerEvent ("setAnim", root, localPlayer) i don't inderstand what you want to do, to trigger just localPlayer or all? Link to comment
Zcraks Posted June 10, 2019 Author Share Posted June 10, 2019 3 minutes ago, Felix5k said: i don't inderstand what you want to do, to trigger just localPlayer or all? localPlayer. This variant dont working triggerServerEvent ("setAnim",localPlayer, localPlayer) The fucntion on server side "setAnim" Event dont started Link to comment
Felix5k Posted June 10, 2019 Share Posted June 10, 2019 3 minutes ago, Zcraks said: localPlayer. This variant dont working triggerServerEvent ("setAnim",localPlayer, localPlayer) The fucntion on server side "setAnim" Event dont started try to write a outputChatBox to check if is make the function Link to comment
Zcraks Posted June 10, 2019 Author Share Posted June 10, 2019 5 minutes ago, Felix5k said: try to write a outputChatBox to check if is make the function outputChatBox dont workin on server side Link to comment
Felix5k Posted June 10, 2019 Share Posted June 10, 2019 Just now, Zcraks said: outputChatBox dont workin on server side wait , i'am testing now on my server client-side function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", localPlayer,localPlayer) end end addEventHandler("onClientMarkerHit",root, work) server-side function setAnim(thePlayer) outputChatBox("Hi", thePlayer, 100,255,100) setPedAnimation(thePlayer, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, thePlayer, 4, 0, 0.4, - 0.6, -90, 0, 0 ) end addEvent("setAnim", true) addEventHandler("setAnim", root, setAnim) 8 minutes ago, Felix5k said: wait , i'am testing now on my server client-side function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", localPlayer,localPlayer) end end addEventHandler("onClientMarkerHit",root, work) server-side function setAnim(thePlayer) outputChatBox("Hi", thePlayer, 100,255,100) setPedAnimation(thePlayer, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, thePlayer, 4, 0, 0.4, - 0.6, -90, 0, 0 ) end addEvent("setAnim", true) addEventHandler("setAnim", root, setAnim) it should work now. 1 Link to comment
Zcraks Posted June 10, 2019 Author Share Posted June 10, 2019 45 minutes ago, Felix5k said: wait , i'am testing now on my server client-side function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", localPlayer,localPlayer) end end addEventHandler("onClientMarkerHit",root, work) server-side function setAnim(thePlayer) outputChatBox("Hi", thePlayer, 100,255,100) setPedAnimation(thePlayer, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, thePlayer, 4, 0, 0.4, - 0.6, -90, 0, 0 ) end addEvent("setAnim", true) addEventHandler("setAnim", root, setAnim) it should work now. Thank u 1 Link to comment
DNL291 Posted June 10, 2019 Share Posted June 10, 2019 53 minutes ago, Felix5k said: client-side function work (element) if element == localPlayer and isElement(marker) then triggerServerEvent("setAnim", localPlayer,localPlayer) end end addEventHandler("onClientMarkerHit",root, work) server-side function setAnim(thePlayer) outputChatBox("Hi", thePlayer, 100,255,100) setPedAnimation(thePlayer, ...) obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, thePlayer, 4, 0, 0.4, - 0.6, -90, 0, 0 ) end addEvent("setAnim", true) addEventHandler("setAnim", root, setAnim) The event will be triggered for all server markers and not just for 'marker'. Here's an version indented and more cleaner: function work( element ) if element == localPlayer then triggerServerEvent( "setAnim", localPlayer ) end end addEventHandler( "onClientMarkerHit", marker, work ) server function setAnim() setPedAnimation( client, ... ) local obj = createObject ( id, x, y, z, 0, 0, 0 ) exports.bone_attach:attachElementToBone( obj, client, 4, 0, 0.4, - 0.6, -90, 0, 0 ) end addEvent("setAnim", true) addEventHandler("setAnim", root, setAnim) 1 Link to comment
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