Sparrow Posted January 17, 2012 Share Posted January 17, 2012 now I do script that remove 1 star when I type /rstar but it didn't remove this star, this what I do: function removeMyStar(thePlayer) local wanted = getPlayerWantedLevel (thePlayer) if (wanted = 1) then local getMoney = getPlayerMoney (thePlayer) if (getMoney == 250) then setPlayerWantedLevel (thePlayer, 0) outputChatBox ("You have removed your star for $250.", thePlayer, 0, 255, 0) else outputChatBox ("You need $250 to remove your star.", thePlayer, 255, 0, 0) end end end addCommandHandler ("rstar", removeMyStar) Link to comment
Maurize Posted January 17, 2012 Share Posted January 17, 2012 addCommandHandler( "removeStars", function( thePlayer, cmd ) local stars = getPlayerWantedLevel( thePlayer ) local money = getPlayerMoney( thePlayer ) if ( stars == 1 ) then if ( money >= 100 ) then setPlayerWantedLevel( thePlayer, stars - 1 ) else outputChatBox( "you need more cash!", thePlayer ) end end end ) Link to comment
Sparrow Posted January 17, 2012 Author Share Posted January 17, 2012 thank you, it's working, but it didn't take money from the player Link to comment
Blaawee Posted January 17, 2012 Share Posted January 17, 2012 function removeMyStar( thePlayer, cmd ) local wanted = getPlayerWantedLevel ( thePlayer ) local getMoney = getPlayerMoney ( thePlayer ) local setlevel = setPlayerWantedLevel ( thePlayer ) if ( wanted ~= 1 and getMoney == 250 ) then takePlayerMoney ( thePlayer, 250 ) setPlayerWantedLevel ( thePlayer, setlevel-1 ) outputChatBox ("You have removed your star for $250.", thePlayer, 0, 255, 0) else outputChatBox ("You need $250 to remove your star.", thePlayer, 255, 0, 0) end end addCommandHandler ("rstar", removeMyStar) Link to comment
Sparrow Posted January 17, 2012 Author Share Posted January 17, 2012 bad argument @ setPlayerWantedLevel (line 4) Link to comment
Blaawee Posted January 17, 2012 Share Posted January 17, 2012 function removeMyStar( thePlayer, cmd ) local wanted = getPlayerWantedLevel ( thePlayer ) local getMoney = getPlayerMoney ( thePlayer ) if ( wanted ~= 1 and getMoney == 250 ) then takePlayerMoney ( thePlayer, 250 ) setPlayerWantedLevel ( thePlayer, wanted - 1 ) outputChatBox ("You have removed your star for $250.", thePlayer, 0, 255, 0) else outputChatBox ("You need $250 to remove your star.", thePlayer, 255, 0, 0) end end addCommandHandler ("rstar", removeMyStar) Link to comment
Sparrow Posted January 17, 2012 Author Share Posted January 17, 2012 it didnt' work, no errors in /debugscript 3 and in mtaserver.exe EDIT: nvm on what I say, I copy mauriz script and add "takePlayerMoney" and it work well. Link to comment
Maurize Posted January 17, 2012 Share Posted January 17, 2012 yep ) sry forgot to take the cash 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