- Код: Выделить всё
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
public plugin_init()
{
register_plugin("Give money victim", "1.0", "Stimul")
RegisterHam(Ham_Killed, "player", "fwdKilled")
}
public fwdKilled(victim, attacker)
{
if(!is_user_connected(victim) || !is_user_connected(attacker)) return HAM_IGNORED
if(attacker == victim || !attacker) return HAM_IGNORED
if(get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED
if(cs_get_user_money(victim)<1) return HAM_IGNORED
new name_victim[32],name_attacker[32]
new random_money = random_num(1,cs_get_user_money(victim))
get_user_name(victim, name_victim, 31)
get_user_name(attacker, name_attacker, 31)
cs_set_user_money(attacker, cs_get_user_money(attacker) + random_money)
cs_set_user_money(victim, cs_get_user_money(victim) - random_money)
ChatColor(0, "^4[^3CSDM^4] ^1игрок^4%s ^1убил ^4%s ^1и украл у него ^4%d$", name_attacker, name_victim, random_money)
return HAM_IGNORED
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
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();
}
}
}
}
Добавлено спустя 26 минут 54 секунды:
Пытался сам поменять урон с хам сандвича на событие, тоже что то не работает, либо я что то не так сделал)
- Код: Выделить всё
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#pragma tabsize 0
public plugin_init()
{
register_plugin("Give money victim", "1.0", "Stimul")
register_event( "DeathMsg", "fwdKilled", "a")
}
public fwdKilled()
{
new attacker, victim
attacker = read_data(1)
victim = read_data(2)
if(!is_user_connected(victim) || !is_user_connected(attacker)) return HAM_IGNORED
if(attacker == victim || !attacker) return HAM_IGNORED
if(get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED
if(cs_get_user_money(victim)<1) return HAM_IGNORED
new name_victim[32],name_attacker[32]
new random_money = random_num(1,cs_get_user_money(victim))
get_user_name(victim, name_victim, 31)
get_user_name(attacker, name_attacker, 31)
cs_set_user_money(attacker, cs_get_user_money(attacker) + random_money)
cs_set_user_money(victim, cs_get_user_money(victim) - random_money)
ChatColor(0, "^4[^3CSDM^4] ^1игрок^4%s ^1убил ^4%s ^1и украл у него ^4%d$", name_attacker, name_victim, random_money)
return HAM_IGNORED
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
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();
}
}
}
}