Raised This Month: $ Target: $400
 0% 

Count Player Leaves


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 06-17-2014 , 16:36   Re: Count Player Leaves
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post

Why not simply do this ?
Because i want to count how many times the player disconnect but count when player disconnect more than 10 seconds.

@Nextra Thanks but one more question i can use a global count because i want to run one function to save this in sqlx?
Like this:

PHP Code:

#include <amxmodx>

#define RETRY_TIME 10.0

new Trie:g_last_leaveTrie:g_leave_countg_steamid[33][33];
new 
count[33]

public 
plugin_init() {
   
g_last_leave TrieCreate();
   
g_leave_count TrieCreate();
}

public 
client_authorized(client) {
   
get_user_authid(clientg_steamid[client], charsmax(g_steamid[]));

   new 
Float:last;
   if (
TrieGetCell(g_last_leaveg_steamid[client], last) && get_gametime() - last <= RETRY_TIME) {

      
TrieGetCell(g_leave_countg_steamid[client], count[client]);

      
TrieSetCell(g_leave_countg_steamid[client], count[client]--);
   }
}

public 
client_disconnect(client) {
   
TrieSetCell(g_last_leaveg_steamid[client], get_gametime());

   
TrieGetCell(g_leave_countg_steamid[client], count[client]);
   
TrieSetCell(g_leave_countg_steamid[client], count[client]++);


Last edited by pepe_thugs; 06-17-2014 at 16:37.
pepe_thugs is offline
 



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:13.


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