Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <fvault>
- #define PREFIX "ProKillers"
- // Itt tudod bekapcsolni a HUD-ot. Töröld ki a // jelet a # előtt, ha be akarod kapcsolni.
- //#define HUD
- new const g_vaultName[] = "JATSZOTTIDO";
- new ora[33], perc[33];
- new iSteamID[33][32];
- public plugin_init() {
- register_plugin("Jatszott ido", "1.0", "mforce")
- register_cvar("jatszott_ido", "mforce", FCVAR_SERVER | FCVAR_SPONLY);
- register_clcmd("say /ido","jatszottido")
- register_concmd("amx_jatekido", "admin_showptime", ADMIN_KICK," <Jatekos neve> - Kiirja a jatek idot.");
- #if defined HUD
- set_task(1.0, "huduzi",_,_,_,"b");
- #endif
- }
- public jatszottido(id) print_color(id, "!g[%s]!y Játszott idő:!t %i!y óra!t %i !yperc", PREFIX, ora[id], perc[id]);
- #if defined HUD
- public huduzi() {
- new players[32], num;
- get_players(players, num);
- for(new i; i<num; i++)
- {
- new id = players[i];
- new oraszamlalo[8];
- formatex(oraszamlalo,charsmax(oraszamlalo), "%s", ora[id] < 10 ? " ":"");
- set_hudmessage(255, 50, 50, 0.02, 0.27, 0, 6.0, 0.9);
- show_hudmessage(id, " Játékidő^n%s%i óra %i perc", oraszamlalo, ora[id], perc[id]);
- }
- }
- #endif
- public szamlalo(id) {
- perc[id] += 1
- if(perc[id] == 60) perc[id] = 0, ora[id] += 1
- set_task(60.0, "szamlalo", id)
- return 1
- }
- public admin_showptime(id,level,cid) {
- if(!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- static arg[32];
- read_argv(1, arg, 31);
- new player = cmd_target(id, arg, 2);
- if(!player)
- return PLUGIN_HANDLED;
- static name[32];
- get_user_name(player, name, charsmax(name));
- console_print(id, "-----------------------(#Jatek Ido#)-----------------------");
- console_print(id, "%s jatszott ideje: %i ora es %i perc.", name, ora[player], perc[player]);
- console_print(id, "-----------------------------------------------------------------");
- return PLUGIN_HANDLED;
- }
- public client_putinserver(id) {
- if (is_user_bot(id) || is_user_hltv(id))
- return;
- else {
- get_user_authid(id, iSteamID[id], 31);
- if( containi( iSteamID[id], "_ID_LAN" ) != -1 ) get_user_ip( id, iSteamID[id], 31, 1 );
- ora[id] = 0;
- perc[id] = 0;
- set_task(60.0, "szamlalo", id);
- Load(id);
- }
- }
- public client_disconnect(id) {
- if (is_user_bot(id) || is_user_hltv(id))
- return;
- else {
- Save(id);
- }
- }
- Load(id) {
- new szData[32]
- new szKey[40]
- formatex(szKey , 39, "%s" , iSteamID[id])
- if(fvault_get_data(g_vaultName, szKey, szData, 31))
- {
- new iSpacePos = contain(szData, " ")
- if(iSpacePos > -1)
- {
- new percek[3];
- new orak[32];
- parse(szData , orak, 31, percek, 2)
- ora[id] = str_to_num(orak)
- perc[id] = str_to_num(percek)
- }
- }
- }
- Save(id) {
- new szData[35]
- new szKey[40]
- formatex(szKey, 39, "%s", iSteamID[id])
- formatex(szData, 34, "%i %i", ora[id], perc[id])
- fvault_set_data(g_vaultName, szKey, szData)
- }
- stock print_color(const id, const input[], any:...) {
- new count = 1, players[32]
- static msg[191]
- vformat(msg, 190, input, 3)
- replace_all(msg, 190, "!g", "^4")
- replace_all(msg, 190, "!y", "^1")
- replace_all(msg, 190, "!t", "^3")
- if (id) players[0] = id; else get_players(players, count, "ch")
- {
- for (new i = 0; i < count; i++)
- {
- if (is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
- write_byte(players[i])
- write_string(msg)
- message_end()
- }
- }
- }
- return PLUGIN_HANDLED
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement