SolidJuho Posted March 10, 2014 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.
Anubhav Posted March 10, 2014 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 ) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Anubhav Posted March 10, 2014 Posted March 10, 2014 No problem! OFF-TOPIC: 300 Posts ! HURRAY! See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Moderators IIYAMA Posted March 10, 2014 Moderators 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. 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
Moderators Citizen Posted March 10, 2014 Moderators 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 The rEvolution is coming ...
Moderators IIYAMA Posted March 10, 2014 Moderators 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 ) 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
Moderators Citizen Posted March 10, 2014 Moderators Posted March 10, 2014 Oh yeah, nice catch, code edited The rEvolution is coming ...
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