AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Client Disconnect ID (https://forums.alliedmods.net/showthread.php?t=294423)

edon1337 02-26-2017 13:21

Client Disconnect ID
 
I was wondering, what happens if you set a bool true on a specific id, then after that person disconnects, does the next person who will connect get access to that bool?

What I'm trying to say
Code:
new bool:g_IsPlayerVIP[33]; public fw_HamSpawnPost(id) { if(get_user_flags(id) & ADMIN_LEVEL_H) g_IsPlayerVIP[id] = true // we set the bool on this player true } public client_disconnect(id) { // we don't set bool to false } public client_putinserver(id) { // does this new player get the other player's id (is the g_IsPlayerVIP bool true on his id) ?

wickedd 02-26-2017 13:26

Re: Client Disconnect ID
 
Yes

edon1337 02-26-2017 13:39

Re: Client Disconnect ID
 
Quote:

Originally Posted by wickedd (Post 2498822)
Yes

Thanks.

Off: Could I ask, where are you from?

wickedd 02-26-2017 13:49

Re: Client Disconnect ID
 
The U.S.

OciXCrom 02-26-2017 15:26

Re: Client Disconnect ID
 
You can simply do this and you won't have to worry about it being transfered on another player:

Code:
g_IsPlayerVIP[id] = bool:(get_user_flags(id) & ADMIN_LEVEL_H)

Bugsy 02-26-2017 15:46

Re: Client Disconnect ID
 
Quote:

Originally Posted by OciXCrom (Post 2498886)
You can simply do this and you won't have to worry about it being transfered on another player:

Code:
g_IsPlayerVIP[id] = bool:(get_user_flags(id) & ADMIN_LEVEL_H)

The point of caching in a variable is to not have to call a native every time you need to check the value. But yes, this is a solution and the native is not expensive to call when needed.

OciXCrom 02-26-2017 15:59

Re: Client Disconnect ID
 
Well, if he wants to check the flags on each spawn, there's nothing that can be cached. Or if you mean the flags - they can change during gameplay, so I wouldn't cache then.

edon1337 02-27-2017 06:45

Re: Client Disconnect ID
 
Quote:

Originally Posted by OciXCrom (Post 2498886)
You can simply do this and you won't have to worry about it being transfered on another player:

Code:
g_IsPlayerVIP[id] = bool:(get_user_flags(id) & ADMIN_LEVEL_H)

Your point to mine is as close as this arrow

-->



to this



-->


Wickedd already answered my question.

OciXCrom 02-27-2017 09:05

Re: Client Disconnect ID
 
What? I'm telling you that if you do that, it won't get "transfered", so you don't even need to use client_putinserver/client_disconnected.

edon1337 02-27-2017 09:17

Re: Client Disconnect ID
 
Quote:

Originally Posted by OciXCrom (Post 2499060)
What? I'm telling you that if you do that, it won't get "transfered", so you don't even need to use client_putinserver/client_disconnected.

I know what you meant but, I just wanted to know if the player who connects receives the id that the disconnected player had.


All times are GMT -4. The time now is 20:50.

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