#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <csx>
/*
1. Dupa 10 ucideri - +10 hp (110 hp la spawn)
2. Dupa 20 ucideri - +20 hp & 1 grenada flash (120 hp & grenada flash la spawn)
3. Dupa 30 ucideri - +30 hp & speed (130 hp & speed la spawn)
etc...
Aceste benefici sa fie valabile pâna la schimbarea harti !
Doresc sa scrie undeva pe ecran nick-ul jucatorului , numarul de kill-uri si la ce grad este ; exemplu :
JucatorEXTREAM [45 UCIDERI] [ GRAD 4 ]
*/
new _nivel[33], _fraguri[33], _nume[33][32], SyncHudMessage;
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
#define PLUGIN_NAME "[AMXX] Bonus shits"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "YONTU"
// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------
#define TAG "[AMXX]"
#define _HP1 10
#define _HP2 20
#define _HP3 30
#define _KILLS1 10
#define _KILLS2 20
#define _KILLS3 30
#define _SPEED3 250.0
// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPre", 1);
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);
register_event("TextMsg", "event_textmsg", "a", "2=#Game_will_restart_in");
SyncHudMessage = CreateHudSyncObj();
}
public client_putinserver(id)
{
get_user_name(id, _nume[id], charsmax(_nume[]));
set_task(1.0, "task_aratahud", id + 12221);
//_nivel[id] = -1;
//_fraguri[id] = 0;
}
public event_textmsg()
{
arrayset(_nivel, -1, charsmax(_nivel));
arrayset(_fraguri, 0, charsmax(_fraguri));
}
public fw_PlayerSpawnPre(id)
{
if(!is_user_alive(id))
return HAM_HANDLED;
new _viata;
switch(_nivel[id])
{
case 1: _viata = _HP1;
case 2:
{
_viata = _HP2;
give_item(id, "weapon_flashbang");
}
case 3: _viata = _HP3;
default: _viata = 0;
}
if(_viata != 0)
set_user_health(id, get_user_health(id) + _viata);
return HAM_IGNORED;
}
public fw_ResetMaxSpeedPost(id)
{
if(is_user_alive(id) && _nivel[id] == 3)
{
new Float:fViteza = _SPEED3;
engfunc(EngFunc_SetClientMaxspeed, id, fViteza);
set_pev(id, pev_maxspeed, fViteza);
}
return HAM_IGNORED;
}
public task_aratahud(taskid)
{
new player = taskid - 12221;
if(is_user_connected(player))
{
set_hudmessage(200, 200, 200, 0.02, 0.32, 0, 6.0, 1.1, 0.0, 0.0, -1);
ShowSyncHudMsg(player, SyncHudMessage, "Jucator: %s^nUcideri: %d^nGrad [%d]", _nume[player], _fraguri[player], _nivel[player]);
set_task(1.0, "task_aratahud", player + 12221);
}
}
public adauga_efecte(id)
{
if(!is_user_connected(id))
return;
static g_msg_screenshake = 0;
if(!g_msg_screenshake)
g_msg_screenshake = get_user_msgid("ScreenShake");
message_begin(MSG_ONE, g_msg_screenshake, _, id);
write_short(1<<14);
write_short(1<<14);
write_short(1<<14);
message_end();
static g_msg_screenfade = 0;
if(!g_msg_screenfade)
g_msg_screenfade = get_user_msgid("ScreenFade");
message_begin(MSG_ONE_UNRELIABLE, g_msg_screenfade, _, id);
write_short(1<<10);
write_short(1<<10);
write_short(1<<12);
write_byte(random_num(0, 255));
write_byte(random_num(0, 255));
write_byte(random_num(0, 255));
write_byte(100);
message_end();
}
public client_death(killer, victim, wpnindex, hitplace, tk)
{
if(!is_user_alive(killer))
return;
if(killer == victim)
return;
_fraguri[killer]++;
switch(_fraguri[killer])
{
case _KILLS1: _nivel[killer] = 1;
case _KILLS2: _nivel[killer] = 2;
case _KILLS3: _nivel[killer] = 3;
}
if(_fraguri[killer] == _KILLS1 || _fraguri[killer] == _KILLS2 || _fraguri[killer] == _KILLS3)
{
adauga_efecte(killer);
ColorChat(killer, "!4%s!1 Felicitari! La urmatorul spawn vei primi un bonus in iteme.", TAG);
}
}
stock ColorChat(id, String[], any:...)
{
static szMesage[192];
vformat(szMesage, charsmax(szMesage), String, 3);
replace_all(szMesage, charsmax(szMesage), "!1", "^1");
replace_all(szMesage, charsmax(szMesage), "!3", "^3");
replace_all(szMesage, charsmax(szMesage), "!4", "^4");
static g_msg_SayText = 0;
if(!g_msg_SayText)
g_msg_SayText = get_user_msgid("SayText");
new Players[32], iNum = 1, i;
if(id) Players[0] = id;
else get_players(Players, iNum, "ch");
for(--iNum; iNum >= 0; iNum--)
{
i = Players[iNum];
message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
write_byte(i);
write_string(szMesage);
message_end();
}
}