Advertisement
GaMeRFoReVeR

Untitled

Mar 7th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.01 KB | None | 0 0
  1. /*
  2.  
  3. Happy Hour by fiendshard
  4.  
  5. CVARS:
  6.         zp_hhstart < number > - time when to start happy hour
  7.         zp_hhend < number > - time when to end happy hour
  8.         zp_hhx < number > - how many times to multiply happy hour rewards
  9.  
  10.  
  11. */
  12. #include <amxmodx>
  13.  
  14. new cvar_start,cvar_end, cvar_multi, zm, hm
  15.  
  16. public plugin_init()
  17.  {
  18.         register_plugin("[ZP] Addon: Happy Hour", "0.1", "fiendshard")
  19.         register_logevent("round_start", 2, "1=Round_Start")
  20.         register_logevent("round_end", 2, "1=Round_End")
  21.        
  22.         zm = get_cvar_num("zp_zombie_infect_reward")
  23.         hm = get_cvar_num("zp_human_damage_reward")
  24.  
  25.         cvar_start = register_cvar("zp_hhstart", "18")
  26.         cvar_end = register_cvar("zp_hhend", "24")
  27.         cvar_multi = register_cvar("zp_hhx", "2")
  28. }
  29.  
  30. public round_start()
  31. {
  32.         if(Double_Ammo())
  33.         {
  34.                 set_cvar_num("zp_human_damage_reward", hm / (get_cvar_num("zp_hhx")))
  35.                 set_cvar_num ("zp_zombie_infect_reward", zm* (get_cvar_num("zp_hhx")))
  36.                 client_print(0, print_chat, "Happy Hour! Starts at: %d o'clock - Ends at: %d o'clock. It multiplies AP by %d", get_pcvar_num(cvar_start), get_pcvar_num(cvar_end), get_pcvar_num(cvar_multi))
  37.         }
  38.        
  39.         return PLUGIN_CONTINUE
  40. }
  41.  
  42. stock bool:Double_Ammo()
  43. {
  44.         static szHours, szMinutes, szSeconds
  45.         time(szHours, szMinutes, szSeconds)
  46.        
  47.         if(get_pcvar_num(cvar_start) == get_pcvar_num(cvar_end))
  48.                 return false
  49.        
  50.         if(cvar_start > get_pcvar_num(cvar_end) && (szHours >= get_pcvar_num(cvar_start) || szHours < get_pcvar_num(cvar_end)))
  51.                 return true
  52.        
  53.         if(cvar_start < get_pcvar_num(cvar_end) && (szHours >= get_pcvar_num(cvar_start) || szHours < get_pcvar_num(cvar_end)))
  54.                 return true
  55.        
  56.         return false
  57. }
  58.  
  59. public round_end()
  60. {
  61.         set_cvar_num("zp_human_damage_reward", hm )
  62.         set_cvar_num ("zp_zombie_infect_reward", zm)
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement