TwicH Posted April 8, 2015 Posted April 8, 2015 hey guys im trying to get into scripting and i have some problem with a simple script i put together function MarkerHit ( hitPlayer, matchingDimension ) setPedAnimation( player, "ped", "WOMAN_walknorm") end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) here is the code can you explain to me whats wrong?
WhoAmI Posted April 8, 2015 Posted April 8, 2015 setPedAnimation( player, "ped", "WOMAN_walknorm") 'player' isn't defined on this event. Use 'hitPlayer' instead. BTW: Use [lua ] [ /lua] for highlighting.
TwicH Posted April 8, 2015 Author Posted April 8, 2015 I tried this but player dosent work some friend told me to use this code: function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then setPedAnimation( hitPlayer, "ped", "WOMAN_walknorm") end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) it works but i dont know why..
WhoAmI Posted April 8, 2015 Posted April 8, 2015 localPlayer is global definied variable which means player who is using this script right now. After entering the marker you are checking if hit player is this 'localPlayer'. If so, it sets the animation.
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