C++:
[/B]
#include <amxmodx>
#include <cstrike>
#include <amxmisc>
#include <engine>
#pragma semicolon 1
#define bit_add(%0,%1) (%1 |= (1<<%0))
#define bit_sub(%0,%1) (%1 &= ~(1<<%0))
#define bit_valid(%0,%1) (%1 & (1<<%0))
// Thanks to Safety1st: http://c-s.net.ua/forum/index.php?showt ... t&p=607675
#if AMXX_VERSION_NUM < 183
#define MSG_TEXT_MSG 76
#endif
new g_iValidPlayersBitsum;
public plugin_init()
{
register_event("DeathMsg", "EventDeathMsg", "a", "4=knife");
}
public client_putinserver(id)
{
bit_add(id, g_iValidPlayersBitsum);
}
public client_disconnect(id)
{
bit_sub(id, g_iValidPlayersBitsum);
}
public EventDeathMsg()
{
new pKiller = read_data(1), pVictim = read_data(2);
if(bit_valid(pKiller, g_iValidPlayersBitsum) && bit_valid(pVictim, g_iValidPlayersBitsum))
{
new szKillerName[32], szVictimName[32], iVictimMoneyNum, iVictimMoney = random_num(0, iVictimMoneyNum = cs_get_user_money(pVictim));
cs_set_user_money(pKiller, cs_get_user_money(pKiller) + iVictimMoney);
cs_set_user_money(pVictim, iVictimMoneyNum - iVictimMoney);
get_user_name(pKiller, szKillerName, charsmax(szKillerName));
get_user_name(pVictim, szVictimName, charsmax(szVictimName));
#if AMXX_VERSION_NUM < 183
PrintMsg(0, "^1Игрок ^3%s ^1зарезал игрока ^3%s ^1и получил ^4$%d", szKillerName, szVictimName, iVictimMoney);
#else
client_print_color(0, print_team_blue, "^1Игрок ^3%s ^1зарезал игрока ^3%s ^1и получил ^4$%d", szKillerName, szVictimName, iVictimMoney);
#endif
}
}
stock PrintMsg(const id, const szMessage[], any:...)
{
new szMsg[191], iPlayers[32], iPlayersNum = 1;
vformat(szMsg, charsmax(szMsg), szMessage, 3);
switch(id)
{
case 0: get_players(iPlayers, iPlayersNum, "ch");
default: iPlayers[0] = id;
}
for(new i; i < iPlayersNum; i++)
{
message_begin(MSG_ONE_UNRELIABLE, MSG_TEXT_MSG, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}
[B]