Raised This Month: $ Target: $400
 0% 

Fix this code plz


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-25-2009 , 21:54   Re: Fix this code plz
Reply With Quote #2

What is the problem you are having? Providing this makes it easier\faster for others to find your mistake. One major mistake I see is you are calling functions on the player in client_disconnect(); this should be never done because the player may already be gone at this point. You should cache the values from when they are called at client_putinserver() so they can safely be used at client_disconnect().

Try this (untested)
PHP Code:
#include <amxmodx>
#include <colorchat>
#include <geoip>

enum PlayerData
{
    
szName32 ],
    
szAuthID32 ],
    
szIP16 ],
    
szCountry46 ]
}

new 
PData33 ][ PlayerData ];

public 
plugin_init() 
{
    
register_plugin"connecting info" "1.0" "you" );
}

public 
client_putinserver(id)
{
    
get_user_nameid PDataid ][ szName ] , 31 );
    
get_user_authidid PDataid ][ szAuthID ] , 31);
    
get_user_ipid PDataid ][ szIP ] , 15 );
    
geoip_countryPDataid ][ szIP ] , PDataid ][ szCountry ] , 45 );
    
ColorChat(0GREY"^x01**^x04%s ^x01[^x04%s^x01]^3 has connected from ^x01%s**"PDataid ][ szName ] , PDataid ][ szAuthID ] , PDataid ][ szCountry ] );
}

public 
client_disconnect(id)
{
    
ColorChat(0GREY"^x01**^x04%s ^x01[^x04%s^x01]^3 has connected from ^x01%s**"PDataid ][ szName ] , PDataid ][ szAuthID ] , PDataid ][ szCountry ] );
    
PDataid ][ szName ][ ] = EOS;
    
PDataid ][ szAuthID ][ ] = EOS;
    
PDataid ][ szIP ][ ] = EOS;
    
PDataid ][ szCountry ][ ] = EOS;

__________________

Last edited by Bugsy; 11-28-2009 at 23:20.
Bugsy 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 13:39.


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