Strozz Posted October 1, 2013 Posted October 1, 2013 Well, I've started to learn scripting, so I started with some basic script that I'm sure for 100% that it's not correct. It's like an event, when someone using the command : /givemoney , it picks a random player and gives him 1k$. (1,000) I still don't know how to make this command be able for staff team only. (If you know how, reply please) But If you recognize the error, please reply here, thank you. function giveMoney (player, command) giveMoneyPlayer (player, "1000") local luckyBugger = getRandomPlayer() local x, y, z = getElementPosition ( luckyBugger ) outputChatBox ( "You've recieved 1000", luckyBugger ) end addCommandHandler ("moneyevent", "giveMoney")
WASSIm. Posted October 1, 2013 Posted October 1, 2013 done function giveMoney (player, command) if (getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Staff") then local luckyBugger = getRandomPlayer() givePlayerMoney (luckyBugger, 1000) outputChatBox ( "You've recieved $1000", luckyBugger ) end end addCommandHandler ("moneyevent", giveMoney)
manve1 Posted October 1, 2013 Posted October 1, 2013 (edited) done function giveMoney (player, command) if (getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Staff") then local luckyBugger = getRandomPlayer() givePlayerMoney (luckyBugger, 1000) outputChatBox ( "You've recieved $1000", luckyBugger ) end end addCommandHandler ("moneyevent", giveMoney) Wrong, First of all he asked only for admins, he didn't say for admin 'team' which you done. Next time read a little bit more carefully function giveMoney (player, command) if ( hasObjectPermissionTo ( player, "function.kickPlayer") ) then givePlayerMoney(player, tonumber("1000")) local luckyBugger = getRandomPlayer() --local x, y, z = getElementPosition ( luckyBugger ) <== this is not needed. outputChatBox ( "You've recieved 1000", luckyBugger ) else outputChatBox("You Have No Access To This Command.") end addCommandHandler ("giveMoney", giveMoney) Edited October 1, 2013 by Guest
WASSIm. Posted October 1, 2013 Posted October 1, 2013 I still don't know how to make this command be able for staff team only. (If you know how, reply please)
Strozz Posted October 1, 2013 Author Posted October 1, 2013 Thank you guys, learned from my mistakes, I meant to the staff team. And if you can, can you please explain me what did you change and what is everything there? by. ( -- ) Thank you, regards, Strozz.
glowdemon1 Posted October 1, 2013 Posted October 1, 2013 givePlayerMoney(player, "1000") - I don't think you should put strings around an int value.
manve1 Posted October 1, 2013 Posted October 1, 2013 I still don't know how to make this command be able for staff team only. (If you know how, reply please) My bad. Even tho if the admin moves him self with the admin panel from the staff team ( or another admin does this ) he could still be allowed to do that command [This is my opinion.]
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