Raised This Month: $ Target: $400
 0% 

Fix this code plz


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Guld-Fisk
BANNED
Join Date: Nov 2009
Old 11-25-2009 , 19:51   Fix this code plz
Reply With Quote #1

Can someone fix this code?

PHP Code:
#include <amxmodx>
#include <colorchat>
#include <geoip>

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

public 
client_connect(id)
{
    new 
Name[32], Authid[32], Country[46], IP[21]
    
get_user_name(idName31)
    
get_user_authid(idAuthid31)
    
get_user_ip(idIP20)
    
geoip_country (IPCountry45)
    
ColorChat(0GREY"^x01**^x04%s ^x01[^x04%s^x01]^3 has connected from ^x01%s**"NameAuthidCountry)
}

public 
client_disconnect(id)
{
    new 
Name[32], Authid[32], Country[46], IP[21]
    
get_user_name(idName31)
    
get_user_authid(idAuthid31)
    
get_user_ip(idIP20)
    
geoip_country (IPCountry45)
    
ColorChat(0GREY"^x01**^x04%s ^x01[^x04%s^x01]^3 has connected from ^x01%s**"NameAuthidCountry)

Guld-Fisk is offline
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
Guld-Fisk
BANNED
Join Date: Nov 2009
Old 11-26-2009 , 08:15   Re: Fix this code plz
Reply With Quote #3

Thanks will test it now !

EDIT: when i compile i get this:

C:\Användare\Administratör\Skrivbord\Pawn Studio\temp206.inc(0) : fatal error 100: cannot read from file: "C:\Användare\Administratör\Skrivbord\Paw n Studio\temp206.inc"
Guld-Fisk is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-26-2009 , 08:36   Re: Fix this code plz
Reply With Quote #4

Quote:
Originally Posted by Guld-Fisk View Post
Thanks will test it now !

EDIT: when i compile i get this:

C:\Användare\Administratör\Skrivbord\Pawn Studio\temp206.inc(0) : fatal error 100: cannot read from file: "C:\Användare\Administratör\Skrivbord\Paw n Studio\temp206.inc"
You probably do not have the colorchat include because it isn't shipped with AMX-X.

See http://forums.alliedmods.net/showthread.php?t=94960
__________________
Bugsy is offline
Old 11-27-2009, 03:28
Arkshine
This message has been deleted by Arkshine. Reason: nvm
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 13:39.


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