AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   @ HELP (https://forums.alliedmods.net/showthread.php?t=135490)

totalcsscripting 08-16-2010 18:21

@ HELP
 
I have this simple function.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <fun>
#include <fakemeta>


public plugin_init()
{
    
register_concmd("amx_vida","admin_vida",ADMIN_SLAY,"")
    return 
PLUGIN_CONTINUE
}
public 
admin_vida(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){
            return 
PLUGIN_HANDLED
        
}
        for(new 
a=0;a<inum;++a) {
            
client_print(idprint_chat"[TotalCS] Le cambiaste la vida a tu team!"
            
set_user_health(players[a], str_to_num(arg2))
        }
    }
    else {
        new 
player cmd_target(id,arg,7)
        if (!
player) return PLUGIN_HANDLED
        
        set_user_health
(playerstr_to_num(arg2))
        
client_print(idprint_chat"[TotalCS] Cambiaste tu vida!"
        new 
name[32]
        
get_user_name(player,name,31)

    }
    return 
PLUGIN_HANDLED


I can set helth to any player properly.
But when i try to set it to all:
amx_vida @ 200

Nothing Happens!!

platzpatrone 08-16-2010 18:31

Re: @ HELP
 
amx_vida @all 200 ;)

totalcsscripting 08-16-2010 18:35

Re: @ HELP
 
Quote:

Originally Posted by platzpatrone (Post 1272888)
amx_vida @all 200 ;)

I already tried that and still doesn't work!!

naven 08-16-2010 18:37

Re: @ HELP
 
Just use starting health
Isn't that better?

totalcsscripting 08-16-2010 18:44

Re: @ HELP
 
I need to solve this. Not other ideas. Thanks

YamiKaitou 08-16-2010 19:16

Re: @ HELP
 
Your code is not set to handle the @ALL arg. Here is a snippet from another plugin
PHP Code:

if( arg[0] == '@' )
    {
        new 
players[32], pnum
        
if( arg[1] == 'a' || arg[1] == 'A' )
        {
            
formatexarg31"everyone" )
            
get_playersplayerspnum"a" )
        }
        else if( 
arg[1] == 'c' || arg[1] == 'C' )
        {
            
formatexarg31"all CTs" )
            
get_playersplayerspnum"ae""CT" )
        }
        else if( 
arg[1] == 't' || arg[1] == 'T' )
        {
            
formatexarg31"all Ts" )
            
get_playersplayerspnum"ae""TERRORIST" )
        }
        else    return 
PLUGIN_HANDLED

        
if( !pnum ) return PLUGIN_HANDLED 


totalcsscripting 08-16-2010 19:42

Re: @ HELP
 
Quote:

Originally Posted by YamiKaitou (Post 1272926)
Your code is not set to handle the @ALL arg. Here is a snippet from another plugin
PHP Code:

if( arg[0] == '@' )
    {
        new 
players[32], pnum
        
if( arg[1] == 'a' || arg[1] == 'A' )
        {
            
formatexarg31"everyone" )
            
get_playersplayerspnum"a" )
        }
        else if( 
arg[1] == 'c' || arg[1] == 'C' )
        {
            
formatexarg31"all CTs" )
            
get_playersplayerspnum"ae""CT" )
        }
        else if( 
arg[1] == 't' || arg[1] == 'T' )
        {
            
formatexarg31"all Ts" )
            
get_playersplayerspnum"ae""TERRORIST" )
        }
        else    return 
PLUGIN_HANDLED

        
if( !pnum ) return PLUGIN_HANDLED 


Is there a way of only putting "@" and that the plugin recognise in what team you are and then sets what you want only in your team

YamiKaitou 08-16-2010 22:31

Re: @ HELP
 
Yes, if you code it to do that


All times are GMT -4. The time now is 21:52.

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