Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <fun>
- #define PLUGIN "Happy Hour"
- #define VERSION "1.0"
- #define AUTHOR "GaMeR FoReVeR"
- #define VAR "PublicHappyH"
- new const cmdGuns[][][] =
- {
- {"say /ak47", "GiveAk"},
- {"say /m4a1", "GiveM4"}
- };
- new cvar_start, cvar_end;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- register_cvar(VAR, VERSION, (FCVAR_SERVER|FCVAR_SPONLY));
- for(new i; i < sizeof cmdGuns; i++) register_clcmd(cmdGuns[i][0], cmdGuns[i][1]);
- cvar_start = register_cvar("hh_start", "23");
- cvar_end = register_cvar("hh_end", "10");
- }
- public GiveAk(id)
- {
- if(!is_user_alive(id) || is_user_bot(id))
- return PLUGIN_HANDLED;
- if(IsTime())
- {
- client_print(id, print_chat, "[Happy Hour] Dobio si AK47.");
- give_item(id, "weapon_ak47");
- }
- else
- client_print(id, print_chat, "[Happy Hour] Komanda trenutno nije dostupna.");
- return PLUGIN_CONTINUE;
- }
- public GiveM4(id)
- {
- if(!is_user_alive(id) || is_user_bot(id))
- return PLUGIN_HANDLED;
- if(IsTime())
- {
- client_print(id, print_chat, "[Happy Hour] Dobio si M4A1.");
- give_item(id, "weapon_m4a1");
- }
- else
- client_print(id, print_chat, "[Happy Hour] Komanda trenutno nije dostupna.");
- return PLUGIN_CONTINUE;
- }
- stock bool:IsTime()
- {
- static Hours, Minutes, Seconds;
- time(Hours, Minutes, Seconds);
- new BeginHour = get_pcvar_num(cvar_start);
- new EndHour = get_pcvar_num(cvar_end);
- if(BeginHour == EndHour)
- return false;
- if(BeginHour > EndHour && (Hours >= BeginHour || Hours < EndHour))
- return true;
- if(BeginHour < EndHour && (Hours >= BeginHour || Hours < EndHour))
- return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement