Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- #include <hamsandwich>
- #define PLUGIN "[Death PSpawn]"
- #define VERSION "0.1.1"
- #define AUTHOR "Sn1k3rS+Seroff"
- #define g_CostRespawn get_pcvar_num(cvarcostrespawn)
- const KEYSMENU = MENU_KEY_1|MENU_KEY_2
- new cvarcostrespawn,cvar_dp_respawn;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR )
- RegisterHam(Ham_Killed, "player", "g_Spawn");
- register_logevent("round_end", 2, "1=Round_End");
- register_menu("respawnmenu", KEYSMENU, "menu_respawn");
- cvarcostrespawn = register_cvar("dp_cost_respawn", "8000"); //Cost the respawn
- cvar_dp_respawn = register_cvar("dp_enable", "1"); //on: 1/off: 2
- }
- public round_end(){
- new Players[32],Num;
- get_players(Players,Num);
- for(new id=1;id<=Num;id++){
- show_menu(id, 0, "^n^n^n^n^n^n^n^n^n", 1, "respawnmenu");
- }
- }
- public close_menu(id){
- show_menu(id, 0, "^n^n^n^n^n^n^n^n^n", 1, "respawnmenu");
- }
- public g_Spawn(id)
- {
- if(!(get_pcvar_num(cvar_dp_respawn)))
- {
- return PLUGIN_CONTINUE
- }
- if(cs_get_user_money(id) >= g_CostRespawn)
- {
- OpenRespawnMenu(id);
- }
- return PLUGIN_HANDLED
- }
- public OpenRespawnMenu(id)
- {
- new g_Money = cs_get_user_money(id)
- static menu[512], len;
- len = 0;
- len += formatex(menu[len], charsmax(menu) - len, "\yВозродиться за \r%d $\y?^n\wТвои деньги\d: \r%d $ ^n^n",g_CostRespawn,g_Money);
- len += formatex(menu[len], charsmax(menu) - len, "\w1. \yДа^n");
- len += formatex(menu[len], charsmax(menu) - len, "\w2. \rНет");
- show_menu(id, KEYSMENU, menu, -1, "respawnmenu");
- return PLUGIN_CONTINUE
- }
- public menu_respawn( id, key )
- {
- switch ( key )
- {
- case 0:
- {
- if(cs_get_user_money(id) < g_CostRespawn)
- {
- ColorChat(id, "^1[^4Spawn^1]^1 У Вас ^3не хватает денег^1!")
- return PLUGIN_HANDLED
- }
- new name[32]
- get_user_name(id, name, 31)
- ExecuteHamB(Ham_CS_RoundRespawn,id)
- cs_set_user_money(id, cs_get_user_money(id) - g_CostRespawn)
- ColorChat(0, "^1[^4Spawn^1]^1 Игрок ^3%s^1 купил возрождение!",name)
- }
- case 1:
- {
- ColorChat(id, "^1[^4Spawn^1]^1 Вы ^3отказались^1 от покупки возрождения!")
- return PLUGIN_HANDLED
- }
- }
- return PLUGIN_HANDLED
- }
- stock register_menu(const title[],keys,const function[],outside=0)
- {
- register_menucmd(register_menuid(title,outside),keys,function);
- }
- stock ColorChat(const id, const input[], any:...)
- {
- new count = 1, players[32];
- static msg[191];
- vformat(msg, 190, input, 3);
- replace_all(msg, 190, "!g", "^4"); // Зелёный
- replace_all(msg, 190, "!y", "^1"); // Стандартный
- replace_all(msg, 190, "!t", "^3"); // Цвет команды
- if (id) players[0] = id; else get_players(players, count, "ch")
- {
- for (new i = 0; i < count; i++)
- {
- if (is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment