#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define bmTag "!n[ !tWEBDiyo !n]"
new bmKullanim[33],bmKalanSure[33];
new bmSure,bmJail,bmElBasi,bmHizC,Float:bmKorumaSure;
public plugin_init() {
register_plugin
("Gelismis Redbull",
"1.4",
"Berk");
register_clcmd("say /redbull","beRedbull");
register_clcmd("bmRedbull","beRedbull");
bmSure = register_cvar("bm_sure","15");
bmJail = register_cvar("bm_sonadam","1");
bmElBasi = register_cvar("bm_elbasi","1");
bmHizC = register_cvar("bm_hiz","800");
register_event("HLTV", "beRS", "a", "1=0", "2=0");
RegisterHam(Ham_Spawn, "player", "bePS", 1);
RegisterHam(Ham_Killed, "player", "beAO") ;
}
public beRS(){
if(get_pcvar_num(bmElBasi) == 1){
bmKorumaSure = get_gametime()+3.0;
}
}
public bePS(bmID){
bmKullanim[bmID] = 0;
bmKalanSure[bmID] = 0;
remove_task(bmID);
}
public beAO(){
if(get_pcvar_num(bmJail) == 1){
new bmOyuncular[32],bmSayi
get_players(bmOyuncular, bmSayi ,"ae", "TERRORIST");
if(bmSayi == 1){
new bmID;
get_players(bmOyuncular, bmSayi ,"a");
for(new i; i < bmSayi; i++){
bmID = bmOyuncular[i];
bmKullanim[bmID] = 0;
bmKalanSure[bmID] = 0;
set_pev(bmID,pev_maxspeed,320.0);
set_pev(bmID,pev_gravity,1.0);
remove_task(bmID);
}
}
}
}
public beRedbull(bmID){
if(get_user_team(bmID) == 1){
renkli_yazi(bmID,"%s !gSadece Insanlar Redbull Icebilir.",bmTag);
return PLUGIN_HANDLED;
}
if(get_pcvar_num(bmElBasi) == 1){
if(get_gametime() < bmKorumaSure){
renkli_yazi(bmID,"%s !gBeklerken redbull, !tbiraz beklemelisin!n.",bmTag);
return PLUGIN_HANDLED;
}
}
if(get_pcvar_num(bmJail) == 1){
new bmOyuncular[32],bmSayi
get_players(bmOyuncular, bmSayi ,"ae", "TERRORIST");
if(bmSayi == 1){
renkli_yazi(bmID,"%s !gTekken redbull!n, !tmahkum takimda tek bir kisi var!n.",bmTag);
return PLUGIN_HANDLED;
}
}
if(!is_user_alive(bmID)){
renkli_yazi(bmID,"%s !gOluyken redbull!, !tBence cilginsin!n.",bmTag);
}
else if(bmKullanim[bmID] == 1){
renkli_yazi(bmID,"%s !gZaten redbull!n, !tkullaniyorsunuz!n.",bmTag);
}
else{
bmKullanim[bmID] = 1;
renkli_yazi(bmID,"%s !gRedbull icildi!n, !tkanatlaniyorsunuz!n.",bmTag);
bmKalanSure[bmID] = get_pcvar_num(bmSure);
beRedbullIc(bmID);
}
return PLUGIN_CONTINUE;
}
public beRedbullIc(bmID){
if(bmKalanSure[bmID] > 0){
bmKalanSure[bmID]--;
set_pev(bmID,pev_health,pev(bmID,pev_health)+1.0);
set_pev(bmID,pev_maxspeed,get_pcvar_float(bmHizC));
set_pev(bmID,pev_gravity,0.5);
set_task(1.0,"beRedbullIc",bmID);
}
else{
bmKullanim[bmID] = 0;
renkli_yazi(bmID,"%s !gRedbull bitti!n, !tkanatlar gidiyor!n.",bmTag);
set_pev(bmID,pev_maxspeed,320.0);
set_pev(bmID,pev_gravity,1.0);
}
}
#if AMXX_VERSION_NUM < 183
stock renkli_yazi(const id, const input[], any:...){
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!n", "^x01"); // Default Renk(Sarı)
replace_all(msg, 190, "!g", "^x04"); // Yeşil Renk
replace_all(msg, 190, "!t", "^x03"); // Takım Renk( CT mavi , T kırmızı )
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();
}
}
}
}
#else
stock renkli_yazi(const id, const input[], any:...){
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!n", "^x01");
replace_all(msg, 190, "!g", "^x04");
replace_all(msg, 190, "!t", "^x03");
client_print_color(id, id, msg);
}
#endif