Al3grab Posted August 16, 2011 Share Posted August 16, 2011 Hi , i made an script that send money to all players in server by one command , and the code is client-side .. now i want to put permissions so just admin can use commad .. i knew it by the function : hasObjectPermissionTo But its only server-side function ! -- the code function moneyAll(commandName,Al3grab) plrz = getElementsByType("player") if (tonumber(Al3grab)) then givePlayerMoney(Al3grab) outputChatBox("#FF0000 *** ADMIN HAS GIVEN MONEY: #00FF00" .. amount .. "$ #FF0000 TO ALL PLAYERS *** ",255,0,0,true) end end addCommandHandler( "sendall", moneyAll ) -- Al3grab = amount Any Help ? Link to comment
JR10 Posted August 16, 2011 Share Posted August 16, 2011 This won't work, won't give all the players. Make it server side. addCommandHandler ( "sendall", function ( player, cmd, amount ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then if tonumber ( amount ) ~= nil then for id, player in ipairs ( getElementsByType ( "player" ) ) do givePlayerMoney ( player, tonumber ( amount ) ) outputChatBox("#FF0000 *** ADMIN HAS GIVEN MONEY: #00FF00" .. amount .. "$ #FF0000 TO ALL PLAYERS *** ", root, 255,0,0,true) end) Link to comment
Al3grab Posted August 16, 2011 Author Share Posted August 16, 2011 This won't work, won't give all the players.Make it server side. addCommandHandler ( "sendall", function ( player, cmd, amount ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then if tonumber ( amount ) ~= nil then for id, player in ipairs ( getElementsByType ( "player" ) ) do givePlayerMoney ( player, tonumber ( amount ) ) outputChatBox("#FF0000 *** ADMIN HAS GIVEN MONEY: #00FF00" .. amount .. "$ #FF0000 TO ALL PLAYERS *** ", root, 255,0,0,true) end) Hello , thaks very much .. it worked after some edites thank you Link to comment
will briggs Posted August 16, 2011 Share Posted August 16, 2011 May i add somthing? Please dont post everything in large font. Link to comment
Headshot4Fun Posted August 17, 2011 Share Posted August 17, 2011 May i add somthing? Please dont post everything in large font.And use: Link to comment
will briggs Posted August 17, 2011 Share Posted August 17, 2011 Yeah, lol i messed the lua tags. But i reakon he's really new Link to comment
Headshot4Fun Posted August 17, 2011 Share Posted August 17, 2011 Yeah, lol i messed the lua tags. But i reakon he's really new Well. The first thing you see when you get inside scripting part of the forum is "Proper way of asking questions (READ before asking for help)". I Guess laziness was hard in this one ^^ Link to comment
will briggs Posted August 18, 2011 Share Posted August 18, 2011 lol, So few people read those topics 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