xp,coins loss for humans (camper)
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
xp,coins loss for humans (camper)
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!)
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!)
Try:
- #include <zombie_escape>
- #define COINS 50
- #define XP 50
- public plugin_init()
- {
- register_plugin("Campers Punishment", "1.0", "Raheem")
- }
- public ze_roundend(WinTeam)
- {
- if (WinTeam == ZE_TEAM_HUMAN)
- {
- for(new id = 1; id <= MAX_PLAYERS; id++)
- {
- if (!ze_is_user_zombie(id) && !is_user_alive(id))
- {
- ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
- ze_set_user_xp(id, ze_get_user_xp(id) - XP)
- }
- }
- }
- }
He who fails to plan is planning to fail
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
You forgot about ze_levels.incRaheem wrote: ↑4 years ago Try:
#include <zombie_escape> #define COINS 50 #define XP 50 public plugin_init() { register_plugin("Campers Punishment", "1.0", "Raheem") } public ze_roundend(WinTeam) { if (WinTeam == ZE_TEAM_HUMAN) { for(new id = 1; id <= MAX_PLAYERS; id++) { if (!ze_is_user_zombie(id) && !is_user_alive(id)) { ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS) ze_set_user_xp(id, ze_get_user_xp(id) - XP) } } } }
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?
This general approach may be easier and more accurate, try it:
- #include <zombie_escape>
- #include <ze_levels>
- #define COINS 50
- #define XP 50
- #define KILLED_FROM 5 // Time that anyone killed during will be punished
- new g_iKilledTime[33]
- public plugin_init()
- {
- register_plugin("Campers Punishment", "1.0", "Raheem")
- RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
- }
- public ze_user_humanized(id)
- {
- g_iKilledTime[id] = 0;
- }
- public ze_roundend(WinTeam)
- {
- if (WinTeam == ZE_TEAM_HUMAN)
- {
- for(new id = 1; id <= MAX_PLAYERS; id++)
- {
- if (!ze_is_user_zombie(id) && !is_user_alive(id))
- {
- if ((floatround(get_gametime() - g_iKilledTime[id])) <= KILLED_FROM)
- {
- ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
- ze_set_user_xp(id, ze_get_user_xp(id) - XP)
- }
- }
- }
- }
- }
- public Fw_PlayerKilled_Post(id)
- {
- g_iKilledTime[id] = floatround(get_gametime())
- }
He who fails to plan is planning to fail
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
#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?
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?
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
Try this approach and let me know if it's working or not.
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.
He who fails to plan is planning to fail
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
Documents\Compiler v1.8.3\scripting\camper_punishment.sma(42) : error 032: array index out of bounds (variable "g_iKilledTime")Raheem wrote: ↑4 years 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.
//
// 1 Error.
// Could not locate output file compiled\camper_punishment.amx (compile failed).
Post the full error and the code you are trying to compile.
He who fails to plan is planning to fail
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
//// 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
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
- #include <zombie_escape>
- #define COINS 50
- #define XP 50
- #define KILLED_FROM 5 // Time that anyone killed during will be punished
- new g_iKilledTime[33]
- public plugin_init()
- {
- register_plugin("Campers Punishment", "1.0", "Raheem")
- RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
- }
- public ze_user_humanized(id)
- {
- g_iKilledTime[id] = 0;
- }
- public ze_roundend(WinTeam)
- {
- if (WinTeam == ZE_TEAM_HUMAN)
- {
- for(new id = 1; id <= MAX_PLAYERS; id++)
- {
- if (!ze_is_user_zombie(id) && !is_user_alive(id))
- {
- if ((floatround(get_gametime() - g_iKilledTime[id])) <= KILLED_FROM)
- {
- ze_set_escape_coins(id, ze_get_escape_coins(id) - COINS)
- ze_set_user_xp(id, ze_get_user_xp(id) - XP)
- }
- }
- }
- }
- }
- public Fw_PlayerKilled_Post(id)
- {
- g_iKilledTime[id] = floatround(get_gametime())
- }
Try this
Updated the code: viewtopic.php?p=10943#p10943
He who fails to plan is planning to fail
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 5 guests