#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#pragma semicolon 1
#define PLUGIN "Steam Bonus"
#define VERSION "1.3e"
#define AUTHOR "Gudaus"
#define PREFIX "Ваш бонус за использование Steam:"
#define get_bit(%1,%2) (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2) (%1 |= (1 << (%2 & 31)))
#define reset_bit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
new g_bIsSteam;
new round_number;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w");
register_event("HLTV", "RoundStart", "a", "1=0", "2=0");
RegisterHam(Ham_Spawn, "player", "fw_CS_RoundRespawn_Post", true);
}
public eRestart()
round_number = 0;
public RoundStart()
round_number++;
public client_putinserver(id)
{
if(is_user_steam(id))
{
set_bit(g_bIsSteam, id);
set_hudmessage(66, 170, 255, 0.65, 0.90, 0, 1.0, 1.0);
show_hudmessage(0, "У тебя Steam, поэтому с 3 раунда ты будешь получать бонусы");
}
else
reset_bit(g_bIsSteam, id);
}
public get_player_deagle(id)
{
const dropped_weapons = ( 1 << CSW_USP ) | ( 1 << CSW_GLOCK18 );
static iWeapons[ 32 ], iNum, i;
iNum = 0;
get_user_weapons( id, iWeapons, iNum );
for( i = 0; i < iNum; i++ )
{
if( ( 1 << iWeapons[ i ] ) & dropped_weapons )
{
switch( iWeapons[ i ])
{
case CSW_USP:
{
engclient_cmd(id, "drop", "weapon_usp");
give_item(id, "weapon_deagle");
cs_set_user_bpammo(id, CSW_DEAGLE, 14);
ChatColor(id, "^3%s ^4deagle", PREFIX);
}
case CSW_GLOCK18:
{
engclient_cmd(id, "drop", "weapon_glock18");
give_item(id, "weapon_deagle");
cs_set_user_bpammo(id, CSW_DEAGLE, 14);
ChatColor(id, "^3%s ^4deagle", PREFIX);
}
case CSW_DEAGLE:
{
cs_set_user_money(id, cs_get_user_money(id) + 300);
ChatColor(id, "^3%s ^4 300$", PREFIX);
}
}
}
}
}
public fw_CS_RoundRespawn_Post(id)
{
if(round_number>=3)
{
set_hudmessage(66, 170, 255, 0.65, 0.90, 0, 1.0, 1.0);
show_hudmessage(0, "У тебя Steam,теперь вы можете получать бонусы");
if( is_user_alive(id) && get_bit(g_bIsSteam, id) && !(get_user_flags(id) & ADMIN_LEVEL_H))
{
new deaths = get_user_deaths(id);
new frags = get_user_frags(id);
if(deaths!=0)
{
new soot = frags/deaths;
if (soot<1)
{
switch(random(5))
{
case 0:
{
cs_set_user_money(id, cs_get_user_money(id) + 600);
ChatColor(id, "^3%s ^4 600$", PREFIX);
}
case 1:
{
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
ChatColor(id, "^3%s ^4Все гранаты", PREFIX);
}
case 2:
{
cs_set_user_armor(id, 100, CsArmorType:2);
ChatColor(id, "^3%s ^4Броня и Шлем", PREFIX);
}
case 3:
{
get_player_deagle(id);
}
case 4:
{
cs_set_user_money(id, cs_get_user_money(id) + 300 + frags*100);
ChatColor(id, "^3%s ^4 %d$", PREFIX, 300 + frags*100);
}
}
}
else if (soot == 1)
{
switch(random(5))
{
case 0:
{
cs_set_user_money(id, cs_get_user_money(id) + 900);
ChatColor(id, "^3%s ^4 900$", PREFIX);
}
case 1:
{
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
ChatColor(id, "^3%s ^4HE + 2FLASH", PREFIX);
}
case 2:
{
cs_set_user_armor(id, 100, CsArmorType:2);
ChatColor(id, "^3%s ^4Броня и Шлем", PREFIX);
}
case 3:
{
get_player_deagle(id);
}
case 4:
{
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
ChatColor(id, "^3%s ^4SMOKE + 2 FLASH", PREFIX);
}
}
}
else if (soot == 2)
{
switch(random(6))
{
case 0:
{
cs_set_user_money(id, cs_get_user_money(id) + 1000);
ChatColor(id, "^3%s ^4 1000$", PREFIX);
}
case 1:
{
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
ChatColor(id, "^3%s ^4HE + FLASH", PREFIX);
}
case 2:
{
cs_set_user_armor(id, 100, CsArmorType:2);
ChatColor(id, "^3%s ^4Броня и Шлем", PREFIX);
}
case 3:
{
get_player_deagle(id);
}
case 4:
{
cs_set_user_money(id, cs_get_user_money(id) + (frags-deaths)*100);
ChatColor(id, "^3%s ^4 %d$", PREFIX, (frags-deaths)*100);
}
default: return;
}
}
else if (soot == 3)
{
switch(random(7))
{
case 0:
{
cs_set_user_money(id, cs_get_user_money(id) + 1000);
ChatColor(id, "^3%s ^4 1000$", PREFIX);
}
case 1:
{
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
cs_set_user_money(id, cs_get_user_money(id) + 500);
ChatColor(id, "^3%s ^4FLASH + 500$", PREFIX);
}
case 2:
{
cs_set_user_armor(id, 100, CsArmorType:2);
ChatColor(id, "^3%s ^4Броня и Шлем", PREFIX);
}
case 3:
{
get_player_deagle(id);
}
case 4:
{
cs_set_user_money(id, cs_get_user_money(id) + (frags-deaths)*70);
ChatColor(id, "^3%s ^4 %d$", PREFIX, (frags-deaths)*70);
}
default: return;
}
}
else
{
switch(random(8))
{
case 0:
{
cs_set_user_money(id, cs_get_user_money(id) + 1000);
ChatColor(id, "^3%s ^4 1000$", PREFIX);
}
case 1:
{
give_item(id, "weapon_hegrenade");
ChatColor(id, "^3%s ^4HE", PREFIX);
}
case 2:
{
cs_set_user_armor(id, 100, CsArmorType:2);
ChatColor(id, "^3%s ^4Броня и Шлем", PREFIX);
}
case 3:
{
get_player_deagle(id);
}
case 4:
{
give_item(id, "weapon_flashbang");
give_item(id, "weapon_flashbang");
ChatColor(id, "^3%s ^4 2FLASH", PREFIX);
}
default: return;
}
}
}
else if (frags!=0)
{
cs_set_user_money(id, cs_get_user_money(id) + frags*200);
ChatColor(id, "^3%s ^4 %d$", PREFIX, frags*200);
}
}
}
}
stock bool:is_user_steam(id)
{
static dp_pointer;
if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
{
server_cmd("dp_clientinfo %d", id);
server_exec();
return (get_pcvar_num(dp_pointer) == 2) ? true : false;
}
new szAuthid[34];
get_user_authid(id, szAuthid, charsmax(szAuthid));
return (containi(szAuthid, "LAN") < 0);
}
stock ChatColor(const id, const szMessage[], any:...)
{
static pnum, players[32], szMsg[190], IdMsg;
vformat(szMsg, charsmax(szMsg), szMessage, 3);
if(!IdMsg) IdMsg = get_user_msgid("SayText");
if(id)
{
if(!is_user_connected(id)) return 0;
players[0] = id;
pnum = 1;
}
else get_players(players, pnum, "ch");
for(new i; i < pnum; i++)
{
message_begin(MSG_ONE, IdMsg, .player = players[i]);
write_byte(players[i]);
write_string(szMsg);
message_end();
}
return 1;
}