/* Plugin generated by AMXX-Studio */
#include
#include
#include
#define PLUGIN "Czas Gry"
#define VERSION "1.0"
#define AUTHOR "author"
new gszFile[201], czas[33], szDir[64];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /czasgry", "pokaz_czas_gry");
register_clcmd("say_team /czasgry", "pokaz_czas_gry");
register_clcmd("say /czas", "pokaz_czas_gry");
register_clcmd("say_team /czas", "pokaz_czas_gry");
get_basedir(szDir, sizeof szDir);
formatex(gszFile, 200, "%s/configs/czas_gry/", szDir);
}
public client_putinserver(id)
{
if(!is_user_steam(id))
{
return PLUGIN_CONTINUE;
}
new steam_id[35], adres[201], iLen, Text[32];
get_user_authid(id, steam_id, sizeof steam_id - 1);
formatex(adres, 200, "%s/%s.ini", gszFile, steam_id);
if(file_exists(adres))
{
read_file(adres, 0, Text, 31, iLen);
trim(Text);
czas[id] = str_to_num(Text);
}
else
{
czas[id] = 0;
}
return PLUGIN_HANDLED;
}
public pokaz_czas_gry(id)
{
if(!is_user_steam(id))
{
return PLUGIN_HANDLED;
}
new iCurTime = get_user_time( id , 1 );
new Time = czas[id];
if((iCurTime + Time) / 60 < 60)
{
ColorChat(id, GREEN, "[CzasGry]^x01 Spedziles na serwerze^x03 %d^x01 min.", (iCurTime + Time) / 60);
}
else
{
ColorChat(id, GREEN, "[CzasGry]^x01 Spedziles na serwerze^x03 %d^x01 h ^x03%02d^x01 min.", (iCurTime + Time) / 3600, ((iCurTime + Time) / 60) % 60);
}
return PLUGIN_HANDLED;
}
public client_disconnect(id)
{
if(!is_user_steam(id))
{
return PLUGIN_HANDLED;
}
new steam_id[35], adres[201], Text[200];
get_user_authid(id, steam_id, sizeof steam_id - 1);
formatex(adres, 200, "%s/%s.ini", gszFile, steam_id);
new szTime = get_user_time( id , 1 ) + czas[id];
num_to_str(szTime, Text, charsmax(Text));
write_file(adres, Text, 0);
return PLUGIN_HANDLED;
}
stock bool:is_user_steam(id)
{
new authid[35];
get_user_authid(id, authid, sizeof authid - 1);
return contain(authid , ":") != -1 ? true : false;
}Lecz jak go wgrałem i pograłem trochę na serwie to nabiło mi tam 10min., lecz po wyjściu i wejściu na serwer już nie było tych 10min. tylko 0min
Użytkownik Amazing edytował ten post 25.11.2011 16:56


Dodatki SourceMod













