Raised This Month: $ Target: $400
 0% 

Problem with variables


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MasterKy
Junior Member
Join Date: Aug 2009
Old 08-29-2009 , 17:31   Problem with variables
Reply With Quote #1

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

PHP Code:
    if(iPlayerCount == 2){ 
and
PHP Code:
    if(iPlayerCount == 1){ 
dont work!

Whats up?
plz help me!

Last edited by MasterKy; 08-29-2009 at 17:35.
MasterKy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2009 , 17:36   Re: Problem with variables
Reply With Quote #2

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
__________________

Last edited by Bugsy; 08-29-2009 at 17:39.
Bugsy is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-29-2009 , 17:51   Re: Problem with variables
Reply With Quote #3

get_players( iPlayers, iPlayerCount, "ae", "TERRORIST" );

Will be more right, bugsy.

EDIT: Oh damn it was from his code ;D
__________________
xPaw is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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