xp,coins loss for humans (camper)

Unpaid Requests, Public Plugins
czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

xp,coins loss for humans (camper)

#1

Post by czirimbolo » 2 Months Ago

Raheem, Jack,

can we finally make it happen?

I need plugin working like this:

When you are human and you didnt escape (you were killed by bombs) you lose X coins and X exp. We need to punish campers. To sum up:

When you escape as a human - you will receive exp and coins (it's done!)
When you were infected or killed - nothing happens
When you didn't escape as a human - you will lose X coins and X exp (TO DO!)
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1999
Joined: 3 Years Ago
Location: Egypt
Has thanked: 33 times
Been thanked: 111 times
Age: 22
Contact:

#2

Post by Raheem » 2 Months Ago

Try:
    1. #include <zombie_escape>
    2.  
    3. #define COINS 50
    4. #define XP 50
    5.  
    6. public plugin_init()
    7. {
    8.     register_plugin("Campers Punishment", "1.0", "Raheem")
    9. }
    10.  
    11. public ze_roundend(WinTeam)
    12. {
    13.     if (WinTeam == ZE_TEAM_HUMAN)
    14.     {
    15.         for(new id = 1; id <= MAX_PLAYERS; id++)
    16.         {
    17.             if (!ze_is_user_zombie(id) && !is_user_alive(id))
    18.             {
    19.                 ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
    20.                 ze_set_user_xp(id, ze_get_user_xp(id) - XP)
    21.             }
    22.         }  
    23.     }
    24. }
Loading Raheem's signature, Please wait...
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#3

Post by czirimbolo » 2 Months Ago

Raheem wrote:
2 Months Ago
Try:
    1. #include <zombie_escape>
    2.  
    3. #define COINS 50
    4. #define XP 50
    5.  
    6. public plugin_init()
    7. {
    8.     register_plugin("Campers Punishment", "1.0", "Raheem")
    9. }
    10.  
    11. public ze_roundend(WinTeam)
    12. {
    13.     if (WinTeam == ZE_TEAM_HUMAN)
    14.     {
    15.         for(new id = 1; id <= MAX_PLAYERS; id++)
    16.         {
    17.             if (!ze_is_user_zombie(id) && !is_user_alive(id))
    18.             {
    19.                 ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
    20.                 ze_set_user_xp(id, ze_get_user_xp(id) - XP)
    21.             }
    22.         }  
    23.     }
    24. }
You forgot about ze_levels.inc

Anyway, its working but player killed by lava, toxic water, laser etc is losing coins too. I dont want it, can you change it? Even slayed player loses his coins and exp. I want to punish only players (humans) who were killed by bombs or whatever at the end of map (trigger_hurt). Is it possible?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1999
Joined: 3 Years Ago
Location: Egypt
Has thanked: 33 times
Been thanked: 111 times
Age: 22
Contact:

#4

Post by Raheem » 2 Months Ago

This general approach may be easier and more accurate, try it:
    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[33] = floatround(get_gametime())
    42. }
Loading Raheem's signature, Please wait...
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#5

Post by czirimbolo » 2 Months Ago

#define KILLED_FROM 5 // Time that anyone killed during will be punished

its 5 minutes or 5 seconds? and what does it mean? Its working for 5 minutes, and after that you are not losing exp and coins?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1999
Joined: 3 Years Ago
Location: Egypt
Has thanked: 33 times
Been thanked: 111 times
Age: 22
Contact:

#6

Post by Raheem » 2 Months Ago

Example1: Human died at 0 sec, then after 3 seconds all humans who did not escaped killed from final trigger_hurt, then humans killed with trigger_hurt + the human killed at 0 sec both will be punished.

Example2: Human died at 0 sec, then after 6 seconds all humans who did not escaped killed from final trigger_hurt, then humans killed with trigger_hurt only who will be punished.

As #define KILLED_FROM 5 lower then accuracy is more, make #define KILLED_FROM 2 for best accuracy.

Try this approach and let me know if it's working or not.
Loading Raheem's signature, Please wait...
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#7

Post by czirimbolo » 3 Weeks Ago

Raheem wrote:
2 Months Ago
Example1: Human died at 0 sec, then after 3 seconds all humans who did not escaped killed from final trigger_hurt, then humans killed with trigger_hurt + the human killed at 0 sec both will be punished.

Example2: Human died at 0 sec, then after 6 seconds all humans who did not escaped killed from final trigger_hurt, then humans killed with trigger_hurt only who will be punished.

As #define KILLED_FROM 5 lower then accuracy is more, make #define KILLED_FROM 2 for best accuracy.

Try this approach and let me know if it's working or not.
Documents\Compiler v1.8.3\scripting\camper_punishment.sma(42) : error 032: array index out of bounds (variable "g_iKilledTime")
//
// 1 Error.
// Could not locate output file compiled\camper_punishment.amx (compile failed).
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1999
Joined: 3 Years Ago
Location: Egypt
Has thanked: 33 times
Been thanked: 111 times
Age: 22
Contact:

#8

Post by Raheem » 2 Weeks Ago

Post the full error and the code you are trying to compile.
Loading Raheem's signature, Please wait...
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#9

Post by czirimbolo » 2 Weeks Ago

Raheem wrote:
2 Weeks Ago
Post the full error and the code you are trying to compile.
//// camper_punishment.sma
//
// C:\Users\macie\Documents\Compiler v1.8.3\scripting\camper_punishment.sma(42) : error 032: array index out of bounds (variable "g_iKilledTime")
//
// 1 Error.
// Could not locate output file compiled\camper_punishment.amx (compile failed).
//
// Compilation Time: 0,94 sec
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 560
Joined: 3 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#10

Post by czirimbolo » 2 Weeks Ago

That is all. I tried your code from post nr 4
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests