Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <zombie_plague_advance>
- #define PLUGIN "ZP Extra RespawnMenu"
- #define VERSION "1.0.0"
- new g_respawn_cost = 5
- new g_roundend
- new const respawn_sound[] = { "warcraft3/soundpack/reincarnation.wav" }
- new const respawn_sprite[] = { "sprite/respawn2.spr" }
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, "yokomo")
- register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0")
- register_clcmd("say /zs", "ShowRespawnMenu")
- register_clcmd("say /respawn", "ShowRespawnMenu")
- }
- public plugin_precache()
- {
- precache_sound(respawn_sound)
- precache_model(respawn_sound)
- }
- public EventRoundStart(id)
- {
- g_roundend = false
- client_print(id, print_chat, "[ZP] This server using respawn, say /zs or /zspawn to precache item, only dead people.")
- }
- public zp_round_ended()
- {
- g_roundend = true
- }
- public ShowRespawnMenu(id)
- {
- if (g_roundend)
- {
- // To prevent people from spamming respawn at roundend
- client_print(id, print_chat, "[ZP] No respawn at this time.")
- return PLUGIN_HANDLED
- }
- if (is_user_alive(id))
- {
- client_print(id, print_chat, "[ZP] Item not available at this time.")
- return PLUGIN_HANDLED
- }
- new menu_title[64], item_1[64], item_2[64], item_3[64], item_4[64]
- format(menu_title, charsmax(menu_title), "\r[ZP] Respawn As: (cost 5 ammo packs)")
- format(item_1, charsmax(item_1), "\wRespawn a Human", g_respawn_cost)
- format(item_2, charsmax(item_2), "\wRespawn a Zombie", g_respawn_cost)
- format(item_3, charsmax(item_3), "\wRespawn Random", g_respawn_cost)
- format(item_4, charsmax(item_4), "\wD'ont Respawn")
- new mHandleID = menu_create(menu_title, "RespawnMenuHandler")
- menu_additem(mHandleID, item_1, "1", 0)
- menu_additem(mHandleID, item_2, "2", 0)
- menu_additem(mHandleID, item_3, "3", 0)
- menu_additem(mHandleID, item_4, "4", 0)
- menu_display(id, mHandleID, 0)
- return PLUGIN_HANDLED
- }
- public RespawnMenuHandler(id, menu, item)
- {
- if (g_roundend)
- {
- // To prevent people from spamming respawn at roundend
- client_print(id, print_chat, "[ZP] No respawn at this time.")
- return PLUGIN_HANDLED
- }
- if (is_user_alive(id))
- {
- client_print(id, print_chat, "[ZP] Item not available at this time. Only dead people can precache this item")
- return PLUGIN_HANDLED
- }
- if (item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new current_ap = zp_get_user_ammo_packs(id)
- if (current_ap < g_respawn_cost)
- {
- client_print(id, print_chat, "[ZP] Not enough Ammo Packs.")
- return PLUGIN_HANDLED
- }
- switch (item)
- {
- case 0:
- {
- // Respawn as Human
- if (zp_is_survivor_round() && zp_is_sniper_round()) return PLUGIN_HANDLED
- zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
- zp_respawn_user(id, ZP_TEAM_HUMAN)
- emit_sound(id, CHAN_VOICE, respawn_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- new origin[3]
- get_user_origin(id,origin)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(TE_SPRITE)
- write_coord(origin[0])
- write_coord(origin[1])
- write_coord(origin[2]+=30)
- write_short(respawn_sprite)
- write_byte(8)
- write_byte(255)
- message_end()
- }
- case 1:
- {
- if (zp_is_nemesis_round() && zp_is_assassin_round() && zp_is_boss_round()) return PLUGIN_HANDLED
- zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
- zp_respawn_user(id, ZP_TEAM_HUMAN)
- }
- case 2:
- {
- // Respawn as Random Class between Human & Zombie
- if (!zp_is_survivor_round() && !zp_is_nemesis_round() && zp_is_sniper_round() && zp_is_assassin_round() && zp_is_boss_round())
- {
- switch(random_num(0,1))
- {
- case 0:
- {
- zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
- zp_respawn_user(id, ZP_TEAM_HUMAN)
- emit_sound(id, CHAN_VOICE, respawn_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- new origin[3]
- get_user_origin(id,origin)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(TE_SPRITE)
- write_coord(origin[0])
- write_coord(origin[1])
- write_coord(origin[2]+=30)
- write_short(respawn_sprite)
- write_byte(8)
- write_byte(255)
- message_end()
- }
- case 1:
- {
- zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
- zp_respawn_user(id, ZP_TEAM_ZOMBIE)
- }
- }
- }
- }
- case 3:
- {
- return PLUGIN_HANDLED
- }
- }
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement