AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved check team = 0 when disconnect (https://forums.alliedmods.net/showthread.php?t=293947)

abdobiskra 02-15-2017 13:39

check team = 0 when disconnect
 
Hi !
i cant check it ? where is the worong ?
PHP Code:

public client_disconnect(id){
    
    new 
team_name[32];
    new 
team_number get_user_team(idteam_namecharsmax(team_name));
    
    new 
numplayers[32]
    
get_players(players,num)
    
    for(new 
i=0;i<=num;i++)
    {
        if(
get_user_team(players[i])== team_number
        {
            
client_print(0print_chat"**End1**")// debug!
        
}
    }



Natsheh 02-15-2017 13:44

Re: check team = 0 when disconnect
 
i = 0

get_players sets players id in the array starting from 0

for(new i=0;i < num;i++)

HamletEagle 02-15-2017 13:45

Re: check team = 0 when disconnect
 
What are you trying to do?

abdobiskra 02-15-2017 13:54

Re: check team = 0 when disconnect
 
Quote:

Originally Posted by HamletEagle (Post 2495647)
What are you trying to do?

I want to I check that none of the two teams does not have the players
I can not determine whether any of the two teams does not contain the players?
in function client_disconnect :

edon1337 02-15-2017 14:00

Re: check team = 0 when disconnect
 
PHP Code:

public client_disconnect(id){
    
    new 
players_ct[32], players_t[32], num_ctnum_t;
    
    
get_players(players_ctnum_ct"e""CT");
    
get_players(players_tnum_t"e""TERRORIST");

    if(
num_ct == && num_t == 0)   
    
// your code



Natsheh 02-15-2017 14:05

Re: check team = 0 when disconnect
 
Quote:

Originally Posted by abdobiskra (Post 2495651)
I want to I check that none of the two teams does not have the players
I can not determine whether any of the two teams does not contain the players?
in function client_disconnect :

It will never print the msg since the disconnected player team num is 0 none of the players whos connected will match his team number which is 0

Black Rose 02-15-2017 14:17

Re: check team = 0 when disconnect
 
Quote:

Originally Posted by Natsheh (Post 2495657)
It will never print the msg since the disconnected player team num is 0 none of the players whos connected will match his team number which is 0

Test stuff before you share them as facts.
This is not true.

Code:
public client_disconnect(id)     server_print("Team: %d", get_user_team(id));

Code:

Team: 2

abdobiskra 02-15-2017 14:24

Re: check team = 0 when disconnect
 
Quote:

Originally Posted by edon1337 (Post 2495656)
PHP Code:

public client_disconnect(id){
    
    new 
players_ct[32], players_t[32], num_ctnum_t;
    
    
get_players(players_ctnum_ct"e""CT");
    
get_players(players_tnum_t"e""TERRORIST");

    if(
num_ct == && num_t == 0)   
    
// your code



I tried that before I did not get results

btw i need to check if team1 = 0 || team2 == 0
so it should be :
PHP Code:

 if(num_ct == || num_t == 0

I want more clarification for others only !

Natsheh 02-15-2017 14:44

Re: check team = 0 when disconnect
 
Quote:

Originally Posted by Black Rose (Post 2495662)
Test stuff before you share them as facts.
This is not true.

Code:
public client_disconnect(id)     server_print("Team: %d", get_user_team(id));

Code:

Team: 2


Ithought the team will be reseted on client disconnected

Well i guess it will only be reseted on client putinserver


When dose the team variable will equal to -1 ?

edon1337 02-15-2017 16:05

Re: check team = 0 when disconnect
 
Natsheh, if it got reset on client_disconnect, why would one save data in that forward? We all would lose our data due to invalid player.

@Abdobis, I didn't know the purpose of your plugin so I used &&, what clarification do you want?


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

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