Оригинален код:
Код за потвърждение: Избери целия код
/* © Copyright by Tonev
Name: Vengeance
Version: 1.0
Author: Tonev - Dark_Style
Support: http://amxmodxbg.org/
*/
#include <amxmodx>
#include <cstrike>
#include <engine>
#define Sound "misc/teleport.wav"
new p_iCost, p_iHealth, p_fMsgShowTime, p_Sound, p_szPrefix
new g_szPrefix[32]
new bool: bHasItem[33]
public plugin_init()
{
register_plugin("Vengeance", "1.0", "Tonev")
register_event("Health", "Event_Health", "be")
register_clcmd("say /vengeance", "Clcmd_Vengeance")
register_clcmd("say_team /vengeance", "Clcmd_Vengeance")
p_iCost = register_cvar("vengeance_cost", "3500")
p_iHealth = register_cvar("vengeance_health", "50")
p_fMsgShowTime = register_cvar("vengeance_msg_show_time", "120.0")
p_Sound = register_cvar("vengeance_sound", "1")
p_szPrefix = register_cvar("vengeance_prefix", "[Vengeance]")
new iEnt = create_entity("info_target")
entity_set_string(iEnt, EV_SZ_classname, "show_infomsg_entity")
register_think("show_infomsg_entity", "InfoMsg")
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_fMsgShowTime))
}
public plugin_precache()
{
precache_sound(Sound)
}
public client_connect(id)
{
bHasItem[id] = false
}
public client_disconnect(id)
{
bHasItem[id] = false
}
public InfoMsg(iEnt)
{
get_pcvar_string(p_szPrefix, g_szPrefix, charsmax(g_szPrefix))
client_print(0, print_chat, "%s Type /vengeance to buy item which teleports you in your base when you are at low health!", g_szPrefix)
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_fMsgShowTime))
}
public Clcmd_Vengeance(id)
{
new iMoney = cs_get_user_money(id) - get_pcvar_num(p_iCost)
get_pcvar_string(p_szPrefix, g_szPrefix, charsmax(g_szPrefix))
if(bHasItem[id])
{
client_print(id, print_chat, "%s You already have this item!", g_szPrefix)
}
else if(iMoney < 0)
{
client_print(id, print_chat, "%s You don't have enough money to buy this item!", g_szPrefix)
}
else if(!is_user_alive(id))
{
client_print(id, print_chat, "%s You must be alive to buy this item!", g_szPrefix)
}
else
{
cs_set_user_money(id, iMoney)
client_print(id, print_chat, "%s At low health you'll be teleported in your base", g_szPrefix)
bHasItem[id] = true
}
}
public Event_Health(id)
{
new iHealth = read_data(1)
if(iHealth <= get_pcvar_num(p_iHealth) && bHasItem[id])
{
Teleport(id)
}
}
public Teleport(id)
{
if(is_user_alive(id))
{
new iPoint
switch(cs_get_user_team(id))
{
case 1:iPoint = find_ent_by_class(-1, "info_player_deathmatch")
case 2:iPoint = find_ent_by_class(-1, "info_player_start")
}
if(iPoint)
{
new Float: iOrigin[3]
entity_get_vector(iPoint, EV_VEC_origin, iOrigin)
entity_set_origin(id, iOrigin)
if(get_pcvar_num(p_Sound) == 1)
client_cmd(id, "spk %s", Sound)
bHasItem[id] = false
}
}
}
Код за потвърждение: Избери целия код
/* © Copyright by Tonev
Name: Vengeance
Version: 1.0
Author: Tonev - Dark_Style
Support: http://amxmodxbg.org/
*/
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <customshop>
#define Sound "misc/teleport.wav"
#define PLUGIN_VERSION "4.x"
additem ITEM_VENGEANCE
new p_iHealth, p_fMsgShowTime, p_Sound, p_szPrefix
new g_szPrefix[32]
new bool: bHasItem[33]
public plugin_init()
{
register_plugin("CSHOP: Vengeance", PLUGIN_VERSION, "OciXCrom")
register_event("Health", "Event_Health", "be")
p_iHealth = register_cvar("vengeance_health", "50")
p_Sound = register_cvar("vengeance_sound", "1")
new iEnt = create_entity("info_target")
entity_set_string(iEnt, EV_SZ_classname, "show_infomsg_entity")
register_think("show_infomsg_entity", "InfoMsg")
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_fMsgShowTime))
}
public plugin_precache()
{
precache_sound(Sound)
ITEM_VENGEANCE = cshop_register_item("vengeance", "TeleportBase -Health", 3000, 0)
}
public cshop_item_selected(id, iItem)
{
if(iItem == ITEM_VENGEANCE)
bHasItem[id] = true
}
public cshop_item_removed(id, iItem)
{
if(iItem == ITEM_VENGEANCE)
bHasItem[id] = false
}
public Clcmd_Vengeance(id)
{
new iMoney = cshop_get_item_data(ITEM_VENGEANCE, CSHOP_DATA_PRICE);
get_pcvar_string(p_szPrefix, g_szPrefix, charsmax(g_szPrefix))
if(bHasItem[id])
{
client_print(id, print_chat, "%s You already have this item!", g_szPrefix)
}
else if(iMoney < 0)
{
client_print(id, print_chat, "%s You don't have enough money to buy this item!", g_szPrefix)
}
else if(!is_user_alive(id))
{
client_print(id, print_chat, "%s You must be alive to buy this item!", g_szPrefix)
}
else
{
cs_set_user_money(id, iMoney)
client_print(id, print_chat, "%s At low health you'll be teleported in your base", g_szPrefix)
bHasItem[id] = true
}
}
public client_connect(id)
{
bHasItem[id] = false
}
public client_disconnect(id)
{
bHasItem[id] = false
}
public Event_Health(id)
{
new iHealth = read_data(1)
if(iHealth <= get_pcvar_num(p_iHealth) && bHasItem[id])
{
Teleport(id)
}
}
public Teleport(id)
{
if(is_user_alive(id))
{
new iPoint
switch(cs_get_user_team(id))
{
case 1:iPoint = find_ent_by_class(-1, "info_player_deathmatch")
case 2:iPoint = find_ent_by_class(-1, "info_player_start")
}
if(iPoint)
{
new Float: iOrigin[3]
entity_get_vector(iPoint, EV_VEC_origin, iOrigin)
entity_set_origin(id, iOrigin)
if(get_pcvar_num(p_Sound) == 1)
client_cmd(id, "spk %s", Sound)
bHasItem[id] = false
}
}
}
Моля, преработете го.