Raised This Month: $ Target: $400
 0% 

Solved check team = 0 when disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-15-2017 , 13:39   check team = 0 when disconnect
Reply With Quote #1

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!
        
}
    }

__________________

Last edited by abdobiskra; 02-20-2017 at 10:01.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-15-2017 , 13:44   Re: check team = 0 when disconnect
Reply With Quote #2

i = 0

get_players sets players id in the array starting from 0

for(new i=0;i < num;i++)
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-15-2017 , 13:45   Re: check team = 0 when disconnect
Reply With Quote #3

What are you trying to do?
__________________
HamletEagle is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-15-2017 , 13:54   Re: check team = 0 when disconnect
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
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 :
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-15-2017 , 14:00   Re: check team = 0 when disconnect
Reply With Quote #5

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

__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-15-2017 , 14:05   Re: check team = 0 when disconnect
Reply With Quote #6

Quote:
Originally Posted by abdobiskra View Post
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
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-15-2017 , 14:17   Re: check team = 0 when disconnect
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
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
__________________

Last edited by Black Rose; 02-15-2017 at 14:21.
Black Rose is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-15-2017 , 14:24   Re: check team = 0 when disconnect
Reply With Quote #8

Quote:
Originally Posted by edon1337 View Post
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 !
__________________

Last edited by abdobiskra; 02-15-2017 at 14:27.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-15-2017 , 14:44   Re: check team = 0 when disconnect
Reply With Quote #9

Quote:
Originally Posted by Black Rose View Post
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 ?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-15-2017 at 14:46.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-15-2017 , 16:05   Re: check team = 0 when disconnect
Reply With Quote #10

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?
__________________

Last edited by edon1337; 02-15-2017 at 16:05.
edon1337 is offline
Reply


Thread Tools
Display Modes

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 21:00.


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