Hi,
i have solo gunner plugin, and i have problem in it. when map changes / player reconnect the time returns back to normal (before gaining time from SoloGunner plugin )
what does this plugin do? =
Solo Gunner mode That to add more fun to our players gaming experience. This mode can be activated in any round and any map by Silvers, Goldens, and Administrators.
The player who activates this mode becomes a Solo Gunner and the following happens:
The solo gunner will have a knife and a USP gun with 26 bullets only.
The rest of the players will only be able to carry a knife.
The solo gunner's team must help him/her eliminate the opposing team.
The solo gunner shall get 5 minutes added to his/her total time on every player he/she kills.
If the solo gunner gets knifed and killed, he/she will lose 350 minutes of his/her total time and a bell-like sound will be played to inform others.
If a player kills a solo gunner, 100 minutes will be added to his/her total time.
If the solo gunner disconnects from the server (to avoid being killed), he/she will lose 350 minutes.
Solo Gunner Mode is activated for one round only. Everything would return to normal by next round.
Silvers can activate this mode once per day, Goldens twice per day, and Administrators three times per day. However, to keep this mode interesting, the server will allow Solo Gunner mode to be activated a total of 3 times per map.
-- the problem is this plugin works well with Alka's played time plugin and i have another played time works with SQL, In SQL version it dosen't save player's played time when i use set_user_playedtime ..
SoloGunner Code:
Spoiler
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <fakemeta> #include <engine> #include <cstrike> #include <nvault> #include <played_time> #define PLUGIN "SoloGunner Mode" #define VERSION "1.0" #define AUTHOR "Khalid :)" /* - - - - - - Edit Starts Here - - - - - - - - - - - - - - - - - - - - - - - - - - */ #define ADMIN_FLAG ADMIN_BAN #define GOLDEN_FLAG ADMIN_LEVEL_H #define SILVER_FLAG ADMIN_LEVEL_G #define ACTIVATE_DELAY 20.0 #define SOLO_AMMO 26 #define SOLO_MODEL "vip" // Times #define MINS_FOR_SOLO_KILL 5 #define MINS_DECREMENT_SOLO_KNIFED 350 #define MINS_FOR_SOLO_KILLER 100 #define SOLO_SUICIDE_TIME_DECREMENT 350 #define SOLO_DISCONNECT_TIME_DECREMENT 350 // Limits #define ADMIN_ACTIVATES 3 #define GOLDEN_ACTIVATES 2 #define SILVER_ACTIVATES 1 /* - - - - - - Edit Ends Here - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #define FINAL (ADMIN_FLAG | SILVER_FLAG | GOLDEN_FLAG) #define OFFSET_MAPZONES 235 #define IsValidPlayer(%1) (1 <= %1 <= g_iMaxPlayers) new bool:g_bRunning = false new g_iModeActivates[33], g_iSoloId, Float:g_flRoundStartGameTime new gMsgIdCurWeapon new gMsgIdStatusIcon new g_szOldModel[20] new gVault, g_iMaxPlayers enum _:Levels { ADMIN, GOLDEN, SILVER } new g_iActivateTimes[Levels] = { ADMIN_ACTIVATES, GOLDEN_ACTIVATES, SILVER_ACTIVATES } /* The player who activates this mode becomes a Solo Gunner and the following happens: The solo gunner will have a knife and a USP gun with 26 bullets only. The rest of the players will only be able to carry a knife. The solo gunner shall get 5 minutes added to his/her total time on every player he/she kills. -- wait If the solo gunner gets knifed and killed, he/she will lose 350 minutes of his/her total time and a bell-like sound will be played to inform others. -- wait If a player kills a solo gunner, 100 minutes will be added to his/her total time. -- wait If the solo gunner disconnects from the server (to avoid being killed), he/she will lose 350 minutes. -- wait Solo Gunner Mode is activated for one round only. Everything would return to normal by next round. Silvers can activate this mode once per day, Goldens twice per day, and Administrators three times per day. However, to keep this mode interesting, the server will allow Solo Gunner mode to be activated a total of 3 times per map. */ public plugin_precache() { new szFile[60] formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", SOLO_MODEL, SOLO_MODEL)
precache_model(szFile)
precache_sound("bell.wav") } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
if(equal(szWeapon, "knife")) { // Play bell sound client_cmd(0, "spk ^"bell^"")
client_print(iVictim, print_chat, "** %d minutes have been taken from you for being knifed and killed", MINS_DECREMENT_SOLO_KNIFED) set_user_playedtime(iVictim, get_user_playedtime(iVictim) - MINS_DECREMENT_SOLO_KNIFED) }
client_print(0, print_chat, "** %d minutes were added to %s for killing the SoloGunner", MINS_FOR_SOLO_KILLER, szName) set_user_playedtime(iKiller, get_user_playedtime(iKiller) + MINS_FOR_SOLO_KILLER) } } public message_StatusIcon(msgid, msgdest, id) { if(g_bRunning) { static szIcon[10] get_msg_arg_string(2, szIcon, charsmax(szIcon))
nvault_remove(gVault, szAuthId) formatex(szUses, charsmax(szUses), "%d", g_iModeActivates[id]) nvault_set(gVault, szAuthId, szUses) } CanActivate(id, iFlags) { if(get_gametime() - g_flRoundStartGameTime > ACTIVATE_DELAY) { console_print(id, "** Mode connot be activated as more than %f seconds passed since round start", ACTIVATE_DELAY) return 0 }
if( g_iModeActivates[id] > g_iActivateTimes[get_level(iFlags)] ) { console_print(id, "** You have exceeded the SoloGunner mode activates for this day") return 0 }
public plugin_cfg(){ sql = SQL_MakeDbTuple(host,user,pass,db) formatex(g_query,511,"CREATE TABLE IF NOT EXISTS `played_time` (name VARCHAR(32), playedtime INT, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)") SQL_ThreadQuery(sql,"query",g_query) } public handle_say(id) { static said[12] read_argv(1, said, 11)
switch(get_pcvar_num(showpt)) { case 0: return PLUGIN_HANDLED;
case 1 : { client_print(id, print_chat, "[Played-Time] You have been playing on the server for: %d minute%s.", timep, timep == 1 ? "" : "s"); client_print(id, print_chat, "[Played-Time] Your total played time on the server: %d minute%s.", timep+PlayedTime[id], timep+PlayedTime[id] == 1 ? "" : "s"); } case 2 : { set_hudmessage(255, 50, 50, 0.34, 0.50, 0, 6.0, 4.0, 0.1, 0.2, -1); show_hudmessage(id, "[Elite-Gaming] You have been playing on the server for: %d minute%s.^n[AMXX]Current time: %s", timep, timep == 1 ? "" : "s", ctime); } } return PLUGIN_HANDLED; } else if(equal(said,"/time")){ new data[1];data[0]=id
formatex(g_query,511,"SELECT * FROM played_time ORDER BY playedtime DESC LIMIT 15") SQL_ThreadQuery(sql,"show_top15",g_query,data,1)
console_print(id, "-----------------------(#PlayedTime#)-----------------------"); console_print(id, "[Played-Time] %s have been playing on the server for %d minute%s.",name, timep, timep == 1 ? "" : "s"); console_print(id, "[Played-Time] %s's total played time on the server %d minute%s.",name, timep+PlayedTime[player], timep == 1 ? "" : "s"); // new console_print(id, "-----------------------------------------------------------------");
return PLUGIN_HANDLED; } public client_disconnect(id){ new name[32]