Raised This Month: $ Target: $400
 0% 

[Solved] Check if user is Connected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 11-15-2010 , 16:07   Re: Check if user is Connected
Reply With Quote #1

If you are checking if user is connected for example when you execute command where player is a target then using is_user_connected(id) is fine, but if you loop through all players in prethink then caching is_user_connected is better however your method is not the best. You should use something like this:
PHP Code:
new _pg_is_ced
#define _IsUserConnected(%1) ( _pg_is_ced & 1<<(%1) )
#define _SetUserConnected(%1) _pg_is_ced |= 1<<(%1)
#define _SetUserNotConnected(%1) _pg_is_ced &= ~( 1<<(%1) )

public client_connectedid _SetUserConnected(id)

public 
client_disconnectedid _SetUserNotConnected(id)

public 
some_function(id){
    if(
_IsUserConnected(id)){
        
//code...
    
}

__________________
Impossible is Nothing
Sylwester 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 11:21.


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