/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <colorchat>
#include <nvault>
#define PLUGIN "Bolt"
#define VERSION "1.0"
#define AUTHOR "Charlie224"
new g_vault
new g_pontok[33];
new bool:g_csavar[33];
new bool:g_baseball[33];
new bool:g_gumibot[33];
new shop1;
new shop2;
new shop3;
new shop4;
new syncObjp;
new bool:g_hp;
new VIEW_MODELCSAVAR[] = "models/v_csavarhuzo.mdl";
new PLAYER_MODELCSAVAR[] = "models/p_csavarhuzo.mdl";
new VIEW_MODELBASEBALL[] = "models/v_baseballuto.mdl";
new PLAYER_MODELBASEBALL[] = "models/p_baseballuto.mdl";
new VIEW_MODELGUMIBOT[] = "models/v_gumibot.mdl";
new PLAYER_MODELGUMIBOT[] = "models/p_gumibot.mdl";
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("DeathMsg", "Death", "a");
register_event("CurWeapon", "Change_Weapon", "be", "1=1");
register_logevent("Event_Roundend", 2, "1=Round_End")
register_logevent("Start", 2, "1=Round_Start")
register_clcmd("say /bolt", "boltmenu");
RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage", 0);
shop1 = register_cvar("shop_1", "15");
shop2 = register_cvar("shop_2", "10");
shop3 = register_cvar("shop_3", "20");
shop4 = register_cvar("shop_4", "5");
syncObjp = CreateHudSyncObj();
g_vault = nvault_open("pontmentes")
}
public plugin_precache()
{
precache_model(VIEW_MODELCSAVAR);
precache_model(PLAYER_MODELCSAVAR);
precache_model(VIEW_MODELBASEBALL);
precache_model(PLAYER_MODELBASEBALL);
precache_model(VIEW_MODELGUMIBOT);
precache_model(PLAYER_MODELGUMIBOT);
}
public Start(id)
{
g_hp = true;
}
public Event_Roundend()
{
new players[32], pnum, tempid;
get_players(players, pnum, "c");
for(new i; i<pnum; i++)
{
tempid = players[i];
g_csavar[tempid] = false;
g_baseball[tempid] = false;
g_gumibot[tempid] = false;
}
}
public Death()
{
new id = read_data(2);
new attacker = read_data(1);
if(!is_user_alive(attacker))
return PLUGIN_CONTINUE;
if(get_user_team(id) != get_user_team(attacker))
{
g_pontok[attacker]+=5;
}
return PLUGIN_CONTINUE;
}
public boltmenu(id)
{
if(get_user_team(id) == 1)
{
if(is_user_alive(id))
{
static opcion[64];
formatex(opcion, charsmax(opcion),"\y[JailBreak Bolt] [Beta] v0.1");
new iMenu = menu_create(opcion, "boltmenuh");
formatex(opcion, charsmax(opcion),"\w+50 HP(1 korben 1x) \r%d pont", get_pcvar_num(shop4));
formatex(opcion, charsmax(opcion),"\wBaseballuto(75 Sebzes) \r%d pont", get_pcvar_num(shop2));
formatex(opcion, charsmax(opcion),"\wCsavarhuzo(100 Sebzes) \r%d pont", get_pcvar_num(shop1));
menu_additem(iMenu, opcion, "3");
menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, iMenu, 0);
}
else
{
ColorChat(id, GREEN, "[JailBreak Bolt] [Beta] Csak elok hasznalhatjak a boltot");
}
}
else if(get_user_team(id) == 2)
{
if(is_user_alive(id))
{
static opcion[64];
formatex(opcion, charsmax(opcion),"\y[JailBreak Bolt] [Beta] v0.1");
new iMenu2 = menu_create(opcion, "boltmenuh2");
formatex(opcion, charsmax(opcion),"\w+50 HP(1 korben 1x) \r%d pont", get_pcvar_num(shop4));
formatex(opcion, charsmax(opcion),"\wGumibot(100 Sebzes) \r%d pont", get_pcvar_num(shop3));
menu_additem(iMenu2, opcion, "2");
menu_setprop(iMenu2, MPROP_EXIT, MEXIT_ALL);
menu_display(id, iMenu2, 0);
}
else
{
ColorChat(id, GREEN, "[JailBreak Bolt] [Beta] Csak elok hasznalhatjak a boltot");
}
}
return PLUGIN_HANDLED;
}
public boltmenuh(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new Data[6], Name[64];
new Access, Callback;
menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback);
new elo = is_user_alive(id);
new item_ar1 = get_pcvar_num(shop1);
new item_ar2 = get_pcvar_num(shop2);
new item_ar4 = get_pcvar_num(shop4);
new health = get_user_health(id)
new Key = str_to_num(Data);
switch (Key)
{
case 1:
{
if (g_pontok[id]>= item_ar4 && elo)
{
if(g_hp)
{
g_pontok[id] -= item_ar4;
set_user_health(id, health+50)
g_hp = false;
}
else
{
ColorChat(id, GREEN, "[JailBreak Bolt] [Beta] Mar vettel 1x HP -t!");
}
}
}
case 2:
{
if (g_pontok[id]>= item_ar2 && elo)
{
g_pontok[id] -= item_ar2;
g_baseball[id] = true;
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELBASEBALL);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELBASEBALL);
}
}
case 3:
{
if (g_pontok[id]>= item_ar1 && elo)
{
g_pontok[id] -= item_ar1;
g_csavar[id] = true;
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELCSAVAR);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELCSAVAR);
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public boltmenuh2(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new Data[6], Name[64];
new Access, Callback;
menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback);
new elo = is_user_alive(id);
new item_ar3 = get_pcvar_num(shop3);
new item_ar4 = get_pcvar_num(shop4);
new health = get_user_health(id)
new Key = str_to_num(Data);
switch (Key)
{
case 1:
{
if (g_pontok[id]>= item_ar4 && elo)
{
if(g_hp)
{
g_pontok[id] -= item_ar4;
set_user_health(id, health+50)
g_hp = false;
}
else
{
ColorChat(id, GREEN, "[JailBreak Bolt] [Beta] Mar vettel 1x HP -t!");
}
}
}
case 2:
{
if (g_pontok[id]>= item_ar3 && elo)
{
g_pontok[id] -= item_ar3;
g_gumibot[id] = true;
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELGUMIBOT);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELGUMIBOT);
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public Change_Weapon(id)
{
new weaponID = read_data(2);
if(get_user_team(id) == 1)
{
if(weaponID == CSW_KNIFE && g_csavar[id])
{
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELCSAVAR);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELCSAVAR);
}
else if(weaponID == CSW_KNIFE && g_baseball[id])
{
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELBASEBALL);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELBASEBALL);
}
}
else if(get_user_team(id) == 2)
{
if(weaponID == CSW_KNIFE && g_gumibot[id])
{
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELGUMIBOT);
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELGUMIBOT);
}
}
return PLUGIN_CONTINUE;
}
public PlayerSpawn(id)
{
if (is_user_alive(id))
{
boltmenu(id)
}
}
public TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
if(get_user_weapon(attacker) == CSW_KNIFE)
{
if(get_user_team(attacker) == 1 && g_csavar[attacker])
{
SetHamParamFloat(4, 100.0);
}
else if(get_user_team(attacker) == 1 && g_baseball[attacker])
{
SetHamParamFloat(4, 75.0);
}
else if(get_user_team(attacker) == 2 && g_gumibot[attacker])
{
SetHamParamFloat(4, 100.0);
}
}
return HAM_IGNORED;
}
public client_PreThink(id)
{
set_hudmessage(255, 255, 255, 0.9, 0.8, 0, 6.0, 4.5);
ShowSyncHudMsg(id, syncObjp,"Pontjaid: %i", g_pontok[id]);
return PLUGIN_CONTINUE;
}
public save(id)
{
new vaultkey[64],vaultdata[256], name[32]
get_user_name(id, name, 31)
format(vaultkey,63,"%s-REG", name)
format(vaultdata,255,"%i#",g_pontok[id])
nvault_set(g_vault,vaultkey,vaultdata)
return PLUGIN_CONTINUE
}
public load(id)
{
new vaultkey[64],vaultdata[256], name[32]
get_user_name(id, name, 31)
format(vaultkey,63,"%s-REG", name)
format(vaultdata,255,"%i#",g_pontok[id])
nvault_get(g_vault,vaultkey,vaultdata,255)
replace_all(vaultdata, 255, "#", " ")
new a3[32]
parse(vaultdata, a3, 31)
g_pontok[id] = str_to_num(a3)
return PLUGIN_CONTINUE;
}
public client_connect(id)
{
load(id)
}
public client_disconnect(id)
{
save(id)
}