Al3grab Posted August 16, 2011 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 ? ING : [xXx]~Al3grab
JR10 Posted August 16, 2011 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) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Al3grab Posted August 16, 2011 Author 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 ING : [xXx]~Al3grab
JR10 Posted August 16, 2011 Posted August 16, 2011 No problem. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
will briggs Posted August 16, 2011 Posted August 16, 2011 May i add somthing? Please dont post everything in large font. Founder of SAUR - Founder/Owner of ARC RPG
Headshot4Fun Posted August 17, 2011 Posted August 17, 2011 May i add somthing? Please dont post everything in large font.And use:
will briggs Posted August 17, 2011 Posted August 17, 2011 Yeah, lol i messed the lua tags. But i reakon he's really new Founder of SAUR - Founder/Owner of ARC RPG
Headshot4Fun Posted August 17, 2011 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 ^^
will briggs Posted August 18, 2011 Posted August 18, 2011 lol, So few people read those topics Founder of SAUR - Founder/Owner of ARC RPG
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