SolidJuho Posted March 10, 2014 Share Posted March 10, 2014 Does this script work? addCommandHandler( "wantedoff", getRootElement( ) function ( ) setElementData( source, "wantedlevelB4death", getPlayerWantedLevel( source ), false ); local wantedlevel = getElementData( source, "wantedlevelB4death" ); takePlayerMoney ( 5000 ) if wantedlevel and wantedlevel > 0 then setPlayerWantedLevel( source, wantedlevel ); end end end ) Please help. Link to comment
Anubhav Posted March 10, 2014 Share Posted March 10, 2014 No. addCommandHandler( "wantedoff", function ( ) setElementData( source, "wantedlevelB4death", getPlayerWantedLevel( source ), false ); local wantedlevel = getElementData( source, "wantedlevelB4death" ); takePlayerMoney ( 5000 ) if wantedlevel > 0 then setPlayerWantedLevel( source, wantedlevel ); end end end ) Link to comment
Anubhav Posted March 10, 2014 Share Posted March 10, 2014 No problem! OFF-TOPIC: 300 Posts ! HURRAY! Link to comment
Moderators IIYAMA Posted March 10, 2014 Moderators Share Posted March 10, 2014 addCommandHandler doesn't have a source, how does it suppose to work.... The player should be the localPlayer on clientside or the first parameter at serverside. Also serverside functions and clientside functions are mixed up in the code. Link to comment
Moderators Citizen Posted March 10, 2014 Moderators Share Posted March 10, 2014 (edited) Also serverside functions and clientside functions are mixed up in the code. There is no client-side only functions in this code o_O OFF-TOPIC: 300 Posts ! HURRAY! Myeah but half are just working solutions. And here is again a not working solution. Read carefully the code when you want to help someone. There is not only one problem most of the time. addCommandHandler( "wantedoff", function ( thePlayer ) setElementData( thePlayer, "wantedlevelB4death", getPlayerWantedLevel( thePlayer ), false ) local wantedlevel = getElementData( thePlayer, "wantedlevelB4death" ) takePlayerMoney ( thePlayer, 5000 ) if wantedlevel > 0 then setPlayerWantedLevel( thePlayer, wantedlevel ) end end) By the way, I just fixed the syntax. Can you explain what did you want to do with this command ?? Edited March 10, 2014 by Guest Link to comment
Moderators IIYAMA Posted March 10, 2014 Moderators Share Posted March 10, 2014 True. But I meant what arguments that can be used inside the functions, which make the differences between serverside and clientside. Like this one: takePlayerMoney ( 5000 ) takePlayerMoney (thePlayer, 5000 ) Link to comment
Moderators Citizen Posted March 10, 2014 Moderators Share Posted March 10, 2014 Oh yeah, nice catch, code edited 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