Raised This Month: $ Target: $400
 0% 

Help me please.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dantrix
New Member
Join Date: Feb 2009
Old 08-24-2010 , 16:41   Help me please.
Reply With Quote #1

PHP Code:
public client_disconnect(id)
{
    if(
get_pcvar_num(lives) == 1)
    {
        
set_task(8.0"RestKarmaLive"id)
    }
}
public 
RestKarmaLive(id)
{
    if(!
is_user_connected(id)){
        
LoadKarma(id);
        new 
name[32];
        
get_user_name(idname31)
        
karma[id] -= 1;
        
client_print(0,print_chat"%L"LANG_PLAYER"LIVE_QUIT"name1)
        
server_print("%s lost karma!  KARMA: %d"namekarma[id])
        
SaveKarma(id);
    }
    

Hi.. i tried if the user disconnect ( with the cvar sv_live == 1 ) , and not reconnect yet in 8 seconds.., karma[id] -= 1(in nvault) .. and he's reconnect before past 8 second do nothing(duh)..
the LoadKarma ( just extrat values from nVault )
and the SaveKarma ( -.- saving nVault values).

server_print and the task work, but not decreasing 1 in the karma[id] ..

thx...
dantrix is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 17:07   Re: Help me please.
Reply With Quote #2

You cannot retrieve the name of a disconnected player. What are you using as the key for each player? Authid cannot be retrieved either if disconnected. You should store the values in a global string array at client putinserver.
__________________
Bugsy is offline
dantrix
New Member
Join Date: Feb 2009
Old 08-24-2010 , 17:21   Re: Help me please.
Reply With Quote #3

yes im using Authid.. , as would be the other way? these is the LoadKarma function:
PHP Code:
 stock LoadKarma(id)
{
    new 
valut nvault_open("Karma_System");  
    
    if(
valut == INVALID_HANDLE)
        
set_fail_state("nValut returned Invalid-Handle"); 
    
    new 
key[100], authid[33]
    
    
get_user_authid(idauthid32); 
    
    
formatex(key99,"%sKarma"authid);  
    
    
karma[id] = nvault_get(valutkey);  
    
nvault_close(valut);
    
    return 
PLUGIN_CONTINUE;

dantrix is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 17:45   Re: Help me please.
Reply With Quote #4

PHP Code:
//create global string array
new g_szAuthID33 ][ 34 ];

In client_authorized:
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) ); 
In your plugin, use g_szAuthID[ id ] to use a players steamid throughout your plugin. You can do the same thing for player names. You may want to use trie instead since a user could connect on the same slot as the disconnecting player within the 8 seconds.
__________________

Last edited by Bugsy; 08-24-2010 at 17:52.
Bugsy 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 21:56.


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