| Afro-Ankan |
07-13-2010 09:32 |
message doesn't shows when player connects
PHP Code:
#include <amxmodx> #include <geoip> #define MAX_SAVE_CONNECTS 10000 new g_iConnectSaves; new g_sAuthid[MAX_SAVE_CONNECTS][35]; new g_iConnections[MAX_SAVE_CONNECTS]; new g_iMsgSayText; new g_iMaxPlayers; public plugin_init() { register_plugin("Connect", "1.0", "someone"); g_iMsgSayText = get_user_msgid("SayText"); g_iMaxPlayers = get_maxplayers(); } public client_putinserver(id) { static sAuthid[sizeof(g_sAuthid[])], iNum; get_user_authid(id, sAuthid, sizeof(sAuthid) - 1); iNum = -1 if(g_iConnectSaves > 0) { static i; for(i = 0; i < g_iConnectSaves; i++) { if(equali(g_sAuthid[i], sAuthid)) { iNum = i; g_iConnections[i]++; break; } } } if(iNum == -1 && g_iConnectSaves < MAX_SAVE_CONNECTS) { copy(g_sAuthid[g_iConnectSaves], sizeof(g_sAuthid[]) - 1, sAuthid); iNum = g_iConnectSaves++; } static sName[32], sIP[64], sCountry[46]; get_user_name(id, sName, sizeof(sName) - 1); get_user_ip(id, sIP, sizeof(sIP) - 1, 1); geoip_country(sIP, sCountry, sizeof(sCountry) - 1); static sMessage[192]; formatex(sMessage, sizeof(sMessage) - 1, "^x04[Connect] %s connected from %s [Connections: %d]", sName, sCountry, g_iConnections[iNum]); green_print(0, sMessage); } public client_disconnect(id) { static sName[32], sIP[64], sCountry[46]; get_user_name(id, sName, sizeof(sName) - 1); get_user_ip(id, sIP, sizeof(sIP) - 1, 1); geoip_country(sIP, sCountry, sizeof(sCountry) - 1); static sMessage[192]; formatex(sMessage, sizeof(sMessage) - 1, "^x04[Connect] %s disconnected from %s.", sName, sCountry); green_print(0, sMessage); } stock green_print(index, sMessage[]) { if(get_playersnum() < 1) { return 0; } static MSG_type, id; if(is_user_connected(index)) { id = index; MSG_type = MSG_ONE_UNRELIABLE; } else { static i; for(i = 1; i <= g_iMaxPlayers; i++) { if(is_user_connected(i)) { id = i; break; } } MSG_type = MSG_BROADCAST; } message_begin(MSG_type, g_iMsgSayText, _, id); write_byte(id); write_string(sMessage); message_end(); return 1; }
|