AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   arguments does not match definition (https://forums.alliedmods.net/showthread.php?t=225630)

demortion 09-07-2013 05:20

arguments does not match definition
 
I'm Using Jailbreak Extended version for my Steam Cs server
it has coin option instead money or jailbreak pack
for that i have created a function it would give players coins via admin console command i've done everything correctly
my api is correct but its still showing an error -number of arguments does not match definition
i hope you can understand help me
my code

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <cs-store>

public plugin_init()
{
register_plugin("Admin Money coins","0.10","DM");
register_clcmd("amx_givecoin","cmd_givecoins" ,ADMIN_KICK,"<player> <amount> - gives specified player New coins");
}

public cmd_givecoins(id,level,cid)
{
// no access
if(!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED;

// grab arguments
new arg[32], arg2[32];
read_argv(1,arg,32);
read_argv(2,arg2,31);

// get player and validate
new player = cmd_target(id,arg,2);
if(!player) return PLUGIN_HANDLED;

// get coins and set it
new amount = str_to_num(arg2);
set_user_coins(player,get_user_coins(player)+ amount);

// get names
new playerName[32], adminName[32];
get_user_name(player,playerName,31);
get_user_name(id,adminName,31);

// get authids for log
new playerAuthid[32], adminAuthid[32];
get_user_authid(player,playerAuthid,31);
get_user_authid(id,adminAuthid,31);

log_amx("Give coin: ^"%s<%d><%s><>^" gave ^"%s<%d><%s><>^" $%i",adminName,get_user_userid(id),adminAuth i d,playerName,get_user_userid(player),playerAu thid,amount);

switch(get_cvar_num("amx_show_activity"))
{
case 2: client_print(0,print_chat,"ADMIN %s: give %s $%i",adminName,playerName,amount);
case 1: client_print(0,print_chat,"ADMIN: give %s $%i",playerName,amount);
}

console_print(id,"* Gave %s $%i",playerName,amount);

return PLUGIN_HANDLED;
}

and i know that im not good in scripting anyways -Beginner

simanovich 09-07-2013 14:09

Re: arguments does not match definition
 
Complites fine:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <cs-store>

public plugin_init(){
    
register_plugin("Admin Money coins","0.10","DM");
    
register_clcmd("amx_givecoin","cmd_givecoins" ,ADMIN_KICK,"<player> <amount> - gives specified player New coins");
}

public 
cmd_givecoins(id,level,cid){
    
    
// no access
    
if(!cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED;

    
// grab arguments
    
new arg[32], arg2[32];
    
read_argv(1,arg,32);
    
read_argv(2,arg2,31);
    
    
// get player and validate
    
new player cmd_target(id,arg,2);
    if(!
player) return PLUGIN_HANDLED;
    
    
// get coins and set it
    
new amount str_to_num(arg2);
    
set_user_coins(player,get_user_coins(player) + amount);
    
    
// get names
    
new playerName[32], adminName[32];
    
get_user_name(player,playerName,charsmax(playerName));
    
get_user_name(id,adminName,charsmax(adminName));
    
    
// get authids for log
    
new playerAuthid[32], adminAuthid[32];
    
get_user_authid(player,playerAuthid,31);
    
get_user_authid(id,adminAuthid,31);
    
    
log_amx("Give coin: ^"%s<%d><%s><>^" gave ^"%s<%d><%s><>^" $%i",adminName,get_user_userid(id),adminAuthid,playerName,get_user_userid(player),playerAuthid,amount);
    
    switch(
get_cvar_num("amx_show_activity"))
    {
        case 
2client_print(0,print_chat,"ADMIN %s: give %s $%i",adminName,playerName,amount);
        case 
1client_print(0,print_chat,"ADMIN: give %s $%i",playerName,amount);
    }
    
    
console_print(id,"* Gave %s $%i",playerName,amount);

    return 
PLUGIN_HANDLED;



demortion 09-08-2013 00:22

Re: arguments does not match definition
 
not working for me sad can you mail me the amxx file thank you anyways :) if its working for you

fysiks 09-08-2013 04:09

Re: arguments does not match definition
 
Quote:

Originally Posted by demortion (Post 2030386)
not working for me sad can you mail me the amxx file thank you anyways :) if its working for you

What doesn't work? Giving you the .amxx file won't make it magically work.

demortion 09-08-2013 12:56

Re: arguments does not match definition
 
^the purpose behind this is to find solution bro not this ! ? ?

fysiks 09-08-2013 15:05

Re: arguments does not match definition
 
Quote:

Originally Posted by demortion (Post 2030749)
^the purpose behind this is to find solution bro not this ! ? ?

Your statement doesn't make any sense. You should answer my question.


All times are GMT -4. The time now is 19:09.

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