Jump to content

[Script] /admingivecash playername ammount


CJGrove

Recommended Posts

I made a /admingivecash command it's protected so don't worrry ;)

thanks Jumba' for helping me with that part...

The command is: /admingivecash playername ammount

Script.lua

function admingivecash ( source, commandName, player2nick, ammount ) 
        acl = yourresourcename.admingivecash 
        local player2 = getPlayerFromNick ( player2nick ) 
        if ( player2 ) then 
         if ( ammount ~= "" and ammount ~= nil ) then 
          if ( hasObjectPermissionTo ( source, acl, false ) ) then 
           if ( hasObjectPermissionTo ( getThisResource (), acl, true ) ) then 
            setmoney = givePlayerMoney ( player2, ammount ) 
            else 
            outputChatBox ( "Admin give cash: The resource is not able to give cash to players. Please give this resource access to '" .. acl .. "' in the ACL to use this function.", source ) 
           end 
           setmoney = givePlayerMoney ( player2, ammount ) 
           else 
           outputChatBox ( "Admin give cash: You don't have permissions to use this command.", source ) 
          end 
             if ( setmoney ) then 
              outputChatBox ( "Money given to " .. player2nick .. "", source , 0, 255, 0 ) 
              else 
              outputChatBox ( "Money was NOT given to " .. player2nick .. "", source, 255, 0, 0) 
             end 
          end 
        else 
        outputChatBox ( "Player can't be found or there is non enterd.", source, 255, 0, 0) 
        end 
end 
  
addCommandHandler ("admingivecash", admingivecash ) 

put this in your acl.xml

<acl name="aGiveCash"> 
<right name="yourresourcename.admingivecash" access="true"/> 
</acl> 

and put this in your acl.xml on the group (example admin) if you want more than 1 group to use this command then you need to add this code on all groups that you want the code to use.

<acl name="aGiveCash"/> 

Greetings,

CJGrove

Edit: Now I see i didn't make that you can type a playername please be patientce...

Edit2: Added player2 fuction the new command is now: /admingivecash playername ammount

Edit3: Using eAi's method

Edit4: Lol forgot the command handler added it now.

Edited by Guest
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...