Plug-ins compatibility with Zombie Escape 1.x only!
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by Night Fury » 5 years ago
| Description:
- This plugin gives some rewards controlled by cvars to the last human as a support to survive.
- Rewards available:
- Speed.
- Multijump.
- Fire nades.
- Frost nades.
| Cvars:
- Amount of extra speed (default: 100).
Code: Select all
g_pCvarExtraSpeed = register_cvar("ze_rewhm_extra_speed", "100")
- Amount of extra fire nades (default: 2).
Code: Select all
g_pCvarExtraFireNade = register_cvar("ze_rewhm_extra_firenade", "2")
- Amount of extra frost nades (default: 2).
Code: Select all
g_pCvarExtraFrostNade = register_cvar("ze_rewhm_extra_frostnade", "2")
| Defines:
- Give multijump as a reward? (default: yes) (to not to give, add // before the whole line).
- Add name of item fire nade that you wrote in ze_register_item in the file of fire nade (I'm using the default name of it).
- Add name of item frost nade that you wrote in ze_register_item in the file of frost nade (I'm using the default name of it).
| Changelog:
Spoiler!
[
Current version.]
| Code:
#define GIVE_MULTIJUMP
#include <zombie_escape>
#if defined GIVE_MULTIJUMP
#include <ze_multijump>
#endif
#define FIRE_NADE "Fire Nade"
#define FROST_NADE "Frost Nade"
#define TASK 1100
new g_pCvarExtraSpeed, g_pCvarExtraFireNade, g_pCvarExtraFrostNade, g_pCvarHumanSpeed
new g_iLastHumanIndex
public plugin_init()
{
register_plugin("[ZE] Addons: Rewards for last human", "1.0", "Jack GamePlay")
g_pCvarExtraSpeed = register_cvar("ze_rewhm_extra_speed", "100")
g_pCvarExtraFireNade = register_cvar("ze_rewhm_extra_firenade", "2")
g_pCvarExtraFrostNade = register_cvar("ze_rewhm_extra_frostnade", "2")
g_pCvarHumanSpeed = get_cvar_pointer("ze_human_speed_factor")
set_task(0.1, "Check_Humans", TASK, _, _, "b")
}
public Check_Humans(TaskID)
{
if (ze_is_game_started() && (ze_get_humans_number() == 1))
{
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (ze_is_user_zombie(id) || !is_user_alive(id))
continue
Give_Reward(id)
g_iLastHumanIndex = id
remove_task(TASK)
break
}
}
}
public Give_Reward(id)
{
ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) + get_pcvar_num(g_pCvarExtraSpeed))
#if defined GIVE_MULTIJUMP
ze_give_user_multijump(id)
#endif
if (get_pcvar_num(g_pCvarExtraFireNade) > 0)
{
new index1, iFire = get_pcvar_num(g_pCvarExtraFireNade)
for (new index1 = 1; index1 <= iFire; index1++)
{
ze_force_buy_item(id, ze_get_item_id(FIRE_NADE), true)
}
}
if (get_pcvar_num(g_pCvarExtraFrostNade) > 0)
{
new index2, iFrost = get_pcvar_num(g_pCvarExtraFrostNade)
for (index2 = 1; index2 <= iFrost; index2++)
{
ze_force_buy_item(id, ze_get_item_id(FROST_NADE), true)
}
}
ze_colored_print(id, "!gYou are the last human. You got rewards.")
}
public ze_user_humanized(g_iLastHumanIndex)
{
ze_reset_human_speed(g_iLastHumanIndex)
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#2
Post
by Raheem » 5 years ago
Fix speed:
#define GIVE_MULTIJUMP
#include <zombie_escape>
#if defined GIVE_MULTIJUMP
#include <ze_multijump>
#endif
#define FIRE_NADE "Fire Nade"
#define FROST_NADE "Frost Nade"
#define TASK 1100
new g_pCvarExtraSpeed, g_pCvarExtraFireNade, g_pCvarExtraFrostNade
new g_pCvarHumanSpeed
public plugin_init()
{
register_plugin("[ZE] Addons: Rewards for last human", "1.0", "Jack GamePlay")
g_pCvarExtraSpeed = register_cvar("ze_rewhm_extra_speed", "100")
g_pCvarExtraFireNade = register_cvar("ze_rewhm_extra_firenade", "2")
g_pCvarExtraFrostNade = register_cvar("ze_rewhm_extra_frostnade", "2")
g_pCvarHumanSpeed = get_cvar_pointer("ze_human_speed_factor")
set_task(0.1, "Check_Humans", TASK, _, _, "b")
}
public Check_Humans(TaskID)
{
if (ze_is_game_started() && (ze_get_humans_number() == 1))
{
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (ze_is_user_zombie(id) || !is_user_alive(id))
continue
Give_Reward(id)
remove_task(TASK)
break
}
}
}
public Give_Reward(id)
{
ze_set_human_speed_factor(id, get_pcvar_num(g_pCvarHumanSpeed) + get_pcvar_num(g_pCvarExtraSpeed))
#if defined GIVE_MULTIJUMP
ze_give_user_multijump(id)
#endif
if (get_pcvar_num(g_pCvarExtraFireNade) > 0)
{
new index1, iFire = get_pcvar_num(g_pCvarExtraFireNade)
for (new index1 = 1; index1 <= iFire; index1++)
{
ze_force_buy_item(id, ze_get_item_id(FIRE_NADE), true)
}
}
if (get_pcvar_num(g_pCvarExtraFrostNade) > 0)
{
new index2, iFrost = get_pcvar_num(g_pCvarExtraFrostNade)
for (index2 = 1; index2 <= iFrost; index2++)
{
ze_force_buy_item(id, ze_get_item_id(FROST_NADE), true)
}
}
ze_colored_print(id, "!gYou are the last human. You got rewards.")
}
He who fails to plan is planning to fail
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by Night Fury » 5 years ago
Raheem wrote: ↑5 years ago
Fix speed:
What? You changed the native's syntax?!
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#4
Post
by Raheem » 5 years ago
Setting speed factor, should add factor that default in our mod to your new factor
He who fails to plan is planning to fail
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#5
Post
by Raheem » 5 years ago
I forget, you also need to reset speed at user humanized:
public ze_user_humanized(id)
{
ze_reset_human_speed(id)
}
Or you can store the id of this player and at round end reset speed for him so you don't mess with other plugins if any other setting user speed.
He who fails to plan is planning to fail
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#6
Post
by Night Fury » 5 years ago
Code updated.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#7
Post
by Raheem » 5 years ago
Updated from Andriod? HOW xd
???
He who fails to plan is planning to fail
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#8
Post
by Night Fury » 5 years ago
Raheem wrote: ↑5 years ago
Updated from Andriod? HOW xd
???
Wrote it.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
Crimson
- Member
- Posts: 7
- Joined: 5 years ago
-
Contact:
-
Quote
-
0
login to like this post
#9
Post
by Crimson » 4 years ago
dude next time put the inc files please :p the plugin will not work without inc file...
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
Register
Sign in
Users browsing this forum: No registered users and 1 guest