Page 2 of 2

Re: xp,coins loss for humans (camper)

Posted: 17 Mar 2020, 18:54
by Mystic Viper
  1. #include <zombie_escape>
  2.  
  3. #define COINS 50
  4. #define XP 50
  5. #define KILLED_FROM 5 // Time that anyone killed during will be punished
  6.  
  7. new g_iKilledTime[33]
  8.  
  9. public plugin_init()
  10. {
  11.     register_plugin("Campers Punishment", "1.0", "Raheem")
  12.    
  13.     RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
  14. }
  15.  
  16. public ze_user_humanized(id)
  17. {
  18.     g_iKilledTime[id] = 0;
  19. }
  20.  
  21. public ze_roundend(WinTeam)
  22. {
  23.     if (WinTeam == ZE_TEAM_HUMAN)
  24.     {
  25.         for(new id = 1; id <= MAX_PLAYERS; id++)
  26.         {
  27.             if (!ze_is_user_zombie(id) && !is_user_alive(id))
  28.             {
  29.                 if ((floatround(get_gametime() - g_iKilledTime[id])) <= KILLED_FROM)
  30.                 {
  31.                     ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
  32.                     ze_set_user_xp(id, ze_get_user_xp(id) - XP)
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
  38.  
  39. public Fw_PlayerKilled_Post(id)
  40. {
  41.     g_iKilledTime[id] = floatround(get_gametime())
  42. }

Try this

Re: xp,coins loss for humans (camper)

Posted: 14 Oct 2020, 06:45
by Raheem