AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with variables (https://forums.alliedmods.net/showthread.php?t=102053)

MasterKy 08-29-2009 17:31

Problem with variables
 
PHP Code:

public plugin_init()
{
   
register_plugin("P.M","1.0","MasterKy")

    
register_event("DeathMsg""EVENT_TakeDamage""be")
    
RegisterHam(Ham_TakeDamage"player""EVENT_TakeDamage")
        
}

public 
EVENT_TakeDamage(id){
new 
iPlayers32 ];
new 
iPlayerCount
get_players 
iPlayers iPlayerCount "a" "CS_TEAM_T" );
        if(
iPlayerCount == 1){
        
        }else
        if(
iPlayerCount == 2){
        new 
CsTeams:userTeam cs_get_user_team(id)
        if(
get_user_attacker(id)){
            if(
userTeam == CS_TEAM_T) {
            
cs_set_user_team(id,CS_TEAM_CT)
            
visivel(id)
            
ultimoPlayer()
            
modelPlayer()
                }
            }
        }else{
            
cs_set_user_team(id,CS_TEAM_CT)
            
visivel(id)
            
contaPlayersTimes()
            
client_print(0,print_chat"Hahaha. %s FOI PEGOOO!!!",id)
            
server_cmd("amx_execall spk misc/risamalo")
            }
        return 
PLUGIN_CONTINUE


It is an part of my plugin.
The terrorist player go to CT if he get attacked
If have only 2, it send 1 for CT and the last terrorist receive a CT Player Model.
When the last be attacked and killed, the game over.

but... THIS DONT WORK CORRECTLY :cry:

PHP Code:

    if(iPlayerCount == 2){ 

and
PHP Code:

    if(iPlayerCount == 1){ 

dont work!

Whats up?
plz help me!

Bugsy 08-29-2009 17:36

Re: Problem with variables
 
PHP Code:

get_players iPlayers iPlayerCount "a" "CS_TEAM_T" ); 

Look at your get_players call. It looks like you will need to add "e" flag for team. This function is buggy though, I would pass no flags and do team\alive checking manually.

Code:

If specified, you can constrain which players are returned by flags:
"a" - Don't return dead players
"b" - Don't return alive players
"c" - Skip bots
"d" - Skip real players
"e" - Match with passed team
"f" - Match with part of name
"g" - Ignore case sensitivity
"h" - Skip HLTV


xPaw 08-29-2009 17:51

Re: Problem with variables
 
get_players( iPlayers, iPlayerCount, "ae", "TERRORIST" );

Will be more right, bugsy.

EDIT: Oh damn it was from his code ;D


All times are GMT -4. The time now is 15:01.

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