AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP with plugin! (https://forums.alliedmods.net/showthread.php?t=133589)

totalcsscripting 07-26-2010 23:04

HELP with plugin!
 
PHP Code:

public admin_heal(id,level,cid) {
    if (!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED
    
new arg[32], arg2[8], name2[32]
    
read_argv(1,arg,31)
    
read_argv(2,arg2,7)
    
get_user_name(id,name2,31)
    if (
arg[0]=='@'){
        new 
players[32], inum
        get_players
(players,inum,"ae",arg[1])
        if (
inum==0){
            
console_print(id,"")
            return 
PLUGIN_HANDLED
        
}
        for(new 
a=0;a<inum;++a) {
            new 
user_health get_user_health(players[a])
            
set_user_health(players[a], str_to_num(arg2) + user_health)
        }
        switch(
get_cvar_num("amx_show_activity")) {
            case 
2:    client_print(0,print_chat,"",name2,arg[1])
            case 
1:    client_print(0,print_chat,"",arg[1])
        }
        
console_print(id,"")
    }
    else {
        new 
player cmd_target(id,arg,7)
        if (!
player) return PLUGIN_HANDLED
        
new user_health get_user_health(player)
        
set_user_health(playerstr_to_num(arg2) + user_health)
        new 
name[32]
        
get_user_name(player,name,31)
        switch(
get_cvar_num("amx_show_activity"))    {
            case 
2:    client_print(0,print_chat,"",name2,name)
            case 
1:    client_print(0,print_chat,"",name)
        }
        
console_print(id,"",name)
    }
    return 
PLUGIN_HANDLED



Y have this part of a plugin. When i call it i put:
amx_heal "name" "150"

and gaves me 150 more health. But i want to put that if i put:
amx_heal "name" "-100"

return my health to 100.
or y put:
amx_heal "name" "-50" and my heal goes to 50.


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

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