Jump to content

[HELP]Money giving script


Strozz

Recommended Posts

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") 

Link to comment

done :D

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) 

Link to comment
done :D
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 by Guest
Link to comment
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.]

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...