Plugin :
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <geoip>
#define PLUGIN_NAME "Te dhenat e konektimit"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "Fr0sTt"
enum _:eSettings
{
CHAT_PREFIX[32],
MOTD_TITLE[32],
CONNECT_MODE,
HUD_MESSAGE_COLOR[11],
Float:HUD_MESSAGE_POS_X,
Float:HUD_MESSAGE_POS_Y,
HUD_MESSAGE_EFFECTS,
Float:HUD_MESSAGE_DURATION,
Float:SHOW_MSG_TIME,
UNKNOWN_COUNTRY[15]
}
new g_eSettings[eSettings]
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
register_cvar( "ConnectInfo", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED )
fileRead()
}
public client_putinserver(id)
{
set_task( g_eSettings[SHOW_MSG_TIME], "Information", id )
}
public Information(id)
{
new szName[32], szIP[20], szAuthid[35], szCountry[64], szCity[64], szContinent[64]
new szText[512], szRed[4], szGreen[4], szBlue[4], iRed, iGreen, iBlue
get_user_name(id, szName, charsmax(szName))
get_user_ip(id, szIP, charsmax(szIP), 1)
get_user_authid(id, szAuthid, charsmax(szAuthid))
#if defined geoip_country_ex
geoip_country_ex(szIP, szCountry, charsmax(szCountry))
#else
geoip_country(szIP, szCountry, charsmax(szCountry))
#endif
geoip_city(szIP, szCity, charsmax(szCity))
geoip_continent_name(szIP, szContinent, charsmax(szContinent))
check_validity(szCity, charsmax(szCity))
check_validity(szCountry, charsmax(szCountry))
check_validity(szContinent, charsmax(szContinent))
new szCountryCode[3], szContinentCode[3]
#if defined geoip_code2_ex
geoip_code2_ex(szIP, szCountryCode)
#else
geoip_code2(szIP, szCountryCode)
#endif
geoip_continent_code(szIP, szContinentCode)
check_validity(szContinentCode, charsmax(szContinentCode))
switch(g_eSettings[CONNECT_MODE])
{
case 1:
{
CC_SendMessage( id, "%s &x01Pershendetje &x03%s&x01. IP juaj [&x04%s&x01]. SteamID juaj [&x04%s&x01].", g_eSettings[CHAT_PREFIX], szName, szIP, szAuthid )
CC_SendMessage( id, "%s &x01Ju jeni nga &x03%s&x01 [&x04%s&x01]. Qyteti juaj eshte&x03 %s&x01. Kontinenti juaj &x03%s&x01 [&x04%s&x01].", g_eSettings[CHAT_PREFIX], szCountry, szCountryCode, szCity, szContinent, szContinentCode )
CC_SendMessage( id, "%s &x01Kenaquni &x04& &x01mos luaj me qica!", g_eSettings[CHAT_PREFIX])
}
case 2:
{
parse(g_eSettings[HUD_MESSAGE_COLOR], szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue))
iRed = str_to_num(szRed)
iGreen = str_to_num(szGreen)
iBlue = str_to_num(szBlue)
set_hudmessage( iRed, iGreen, iBlue, g_eSettings[HUD_MESSAGE_POS_X], g_eSettings[HUD_MESSAGE_POS_Y], g_eSettings[HUD_MESSAGE_EFFECTS], 2.0, g_eSettings[HUD_MESSAGE_DURATION], 0.03, 0.2 )
show_hudmessage( id, "%s Pershendetje %s. IP juaj eshte [%s]. SteamID [%s].^nKeni hyr nga %s [%s]. Qyteti juaj %s. Kontinenti juaj eshte %s [%s].^nKenaquni & mos luani me qica!", g_eSettings[CHAT_PREFIX], szName, szIP, szAuthid, szCountry, szCountryCode, szCity, szContinent, szContinentCode )
}
case 3:
{
formatex(szText, charsmax(szText), "<html><head></head><body bgcolor=^"#000^" text=^"#ff0000^"><br/><b>Pershendetje %s</b><br/><b>IP juaj eshte [%s]</b><br/><b>SteamID [%s]</b><br/><b>Keni hyr nga %s [%s]</b><br/><b>Qyteti juaj %s</b><br/><b>Kontinenti juaj eshte %s [%s]</b><br/><b>Kenaquni & mos luaj me qica!</b><br/></body></html>", szName, szIP, szAuthid, szCountry, szCountryCode, szCity, szContinent, szContinentCode )
show_motd(id, szText, g_eSettings[MOTD_TITLE])
}
}
}
fileRead()
{
new szConfigsName[256], szFilename[256]
get_configsdir(szConfigsName, charsmax(szConfigsName))
formatex(szFilename, charsmax(szFilename), "%s/konektimi.ini", szConfigsName)
new iFilePointer, szData[96], szValue[64], szKey[32]
iFilePointer = fopen(szFilename, "rt")
if(!iFilePointer)
{
server_print("[Infot e Konektimit] Nuk mund te gjendet konektimi.ini ne configs!")
return
}
while(!feof(iFilePointer))
{
fgets(iFilePointer, szData,charsmax(szData))
trim(szData)
if(szData[0] == EOS || szData[0] == ';' || szData[0] == '#' || (szData[0] == '/' && szData[1] == '/'))
continue
strtok(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '=')
trim(szKey); trim(szValue)
if(equal(szKey, "CHAT_PREFIX"))
copy(g_eSettings[CHAT_PREFIX], charsmax(g_eSettings[CHAT_PREFIX]), szValue)
else if(equal(szKey, "MOTD_TITLE"))
copy(g_eSettings[MOTD_TITLE], charsmax(g_eSettings[MOTD_TITLE]), szValue)
else if(equal(szKey, "CONNECT_MODE"))
g_eSettings[CONNECT_MODE] = str_to_num(szValue)
else if(equal(szKey,"HUD_MESSAGE_COLOR"))
copy(g_eSettings[HUD_MESSAGE_COLOR], charsmax(g_eSettings[HUD_MESSAGE_COLOR]), szValue)
else if(equal(szKey,"HUD_MESSAGE_POS_X"))
g_eSettings[HUD_MESSAGE_POS_X] = str_to_float(szValue)
else if(equal(szKey,"HUD_MESSAGE_POS_Y"))
g_eSettings[HUD_MESSAGE_POS_Y] = str_to_float(szValue)
else if(equal(szKey,"HUD_MESSAGE_EFFECTS"))
g_eSettings[HUD_MESSAGE_EFFECTS] = str_to_num(szValue)
else if(equal(szKey,"HUD_MESSAGE_DURATION"))
g_eSettings[HUD_MESSAGE_DURATION] = str_to_float(szValue)
else if(equal(szKey,"SHOW_MSG_TIME"))
g_eSettings[SHOW_MSG_TIME] = str_to_float(szValue)
else if(equal(szKey, "UNKNOWN_COUNTRY"))
copy(g_eSettings[UNKNOWN_COUNTRY], charsmax(g_eSettings[UNKNOWN_COUNTRY]), szValue)
}
fclose(iFilePointer)
}
stock check_validity( szText[], const iLen ) //ot chatmanager na OcixCrom
{
if( !szText[0] )
copy( szText, iLen, g_eSettings[UNKNOWN_COUNTRY] )
}
File .ini
Код за потвърждение: Избери целия код
#=====================================================#
# Informatat e lidhjes(konektimit) v 1.1 #
#=====================================================#
# Prefix
PLUGIN_PREFIX = &x03[&x04ConnectInfo&x03]
# Titulli ne Motd
MOTD_TITLE = ConnectInformation
# Te dhenat e modes informimit
# 1 = chat message; 2 = hudmessage; 3 = motd
CONNECT_MODE = 2
# HUD message color
HUD_MESAGE_COLOR = 124 124 255
# HUD message position X
HUD_MESSAGE_POS_X = -1.0
# HUD message position Y
HUD_MESSAGE_POS_Y = 0.05
# HUD message effects
HUD_MESSAGE_EFFECTS = 2
# HUD message duration.
HUD_MESSAGE_DURATION = 5.0
# Time to show chat message
SHOW_MSG_TIME = 5.0
# Prefix of unknown countries
UNKNOWN_COUNTRY = Panjohur