AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Target Player (%s) (https://forums.alliedmods.net/showthread.php?t=224354)

Ardonicek 08-23-2013 08:38

Target Player (%s)
 
Hello, i want to force server a command to give player xp, but i don't know how to do it.

register_concmd("addxp", "HandleGive", ADMIN_RCON, "<name> <+/- xp>")

So it's addxp *name* *xp*

Now i want to insert it into case, which will do something like
addxp %s 100

but it doesn't work, what to do with %s ?

DWIGHTpN 08-23-2013 09:09

Re: Target Player (%s)
 
PHP Code:

public plugin_init() {
                 
register_concmd("addxp","HandleGive",ADMIN_RCON,"<name> <xp>");
}

public 
HandleGive(id,level,cid) {
               if( !
cmd_access(id,level,cid,0) )
                           return 
PLUGIN_HANDLED;
               new 
arg[33],arg2[15];
               
read_argv(1,arg,charsmax(arg));
               
read_argv(2,arg,charsmax(arg2));
               new 
xp str_to_num(arg2);
               new 
player cmd_target(id,arg2|);
               if( !
player || !xp )
                          return 
PLUGIN_HANDLED;
      
// add exp at target..
      
return PLUGIN_HANDLED;


Quote:

Now i want to insert it into case, which will do something like
addxp %s 100
What do you say ?

Ardonicek 08-23-2013 09:12

Re: Target Player (%s)
 
Okay, but i would like to insert it to a menu, where they can buy XP for money,
i just need to know what should be in "case".


All times are GMT -4. The time now is 18:48.

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