Raised This Month: $ Target: $400
 0% 

Give Money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 03-06-2009 , 08:47   Give Money
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN "Admin Rich"
#define VERSION "1.0"
#define AUTHOR "emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_concmd("amx_rich""cmd_rich"ADMIN_SLAY"<give user 16000$>")
    return 
PLUGIN_HANDLED
}

public 
cmd_rich(idlevelcid)
{
    new 
Arg1[24]
    new 
Arg2[4]
    
    
read_argv(1Arg123)
    
read_argv(2Arg23)
    
    new 
players[32], num
    get_players
(playersnum)
    new 
i
    
for (i=0i<numi++)
    
    
cs_set_user_money(players[i], 16000)
    return 
PLUGIN_HANDLED

Plugins does not works correctly . When I type "amx_rich" I am getting 16000$ but when I type For example: "amx_rich tarasa" he does not gets money! What is wrong
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-06-2009 , 09:06   Re: Give Money
Reply With Quote #2

You must check if the arg is a character, for instance @, wich means all players. Then loop trough all player like you did. Otherwise use cmd_target. Here you have an example of doing that: http://wiki.amxmodx.org/Intro_to_AMX_Mod_X_Scripting
__________________

anakin_cstrike is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 03-06-2009 , 09:11   Re: Give Money
Reply With Quote #3

This would be more correctly:
PHP Code:
public cmd_rich(idlevelcid

    if(!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED
    
new Arg1[24
    new 
Arg2[4
     
    
read_argv(1Arg123
    
read_argv(2Arg23
     
    new 
players[32], num 
    get_players
(playersnum
    new 

    
for (i=0i<numi++) 
     
    
cs_set_user_money(players[i], 16000
    return 
PLUGIN_HANDLED 

TheRadiance is offline
Send a message via ICQ to TheRadiance
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-06-2009 , 09:12   Re: Give Money
Reply With Quote #4

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike>   public plugin_init()         register_concmd("amx_rich", "Rich", ADMIN_SLAY, "<name or #userid> - gives $16000");   public Rich(Client, Level, Command) {         if (!cmd_access(Client, Level, Command, 3))                 return PLUGIN_HANDLED;           new Argument[32]         read_argv(1, Argument, 1);           new Target = cmd_target(Client, Argument, CMDTARGET_ALLOW_SELF | CMDTARGET_OBEY_IMMUNITY);           if (Target)         {                 new AdminName[32], TargetName[32];                   get_user_name(Client, AdminName, 31);                 get_user_name(Target, TargetName, 31);                 cs_set_user_money(Target, 16000, 1);                 client_print(0, print_chat, "ADMIN %s :  set %s's money to $16000", AdminName, TargetName);         }           return PLUGIN_HANDLED; }
__________________
hleV is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-06-2009 , 09:13   Re: Give Money
Reply With Quote #5

Quote:
new Argument[32]

read_argv(1, Argument, 1);
->
Code:
read_argv( 1, Argument, 31 );
__________________

anakin_cstrike is offline
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-06-2009 , 09:14   Re: Give Money
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "Admin Rich"
#define VERSION "1.0"
#define AUTHOR "emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_concmd("amx_rich""cmd_rich"ADMIN_SLAY"<give user 16000$>")
    return 
PLUGIN_HANDLED 
}
 
public 
cmd_rich(idlevelcid)
{
     if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED
 
     
new Arg1[24]
     new 
Arg2[4]
 
     
read_argv(1Arg123)
     
read_argv(2Arg23)
 
     new 
Money str_to_num(Arg2)
 
     if (
Arg1[0] == '@')
     {
          new 
Team 0
          
if (equali(Arg1[1], "CT"))
          {
               
Team 2
          
} else if (equali(Arg1[1], "T")) {
               
Team 1
          
}
          new 
players[32], num
          get_players
(playersnum)
          new 
i
          
for (i=0i<numi++)
          {
               if (!
Team)
               {
                    
cs_set_user_money(players[i], Money)
               } else {
                    if (
get_user_team(players[i]) == Team)
                    {
                         
cs_set_user_money(players[i], Money)
                    }
               }
          }
     } else {
          new 
player cmd_target(idArg11)
          if (!
player)
          {
               
console_print(id"Didn't found %s"Arg1)
               return 
PLUGIN_HANDLED
          
} else {
               
cs_set_user_money(playerMoney)
          }
     }
 
     return 
PLUGIN_HANDLED

EDIT: Dang every1 helped him so fast!

Last edited by iNspiratioN; 03-06-2009 at 09:17.
iNspiratioN is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 03-06-2009 , 09:32   Re: Give Money
Reply With Quote #7

Thanks for helping! +karma to all

And can you tell me. Whats is the difference:
"ADMIN_KICK" and "ADMIN_LEVEL_C" ??

Thanks again
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-06-2009 , 09:48   Re: Give Money
Reply With Quote #8

Check out users.ini
PS: There is no need to write a message if the player isn't found.
__________________

anakin_cstrike is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 03-06-2009 , 10:51   Re: Give Money
Reply With Quote #9

Done. I made that plugin. But there is one bug. When I type "amx_rich emilioneri"
I don't get money. I have to type any symbol, letter or number after the name.
for example: "amx_rich emilioneri s" or "amx_rich emilioneri 3" or "amx_rich emilioneri >" and etc.

Here is the code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Admin Rich"
#define VERSION "1.0"
#define AUTHOR "emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_concmd("amx_rich""cmd_rich"ADMIN_SLAY"<name | #userid> - makes player rich!")
    
    return 
PLUGIN_HANDLED
}

public 
cmd_rich(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
             return 
PLUGIN_HANDLED
         
    
new Argument[32]
    
    
read_argv(1Argument31)
    
    new 
Target cmd_target(idArgumentCMDTARGET_ALLOW_SELF)
    
    if(
Target)
    
    
cs_set_user_money(Target16000)
    
    return 
PLUGIN_HANDLED

__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
padilha007
Senior Member
Join Date: Jul 2008
Old 03-06-2009 , 11:03   Re: Give Money
Reply With Quote #10

read_argv(1, Argument, 31)

to:

read_argv(0, Argument, 31)
__________________

padilha007 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode