Raised This Month: $12 Target: $400
 3% 

shop plugin (help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
newstartnewbegin2
Junior Member
Join Date: Jul 2019
Old 07-22-2019 , 13:27   shop plugin (help)
Reply With Quote #1

can anyone edit it for me. add /shop and when i say /shop it opens the menu pls.


#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta_util>
#include <engine>
#include <cstrike>
#include <colorchat>

#define PLUGIN "Super Shop"
#define VERSION "1.3"
#define AUTHOR "gladius"

#define MODELS_CT 4
#define MODELS_TT 4

#define TASK_COUNT

#define OFFSET_PRIMARYWEAPON 116

#define NPC_NAME "npc_model"

new const model_npc[] = "gordon"

new npcModel[63]

new g_npc
new g_weapon
new bool:npcMade
new filename[256]
new bool:inmenu[33]

new enabled
new kills
new hpcost, armorcost, gravitycost, speedcost, hecost, flashcost, smokecost, godcost, inviscost, ammocost, hscost, swalkcost, noclipcost, camouflagecost, randomcost, recoilcost, respawncost, longjumpcost
new hp, armor, invisAlpha, glowcustom, randommoney
new glowcolor
new godtime, invistime, gravitytime, gravitymax, speedtime, speedmax, onlyhstime, swalktime, nocliptime, camouflagetime, recoiltime, longjumptime
new bool:gravity[33], bool:speed[33], bool:godmode[33], bool:noclip[33], boolnlyhs[33], bool:invis[33], bool:swalk[33], bool:camouflage[33], bool:recoil[33], bool:randomn[33], bool:longjump[33]
new Timer

new g_maxplayers

//Stuck
new stuck[33]

new cvar[2]

new const Float:size[][3] = {
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}
// end Stuck

new const g_szShop[] = "shop.cfg" // file

new MODEL_CT[MODELS_CT][] =
{
"arctic",
"guerilla",
"leet",
"terror"
}

new MODEL_TT[MODELS_TT][] =
{
"gign",
"gsg9",
"sas",
"urban"
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

enabled = register_cvar("amx_sshop","1")

hp = register_cvar("amx_health", "120")
armor = register_cvar("amx_armor", "120")
gravitymax = register_cvar("amx_gravity", "0.5")
speedmax = register_cvar("amx_speed", "300.0")

godtime = register_cvar("amx_god_time", "20.0")
invistime = register_cvar("amx_invis_time", "15.0")
speedtime = register_cvar("amx_speed_time", "20.0")
gravitytime = register_cvar("amx_gravity_time", "15.0")
onlyhstime = register_cvar("amx_onlyhs_time", "40.0")
swalktime = register_cvar("amx_swalk_time", "30.0")
nocliptime = register_cvar("amx_noclip_time", "20.0")
camouflagetime = register_cvar("amx_camouflage_time", "20.0")
recoiltime = register_cvar("amx_recoil_time", "20.0")
longjumptime = register_cvar("amx_longjump_time", "10.0")

hpcost = register_cvar("amx_health_cost", "1")
armorcost = register_cvar("amx_armor_cost", "1")
gravitycost = register_cvar("amx_gravity_cost", "1")
speedcost = register_cvar("amx_speed_cost", "1")
hecost = register_cvar("amx_he_cost", "1")
flashcost = register_cvar("amx_flash_cost", "1")
smokecost = register_cvar("amx_smoke_cost", "1")
godcost = register_cvar("amx_god_cost", "1")
inviscost = register_cvar("amx_invis_cost", "1")
ammocost = register_cvar("amx_ammo_cost", "1")
hscost = register_cvar("amx_onlyhs_cost", "1")
swalkcost = register_cvar("amx_swalk_cost", "1")
noclipcost = register_cvar("amx_noclip_cost", "1")
camouflagecost = register_cvar("amx_camouflage_cost", "1")
recoilcost = register_cvar("amx_recoil_cost", "1")
respawncost = register_cvar("amx_respawn_cost", "1")
longjumpcost = register_cvar("amx_longjump_cost", "1")
randomcost = register_cvar("amx_random_cost", "1")

randommoney = register_cvar("amx_random_money", "1000")

invisAlpha = register_cvar("amx_invis_max", "30")

glowcustom = register_cvar("amx_god_glowcustom","1")

glowcolor = register_cvar("amx_god_glowcolor", "255 0 0")

new confFolder[32]
get_mapname(filename, 255)
get_configsdir(confFolder, 31)
format(filename, 255, "%s/npc/%s.coord", confFolder, filename)
set_task(3.0, "loadNPC")

register_forward(FM_Touch, "hook_Touch")

register_concmd("amx_createnpc", "tryCreateNPC", ADMIN_KICK, "- create NPC")
register_concmd("amx_removenpc", "tryRemoveNPC", ADMIN_KICK, "- remove NPC")

// stuck cvars
cvar[0] = register_cvar("amx_stuck","1")
cvar[1] = register_cvar("amx_stuck_time","3")
set_task(0.1,"checkstuck",0,"",0,"b")

register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("CurWeapon","change_weapon","b e","1=1")

register_dictionary("shop.txt")

g_maxplayers = get_maxplayers()
}

public plugin_precache()
{
formatex(npcModel, 63, "models/player/%s/%s.mdl", model_npc, model_npc)

precache_model(npcModel)
}

public plugin_cfg()
{
new ConfigsDir[64]
get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir))
format(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szShop)

if (!file_exists(ConfigsDir))
{
server_print("Shop File [%s] doesn't exists!", ConfigsDir)
return;
}
server_cmd("exec ^"%s^"", ConfigsDir)
}

public client_putinserver(id)
{
inmenu[id] = false
}

public hook_Touch(ent, id)
{
if(get_pcvar_num(enabled) == 0)
{
client_print(id, print_chat, "[Balkan Community] This Plugin Is Disabled.")
return PLUGIN_HANDLED
}

if(Timer > 0)
{
return PLUGIN_HANDLED
}

if(!is_user_alive(id) || inmenu[id])
return FMRES_IGNORED;

new classname[32];
pev(ent, pev_classname, classname, 31);

if((equali(classname, "worldspawn") || equali(classname, "func_wall")) && !(pev(ent, pev_flags) & FL_ONGROUND))
{
remove_task(id);
}

if(equali(classname, "shacks_npc"))
{

set_task(0.1, "frags", id)

inmenu[id] = true

new hnsmenu = menu_create("\wB\ralkan Shop Menu", "ShopHandler")
new item[32]

formatex(item, sizeof(item)-1, "%L \y(%L)", id, "HEALTH", id, "COST", get_pcvar_num(hpcost))
menu_additem(hnsmenu, item, "1", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "ARMOR", id, "COST", get_pcvar_num(armorcost))
menu_additem(hnsmenu, item, "2", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "GRAVITY", id, "COST", get_pcvar_num(gravitycost))
menu_additem(hnsmenu, item, "3", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SPEED", id, "COST", get_pcvar_num(speedcost))
menu_additem(hnsmenu, item, "4", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "HE", id, "COST", get_pcvar_num(hecost))
menu_additem(hnsmenu, item, "5", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "FLASH", id, "COST", get_pcvar_num(flashcost))
menu_additem(hnsmenu, item, "6", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SMOKE", id, "COST", get_pcvar_num(smokecost))
menu_additem(hnsmenu, item, "7", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SWALK", id, "COST", get_pcvar_num(swalkcost))
menu_additem(hnsmenu, item, "8", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "CAMOUFLAGE", id, "COST", get_pcvar_num(camouflagecost))
menu_additem(hnsmenu, item, "9", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "LONGJUMP", id, "COST", get_pcvar_num(longjumpcost))
menu_additem(hnsmenu, item, "10", ADMIN_ALL)
formatex(item, sizeof(item)-1, "%L \y(%L)", id, "RANDOM", id, "COST", get_pcvar_num(randomcost))
menu_additem(hnsmenu, item, "11", ADMIN_ALL)

menu_setprop(hnsmenu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, hnsmenu, 0)
}
return PLUGIN_HANDLED
}

public ShopHandler(id, hnsmenu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(hnsmenu)
inmenu[id] = false
return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback
menu_item_getinfo(hnsmenu, item, Access, Data, sizeof(Data)-1, Name, sizeof(Name)-1, Callback)

kills = get_user_frags(id)

new Key = str_to_num(Data)

switch (Key)
{
case 1: give_health(id)
case 2: give_armor(id)
case 3: give_gravity(id)
case 4: give_speed(id)
case 5: give_he(id)
case 6: give_flash(id)
case 7: give_smoke(id)
case 8: give_swalk(id)
case 9: give_camouflage(id)
case 10: give_longjump(id)
case 11: give_random(id)
}
menu_destroy(hnsmenu)
inmenu[id] = false
return PLUGIN_HANDLED
}

public give_health(id)
{
new cost = get_pcvar_num(hpcost)
new item = get_pcvar_num(hp)

if (kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_health(id, get_user_health(id) + item)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHEALTH")
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if (randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_health(id, get_user_health(id) + item)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHEALTH")
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_armor(id)
{
new cost = get_pcvar_num(armorcost)
new item = get_pcvar_num(armor)

if (kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_armor(id, get_user_armor(id) + item)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEARMOR")
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_armor(id, get_user_armor(id) + item)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEARMOR")
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_gravity(id)
{
new cost = get_pcvar_num(gravitycost)
new gravedad = get_pcvar_num(gravitymax)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_gravity(id, Float:gravedad)
gravity[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGRAVITY")
Timer = get_pcvar_num(gravitytime)
set_task(0.1, "timer_gravity", id)
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_gravity(id, Float:gravedad)
gravity[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGRAVITY")
Timer = get_pcvar_num(gravitytime)
set_task(0.1, "timer_gravity", id)
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_speed(id)
{
new cost = get_pcvar_num(speedcost)
new speedy = get_pcvar_num(speedmax)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_maxspeed(id, Float:speedy)
speed[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESPEED")
Timer = get_pcvar_num(speedtime)
set_task(0.1, "timer_speed", id)
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_maxspeed(id, Float:speedy)
speed[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESPEED")
Timer = get_pcvar_num(speedtime)
set_task(0.1, "timer_speed", id)
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_he(id)
{
new cost = get_pcvar_num(hecost)

if (kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
give_item(id,"weapon_hegrenade")
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHE")
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_flash(id)
{
new cost = get_pcvar_num(flashcost)

if (kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
give_item(id,"weapon_flashbang")
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEFLASH")
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_smoke(id)
{
new cost = get_pcvar_num(smokecost)

if (kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
give_item(id,"weapon_smokegrenade")
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESMOKE")
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_god(id)
{
new cost = get_pcvar_num(godcost)
new Colores[12], rgb[3][4], iRed, iGreen, iBlue

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_godmode(id, 1)
Timer = get_pcvar_num(godtime)
set_task(0.1, "timer_god", id)
godmode[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGODMODE")

if(get_pcvar_num(glowcustom) == 1)
{
glow_custom(id)
}

else if(get_pcvar_num(glowcustom) == 0)
{
get_pcvar_string(glowcolor, Colores, charsmax(Colores))
parse(Colores, rgb[0], 3, rgb[1], 3, rgb[2], 3)
iRed = clamp(str_to_num(rgb[0]), 0, 255)
iGreen = clamp(str_to_num(rgb[1]), 0, 255)
iBlue = clamp(str_to_num(rgb[2]), 0, 255)
set_user_rendering(id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 25)
}
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_godmode(id, 1)
Timer = get_pcvar_num(godtime)
set_task(0.1, "timer_god", id)
godmode[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGODMODE")
}

if(get_pcvar_num(glowcustom) == 1)
{
set_task(0.1, "glow_custom", id)
}

else if(get_pcvar_num(glowcustom) == 0)
{
get_pcvar_string(glowcolor, Colores, charsmax(Colores))
parse(Colores, rgb[0], 3, rgb[1], 3, rgb[2], 3)
iRed = clamp(str_to_num(rgb[0]), 0, 255)
iGreen = clamp(str_to_num(rgb[1]), 0, 255)
iBlue = clamp(str_to_num(rgb[2]), 0, 255)
set_user_rendering(id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 25)
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public glow_custom(id)
{
set_user_rendering(id, kRenderFxGlowShell, random_num(0, 255), random_num(0, 255), random_num(0, 255), kRenderNormal, 25)
set_task(0.5, "glow_custom", id)
}

public give_invis(id)
{
new cost = get_pcvar_num(inviscost)
new invismax = get_pcvar_num(invisAlpha)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd, invismax)
Timer = get_pcvar_num(invistime)
set_task(0.1, "timer_invis", id)
invis[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEINVIS")

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if(is_user_alive(id))
{
set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd, invismax)
Timer = get_pcvar_num(invistime)
set_task(0.1, "timer_invis", id)
invis[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEINVIS")

}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_ammo(id)
{
new cost = get_pcvar_num(ammocost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
new clip, ammo, weapon = get_user_weapon(id,clip,ammo)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEAMMO")

switch(weapon) {

case CSW_P228: {
give_item(id,"ammo_357sig")
}
case CSW_SCOUT: {
give_item(id,"ammo_762nato")
}
case CSW_HEGRENADE: {
return PLUGIN_HANDLED
}
case CSW_XM1014: {
give_item(id,"ammo_buckshot")

}
case CSW_C4: {
return PLUGIN_HANDLED
}
case CSW_MAC10: {
give_item(id,"ammo_45acp")
}
case CSW_AUG: {
give_item(id,"ammo_556nato")
}
case CSW_SMOKEGRENADE: {
return PLUGIN_HANDLED
}
case CSW_ELITE: {
give_item(id,"ammo_9mm")
}
case CSW_FIVESEVEN: {
give_item(id,"ammo_57mm")
}
case CSW_UMP45: {
give_item(id,"ammo_45acp")
}
case CSW_SG550: {
give_item(id,"ammo_556nato")
}
case CSW_GALI: {
give_item(id,"ammo_556nato")
}
case CSW_FAMAS: {
give_item(id,"ammo_556nato")
}
case CSW_USP: {
give_item(id,"ammo_45acp")
}
case CSW_GLOCK18: {
give_item(id,"ammo_9mm")
}
case CSW_AWP: {
give_item(id,"ammo_338magnum")
}
case CSW_MP5NAVY: {
give_item(id,"ammo_9mm")
}
case CSW_M249: {
give_item(id,"ammo_556natobox")
}
case CSW_M3: {
give_item(id,"ammo_buckshot")

}
case CSW_M4A1: {
give_item(id,"ammo_556nato")
}
case CSW_TMP: {
give_item(id,"ammo_9mm")
}
case CSW_G3SG1: {
give_item(id,"ammo_762nato")
}
case CSW_FLASHBANG: {
return PLUGIN_HANDLED
}
case CSW_DEAGLE: {
give_item(id,"ammo_50ae")
}
case CSW_SG552: {
give_item(id,"ammo_556nato")
}
case CSW_AK47: {
give_item(id,"ammo_762nato")
}
case CSW_KNIFE: {
return PLUGIN_HANDLED
}
case CSW_P90: {
give_item(id,"ammo_57mm")
}
default: return PLUGIN_CONTINUE
}
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
return PLUGIN_CONTINUE
}

public give_onlyhs(id)
{
new cost = get_pcvar_num(hscost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_hitzones(0, id, 2)
onlyhs[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEONLYHS")
Timer = get_pcvar_num(onlyhstime)
set_task(0.1, "timer_onlyhs", id)

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_hitzones(0, id, 2)
onlyhs[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEONLYHS")
Timer = get_pcvar_num(onlyhstime)
set_task(0.1, "timer_onlyhs", id)

}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_swalk(id)
{
new cost = get_pcvar_num(swalkcost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_footsteps(id, 1)
swalk[id] = true
Timer = get_pcvar_num(swalktime)
set_task(0.1, "timer_swalk", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESWALK")

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_footsteps(id, 1)
swalk[id] = true
Timer = get_pcvar_num(swalktime)
set_task(0.1, "timer_swalk", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESWALK")

}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_noclip(id)
{
new cost = get_pcvar_num(noclipcost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
set_user_noclip(id, 1)
noclip[id] = true
Timer = get_pcvar_num(nocliptime)
set_task(0.1, "timer_noclip", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVENOCLIP")

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
set_user_noclip(id, 1)
noclip[id] = true
Timer = get_pcvar_num(nocliptime)
set_task(0.1, "timer_noclip", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVENOCLIP")

}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
return PLUGIN_CONTINUE
}

public give_camouflage(id)
{
new cost = get_pcvar_num(camouflagecost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
camouflage[id] = true
Timer = get_pcvar_num(camouflagetime)
set_task(0.1, "timer_camouflage", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVECAMOUFLAGE")

if(cs_get_user_team(id) == CS_TEAM_T)
{
cs_set_user_model(id, MODEL_TT[random(MODELS_TT)])
}

else if(cs_get_user_team(id) == CS_TEAM_CT)
{
cs_set_user_model(id, MODEL_CT[random(MODELS_CT)])
}
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
camouflage[id] = true
Timer = get_pcvar_num(camouflagetime)
set_task(0.1, "timer_camouflage", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVECAMOUFLAGE")

if(cs_get_user_team(id) == CS_TEAM_T)
{
cs_set_user_model(id, MODEL_TT[random(MODELS_CT)])
}

else if(cs_get_user_team(id) == CS_TEAM_CT)
{
cs_set_user_model(id, MODEL_CT[random(MODELS_TT)])
}
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
return PLUGIN_CONTINUE
}

public give_recoil(id)
{
new cost = get_pcvar_num(recoilcost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
recoil[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERECOIL")
Timer = get_pcvar_num(recoiltime)
set_task(0.1, "timer_recoil", id)

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
recoil[id] = true
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERECOIL")
Timer = get_pcvar_num(recoiltime)
set_task(0.1, "timer_recoil", id)

}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_respawn(id)
{
new cost = get_pcvar_num(respawncost)

if (kills >= cost && !is_user_alive(id))
{
if(cs_get_user_team(id) == CS_TEAM_T)
{
cs_user_spawn(id)
cs_set_user_team(id, 1)
}

else if(cs_get_user_team(id) == CS_TEAM_CT)
{
cs_user_spawn(id)
cs_set_user_team(id, 2)
}
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERESPAWN")
}

else if(is_user_alive(id))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "ALIVE")
}

else if (randomn[id] == true)
{
if (!is_user_alive(id))
{
if(cs_get_user_team(id) == CS_TEAM_T)
{
cs_user_spawn(id)
cs_set_user_team(id, 1)
}

else if(cs_get_user_team(id) == CS_TEAM_CT)
{
cs_user_spawn(id)
cs_set_user_team(id, 2)
}
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERESPAWN")
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
}

public give_longjump(id)
{
new cost = get_pcvar_num(longjumpcost)

if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
fm_set_user_longjump(id, true)
longjump[id] = true
Timer = get_pcvar_num(longjumptime)
set_task(0.1, "timer_longjump", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVELONGJUMP")

}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else if(randomn[id] == true)
{
if (is_user_alive(id))
{
fm_set_user_longjump(id, true)
longjump[id] = true
Timer = get_pcvar_num(longjumptime)
set_task(0.1, "timer_longjump", id)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVELONGJUMP")
}
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
return PLUGIN_CONTINUE
}

public give_random(id)
{
new cost = get_pcvar_num(randomcost)
new money = cs_get_user_money(id)


if(kills >= cost && is_user_alive(id))
{
set_user_frags(id, kills - cost)
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERANDOM")
randomn[id] = true

switch (random_num(1, 16))
{
case 1: give_noclip(id)
case 2:{
if (is_user_alive(id))
{
user_kill(id, 1)
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "KILL")
}
}
case 3: ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOTHING")
case 4:{
if (is_user_alive(id))
{
set_user_frags(id, kills - cost)
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "LOSTFRAG")
}
}
case 5: give_armor(id)
case 6: give_health(id)
case 7: give_invis(id)
case 8: give_god(id)
case 9: give_camouflage(id)
case 10: give_onlyhs(id)
case 11: give_swalk(id)
case 12: give_speed(id)
case 13: give_gravity(id)
case 14: give_recoil(id)
case 15: give_longjump(id)
case 16:{
if (is_user_alive(id))
{
if(money > 12000)
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOMONEY")
}

else
{
cs_set_user_money(id, randommoney)
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "MONEY")
}
}
}
}
}

else if(!(is_user_alive(id)))
{
ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
}

else
{
ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
}
return PLUGIN_CONTINUE
}

public timer_speed(id)
{
if(!speed[id]) return;

--Timer
set_task(1.0, "timer_speed", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Speed: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_speed", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Speed: [Over]")
set_task(0.1, "remove_speed", id)
}
}

public timer_gravity(id)
{
if(!gravity[id]) return;

--Timer
set_task(1.0, "timer_gravity", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Gravity: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_gravity", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Gravity: [Over]")
set_task(0.1, "remove_gravity", id)
}
}

public timer_god(id)
{
if(!godmode[id]) return;

--Timer
set_task(1.0, "timer_god", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Godmode: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_god", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Godmode: [Over]")
set_task(0.1, "remove_god", id)
}
}

public timer_invis(id)
{
if(!invis[id]) return;

--Timer
set_task(1.0, "timer_invis", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Invisible: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_invis", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Invisible: [Over]")
set_task(0.1, "remove_invis", id)
}
}

public timer_onlyhs(id)
{
if(!onlyhs[id]) return;

--Timer
set_task(1.0, "timer_onlyhs", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Only Headshot: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_onlyhs", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Only Headshot: [Over]")
set_task(0.1, "remove_onlyhs", id)
}
}

public timer_swalk(id)
{
if(!swalk[id]) return;

--Timer
set_task(1.0, "timer_swalk", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Silent Walk: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_swalk", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Silent Walk: [Over]")
set_task(0.1, "remove_swalk", id)
}
}

public timer_noclip(id)
{
if(!noclip[id]) return;
--Timer
set_task(1.0, "timer_noclip", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Noclip: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_noclip", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Noclip: [Over]")
set_task(0.1, "remove_noclip", id)
}
}

public timer_camouflage(id)
{
if(!camouflage[id]) return;
--Timer
set_task(1.0, "timer_camouflage", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Camouflage: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_camouflage", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Camouflage: [Over]")
set_task(0.1, "remove_camouflage", id)
}
}

public timer_recoil(id)
{
if(!recoil[id]) return;
--Timer
set_task(1.0, "timer_recoil", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "No Recoil: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_recoil", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "No Recoil: [Over]")
set_task(0.1, "remove_recoil", id)
}
}

public timer_longjump(id)
{
if(!longjump[id]) return;
--Timer
set_task(1.0, "timer_longjump", id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
show_hudmessage(id, "Longjump: [%i]",Timer)

if(!(is_user_alive(id)))
{
remove_task(id)
set_task(0.1, "remove_longjump", id)
}

if(Timer < 1)
{
remove_task(id)
set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
show_hudmessage(id, "Longjump: [Over]")
set_task(0.1, "remove_longjump", id)
}
}

public remove_speed(id)
{
if(speed[id] == true)
{
set_user_maxspeed(id, 250.0)
speed[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVESPEED")
}
}

public remove_gravity(id)
{
if(gravity[id] == true)
{
set_user_gravity(id, 1.0)
gravity[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEGRAVITY")
}
}

public remove_god(id)
{
if(godmode[id] == true)
{
set_user_godmode(id, 0)
godmode[id] = false
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEGODMODE")
}
}

public remove_invis(id)
{
if(invis[id] == true)
{
set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderNormal,255)
invis[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEINVIS")
}
}

public remove_onlyhs(id)
{
if(onlyhs[id] == true)
{
set_user_hitzones(0, 0, 255)
onlyhs[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEONLYHS")
}
}

public remove_swalk(id)
{
if(swalk[id] == true)
{
set_user_footsteps(id, 0)
swalk[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVESWALK")
}
}

public remove_noclip(id)
{
if(noclip[id] == true)
{
set_user_noclip(id, 0)
noclip[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVENOCLIP")
}
}

public remove_camouflage(id)
{
if(camouflage[id] == true)
{
cs_reset_user_model(id)
camouflage[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVECAMOUFLAGE")
}
}

public remove_recoil(id)
{
if(recoil[id] == true)
{
recoil[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVERECOIL")
}
}

public remove_longjump(id)
{
if(longjump[id] == true)
{
fm_set_user_longjump(id, false)
longjump[id] = false
ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVELONGJUMP")
}
}

public frags(id)
{
if(is_user_alive(id))
{
ColorChat(id, BLUE, "^x01[Balkan Community] ^x04%L", id, "FRAGS", get_user_frags(id))
}
}

public event_round_start()
{
for (new id = 1; id <= g_maxplayers; id++)
{
if(!is_user_alive(id)) continue;

if (camouflage[id] == true) remove_camouflage(id)
if (godmode[id] == true) remove_god(id)
if (gravity[id] == true) remove_gravity(id)
if (invis[id] == true) remove_invis(id)
if (noclip[id] == true) remove_noclip(id)
if(onlyhs[id] == true) remove_onlyhs(id)
if (speed[id] == true) remove_speed(id)
if (swalk[id] == true) remove_swalk(id)
if (longjump[id] == true) remove_longjump(id)
if (recoil[id] == true) remove_recoil(id)
if (randomn[id] == true)
{
remove_camouflage(id)
remove_god(id)
remove_gravity(id)
remove_invis(id)
remove_noclip(id)
remove_onlyhs(id)
remove_speed(id)
remove_swalk(id)
remove_longjump(id)
remove_recoil(id)
}
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
inmenu[id] = false
}
}

public change_weapon(id)
{
if(speed[id])
{
set_user_maxspeed(id, get_pcvar_float(speedmax))
}

if (recoil[id])
{
entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
}
}

//********************************************* *******************************************//
//************Stuck*********** by *********** NL)Ramon(NL ********************************//
//********************************************* *******************************************//

public checkstuck() {
if(get_pcvar_num(cvar[0]) >= 1) {
static players[32], pnum, player
get_players(players, pnum)
static Floatrigin[3]
static Float:mins[3], hull
static Float:vec[3]
static o,i
for(i=0; i<pnum; i++){
player = players[i]
if (is_user_connected(player) && is_user_alive(player)) {
pev(player, pev_origin, origin)
hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
++stuck[player]
if(stuck[player] >= get_pcvar_num(cvar[1])) {
pev(player, pev_mins, mins)
vec[2] = origin[2]
for (o=0; o < sizeof size; ++o) {
vec[0] = origin[0] - mins[0] * size[o][0]
vec[1] = origin[1] - mins[1] * size[o][1]
vec[2] = origin[2] - mins[2] * size[o][2]
if (is_hull_vacant(vec, hull,player)) {
engfunc(EngFunc_SetOrigin, player, vec)
effects(player)
set_pev(player,pev_velocity,{0.0,0.0,0.0})
o = sizeof size
}
}
}
}
else
{
stuck[player] = 0
}
}
}
}
}

stock bool:is_hull_vacant(const Floatrigin[3], hull,id) {
static tr
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
return true

return false
}

public effects(id) {
if(get_pcvar_num(cvar[0])) {
set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
show_hudmessage(id,"You should be unstucked now!") // HUDMESSAGE
message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0}, id )
write_short(1<<10) // fade lasts this long duration
write_short(1<<10) // fade lasts this long hold time
write_short(1<<1) // fade type (in / out)
write_byte(20) // fade red
write_byte(255) // fade green
write_byte(255) // fade blue
write_byte(255) // fade alpha
message_end()
client_cmd(id,"spk fvox/blip.wav")
}
}

public tryCreateNPC(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return FMRES_IGNORED;
createNPC(id);
return FMRES_HANDLED;
}

public tryRemoveNPC(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return FMRES_IGNORED;
removeNPC(id);
return FMRES_HANDLED;
}

public loadNPC()
createNPC(0);

public createNPC(id)
{
if(npcMade && pev_valid(g_npc))
{
engfunc(EngFunc_RemoveEntity, g_npc);
engfunc(EngFunc_RemoveEntity, g_weapon);
}
npcMade = true;

new Floatrigin[3], Float:angles[3];
if(id > 0)
{
pev(id, pev_origin, origin);
pev(id, pev_angles, angles);
}
else
{
new file = fopen(filename, "r");
if(file)
{
// File exists
new data[128];
new i;

while(!feof(file))
{
fgets(file, data, 127);
if(i <= 2) // Line 1-3 = origin
{
origin[i] = str_to_float(data);
}
else if(i == 3) angles[0] = str_to_float(data);
else if(i == 4) angles[1] = str_to_float(data);
else if(i == 5) angles[2] = str_to_float(data);
i++;
}
fclose(file);
}
else
{
// File doesn't exist, exit function
return FMRES_IGNORED;
}
}

// Create the npc entity
g_npc = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));

engfunc(EngFunc_SetModel, g_npc, npcModel);
engfunc(EngFunc_SetSize, g_npc, Float:{-17.0,-17.0,-36.0}, Float:{17.0,17.0,36.0});
angles[0] = 0.0;
set_pev(g_npc, pev_angles, angles);

engfunc(EngFunc_SetOrigin, g_npc, origin);

if(id > 0)
{
origin[2] += 80;
engfunc(EngFunc_SetOrigin, id, origin);
}

set_pev(g_npc, pev_solid, SOLID_BBOX);
//set_pev(g_npc, pev_movetype, MOVETYPE_TOSS);
set_pev(g_npc, pev_classname, "shacks_npc");

// Set the default animation
set_pev(g_npc, pev_animtime, 2.0);
set_pev(g_npc, pev_framerate, 1.0);
set_pev(g_npc, pev_sequence, 1);

// Set bone positions
set_pev(g_npc, pev_controller_0, 125);
set_pev(g_npc, pev_controller_1, 125);
set_pev(g_npc, pev_controller_2, 125);
set_pev(g_npc, pev_controller_3, 125);

// Set damage and hp
set_pev(g_npc, pev_takedamage, 0.0);

// Drop to ground?
engfunc(EngFunc_DropToFloor, g_npc);

// Give item
give_item1(g_npc)

// Save the origin + angles
if(id > 0)
{
new filepointer = fopen(filename, "w+");
if(filepointer)
{
fprintf(filepointer, "%f^n%f^n%f^n%f^n%f^n%f", origin[0], origin[1], origin[2], angles[0], angles[1], angles[2]);
fclose(filepointer);
client_print(id, print_chat, "The NPC has been created and saved.");
}
}

return FMRES_HANDLED;
}

public removeNPC(id)
{
remove_entity(g_npc)
client_print(id, print_chat, "The NPC has been deleted.");
}

public give_item1(ent)
{
g_weapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
set_pev(g_weapon, pev_classname, "npc_weapon");
set_pev(g_weapon, pev_solid, SOLID_NOT);
set_pev(g_weapon, pev_movetype, MOVETYPE_FOLLOW);
set_pev(g_weapon, pev_aiment, ent);
set_pev(g_weapon, pev_sequence, 1);
}
newstartnewbegin2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-22-2019 , 14:07   Re: shop plugin (help)
Reply With Quote #2

It doesn't take a genius to figure out that your thread shouldn't look the way it looks right now.

Put your code in [php] tags in order to make it readable and non-painful to look at.
__________________

Last edited by OciXCrom; 07-22-2019 at 14:07.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-23-2019 , 07:10   Re: shop plugin (help)
Reply With Quote #3

I hope it will work because the shop opens up by HOOK TOUCH and therefore need to arrange something there.

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta_util>
#include <engine>
#include <cstrike>
#include <colorchat>

#define PLUGIN "Super Shop"
#define VERSION "1.3"
#define AUTHOR "gladius"

#define MODELS_CT 4
#define MODELS_TT 4

#define TASK_COUNT

#define OFFSET_PRIMARYWEAPON 116

#define NPC_NAME "npc_model"

new const model_npc[] = "gordon"

new npcModel[63]

new g_npc
new g_weapon
new bool:npcMade
new filename[256]
new bool:inmenu[33]

new enabled
new kills 
new hpcost, armorcost, gravitycost, speedcost, hecost, flashcost, smokecost, godcost, inviscost, ammocost, hscost, swalkcost, noclipcost, camouflagecost, randomcost, recoilcost, respawncost, longjumpcost
new hp, armor, invisAlpha, glowcustom, randommoney
new glowcolor
new godtime, invistime, gravitytime, gravitymax, speedtime, speedmax, onlyhstime, swalktime, nocliptime, camouflagetime, recoiltime, longjumptime
new bool:gravity[33], bool:speed[33], bool:godmode[33], bool:noclip[33], boolnlyhs[33], bool:invis[33], bool:swalk[33], bool:camouflage[33], bool:recoil[33], bool:randomn[33], bool:longjump[33]
new Timer

new g_maxplayers

//Stuck
new stuck[33]

new cvar[2]

new const Float:size[][3] = {
	{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
	{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
	{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
	{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
	{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}
// end Stuck

new const g_szShop[] = "shop.cfg"	// file

new MODEL_CT[MODELS_CT][] =
{
"arctic",
"guerilla",
"leet",
"terror"
}

new MODEL_TT[MODELS_TT][] =
{	
"gign",
"gsg9",
"sas",
"urban"
}

public plugin_init() 
{
register_plugin(PLUGIN, VERSION, AUTHOR)

enabled = register_cvar("amx_sshop","1")

hp = register_cvar("amx_health", "120")
armor = register_cvar("amx_armor", "120")
gravitymax = register_cvar("amx_gravity", "0.5")
speedmax = register_cvar("amx_speed", "300.0")

godtime = register_cvar("amx_god_time", "20.0")
invistime = register_cvar("amx_invis_time", "15.0")
speedtime = register_cvar("amx_speed_time", "20.0")
gravitytime = register_cvar("amx_gravity_time", "15.0")
onlyhstime = register_cvar("amx_onlyhs_time", "40.0")
swalktime = register_cvar("amx_swalk_time", "30.0")
nocliptime = register_cvar("amx_noclip_time", "20.0")
camouflagetime = register_cvar("amx_camouflage_time", "20.0")
recoiltime = register_cvar("amx_recoil_time", "20.0")
longjumptime = register_cvar("amx_longjump_time", "10.0")

hpcost = register_cvar("amx_health_cost", "1")
armorcost = register_cvar("amx_armor_cost", "1")
gravitycost = register_cvar("amx_gravity_cost", "1")
speedcost = register_cvar("amx_speed_cost", "1")
hecost = register_cvar("amx_he_cost", "1")
flashcost = register_cvar("amx_flash_cost", "1")
smokecost = register_cvar("amx_smoke_cost", "1")
godcost = register_cvar("amx_god_cost", "1")
inviscost = register_cvar("amx_invis_cost", "1")
ammocost = register_cvar("amx_ammo_cost", "1")
hscost = register_cvar("amx_onlyhs_cost", "1")
swalkcost = register_cvar("amx_swalk_cost", "1")
noclipcost = register_cvar("amx_noclip_cost", "1")
camouflagecost = register_cvar("amx_camouflage_cost", "1")
recoilcost = register_cvar("amx_recoil_cost", "1")
respawncost = register_cvar("amx_respawn_cost", "1")
longjumpcost = register_cvar("amx_longjump_cost", "1")
randomcost = register_cvar("amx_random_cost", "1")

randommoney = register_cvar("amx_random_money", "1000")

invisAlpha = register_cvar("amx_invis_max", "30")

glowcustom = register_cvar("amx_god_glowcustom","1")

glowcolor = register_cvar("amx_god_glowcolor", "255 0 0")

register_clcmd("say /shop", "public hook_Touch";

new confFolder[32]
get_mapname(filename, 255)
get_configsdir(confFolder, 31)
format(filename, 255, "%s/npc/%s.coord", confFolder, filename)
set_task(3.0, "loadNPC")

register_forward(FM_Touch, "hook_Touch")

register_concmd("amx_createnpc", "tryCreateNPC", ADMIN_KICK, "- create NPC")
register_concmd("amx_removenpc", "tryRemoveNPC", ADMIN_KICK, "- remove NPC")

// stuck cvars
cvar[0] = register_cvar("amx_stuck","1")
cvar[1] = register_cvar("amx_stuck_time","3")
set_task(0.1,"checkstuck",0,"",0,"b")

register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("CurWeapon","change_weapon","b e","1=1")

register_dictionary("shop.txt")

g_maxplayers = get_maxplayers()
}

public plugin_precache()
{
formatex(npcModel, 63, "models/player/%s/%s.mdl", model_npc, model_npc)

precache_model(npcModel)
}

public plugin_cfg()
{
new ConfigsDir[64]
get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir))
format(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szShop)

if (!file_exists(ConfigsDir))
{
server_print("Shop File [%s] doesn't exists!", ConfigsDir)
return;
}
server_cmd("exec ^"%s^"", ConfigsDir)
}

public client_putinserver(id)
{ 
	inmenu[id] = false
}

public hook_Touch(ent, id)
{
	if(get_pcvar_num(enabled) == 0) 
	{ 
		client_print(id, print_chat, "[Balkan Community] This Plugin Is Disabled.") 
		return PLUGIN_HANDLED 
	} 

	if(Timer > 0)
	{
		return PLUGIN_HANDLED 
	}

	if(!is_user_alive(id) || inmenu[id])
		return FMRES_IGNORED;

	new classname[32];
	pev(ent, pev_classname, classname, 31);

	if((equali(classname, "worldspawn") || equali(classname, "func_wall")) && !(pev(ent, pev_flags) & FL_ONGROUND))
	{
		remove_task(id);
	}

	if(equali(classname, "shacks_npc"))
	{
	
		set_task(0.1, "frags", id)	
	
		inmenu[id] = true
	
		new hnsmenu = menu_create("\wB\ralkan Shop Menu", "ShopHandler")
		new item[32]
	
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "HEALTH", id, "COST", get_pcvar_num(hpcost))
	menu_additem(hnsmenu, item, "1", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "ARMOR", id, "COST", get_pcvar_num(armorcost))
	menu_additem(hnsmenu, item, "2", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "GRAVITY", id, "COST", get_pcvar_num(gravitycost))
	menu_additem(hnsmenu, item, "3", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SPEED", id, "COST", get_pcvar_num(speedcost))
	menu_additem(hnsmenu, item, "4", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "HE", id, "COST", get_pcvar_num(hecost))
	menu_additem(hnsmenu, item, "5", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "FLASH", id, "COST", get_pcvar_num(flashcost))
	menu_additem(hnsmenu, item, "6", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SMOKE", id, "COST", get_pcvar_num(smokecost))
	menu_additem(hnsmenu, item, "7", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "SWALK", id, "COST", get_pcvar_num(swalkcost))
	menu_additem(hnsmenu, item, "8", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "CAMOUFLAGE", id, "COST", get_pcvar_num(camouflagecost))
	menu_additem(hnsmenu, item, "9", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "LONGJUMP", id, "COST", get_pcvar_num(longjumpcost))
	menu_additem(hnsmenu, item, "10", ADMIN_ALL)
	formatex(item, sizeof(item)-1, "%L \y(%L)", id, "RANDOM", id, "COST", get_pcvar_num(randomcost))
	menu_additem(hnsmenu, item, "11", ADMIN_ALL)
	
	menu_setprop(hnsmenu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, hnsmenu, 0)
}
return PLUGIN_HANDLED
}

public ShopHandler(id, hnsmenu, item)
{
if (item == MENU_EXIT)
{
	menu_destroy(hnsmenu)
	inmenu[id] = false
	return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback
menu_item_getinfo(hnsmenu, item, Access, Data, sizeof(Data)-1, Name, sizeof(Name)-1, Callback)

kills = get_user_frags(id)

new Key = str_to_num(Data)

switch (Key)
{
	case 1: give_health(id)
		case 2: give_armor(id)
			case 3: give_gravity(id)
			case 4: give_speed(id)
			case 5: give_he(id)
			case 6: give_flash(id)
			case 7: give_smoke(id)
			case 8: give_swalk(id)
			case 9: give_camouflage(id)
			case 10: give_longjump(id)
			case 11: give_random(id)
		}
	menu_destroy(hnsmenu)
	inmenu[id] = false
	return PLUGIN_HANDLED
}

public give_health(id)
{
	new cost = get_pcvar_num(hpcost)
	new item = get_pcvar_num(hp)
	
	if (kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_health(id, get_user_health(id) + item) 
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHEALTH")
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if (randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_health(id, get_user_health(id) + item) 
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHEALTH")
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_armor(id)
{
	new cost = get_pcvar_num(armorcost)
	new item = get_pcvar_num(armor)
	
	if (kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_armor(id, get_user_armor(id) + item) 
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEARMOR")
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_armor(id, get_user_armor(id) + item) 
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEARMOR")
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_gravity(id)
{
	new cost = get_pcvar_num(gravitycost)
	new gravedad = get_pcvar_num(gravitymax)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_gravity(id, Float:gravedad) 
		gravity[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGRAVITY")
		Timer = get_pcvar_num(gravitytime)
		set_task(0.1, "timer_gravity", id)	
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_gravity(id, Float:gravedad) 
			gravity[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGRAVITY")
			Timer = get_pcvar_num(gravitytime)
			set_task(0.1, "timer_gravity", id)
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_speed(id)
{
	new cost = get_pcvar_num(speedcost)
	new speedy = get_pcvar_num(speedmax)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_maxspeed(id, Float:speedy)
		speed[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESPEED")
		Timer = get_pcvar_num(speedtime)
		set_task(0.1, "timer_speed", id)
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_maxspeed(id, Float:speedy)
			speed[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESPEED")
			Timer = get_pcvar_num(speedtime)
			set_task(0.1, "timer_speed", id)
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_he(id)
{
	new cost = get_pcvar_num(hecost)
	
	if (kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		give_item(id,"weapon_hegrenade")
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEHE")
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_flash(id)
{
	new cost = get_pcvar_num(flashcost)
	
	if (kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		give_item(id,"weapon_flashbang")
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEFLASH")
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_smoke(id)
{
	new cost = get_pcvar_num(smokecost)
	
	if (kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		give_item(id,"weapon_smokegrenade")
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESMOKE")
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}	

public give_god(id)
{
	new cost = get_pcvar_num(godcost)
	new Colores[12], rgb[3][4], iRed, iGreen, iBlue
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_godmode(id, 1)
		Timer = get_pcvar_num(godtime)
		set_task(0.1, "timer_god", id)	
		godmode[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGODMODE")
		
		if(get_pcvar_num(glowcustom) == 1)
		{
			glow_custom(id)
		}
		
		else if(get_pcvar_num(glowcustom) == 0)
		{
			get_pcvar_string(glowcolor, Colores, charsmax(Colores))
			parse(Colores, rgb[0], 3, rgb[1], 3, rgb[2], 3)
			iRed = clamp(str_to_num(rgb[0]), 0, 255)
			iGreen = clamp(str_to_num(rgb[1]), 0, 255)
			iBlue = clamp(str_to_num(rgb[2]), 0, 255)
			set_user_rendering(id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 25)
		}
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_godmode(id, 1)
			Timer = get_pcvar_num(godtime)
			set_task(0.1, "timer_god", id)	
			godmode[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEGODMODE")
		}
		
		if(get_pcvar_num(glowcustom) == 1)
		{
			set_task(0.1, "glow_custom", id)
		}
		
		else if(get_pcvar_num(glowcustom) == 0)
		{
			get_pcvar_string(glowcolor, Colores, charsmax(Colores))
			parse(Colores, rgb[0], 3, rgb[1], 3, rgb[2], 3)
			iRed = clamp(str_to_num(rgb[0]), 0, 255)
			iGreen = clamp(str_to_num(rgb[1]), 0, 255)
			iBlue = clamp(str_to_num(rgb[2]), 0, 255)
			set_user_rendering(id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 25)
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public glow_custom(id)
{
	set_user_rendering(id, kRenderFxGlowShell, random_num(0, 255), random_num(0, 255), random_num(0, 255), kRenderNormal, 25)
	set_task(0.5, "glow_custom", id)
}

public give_invis(id)
{
	new cost = get_pcvar_num(inviscost)
	new invismax = get_pcvar_num(invisAlpha)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd, invismax) 
		Timer = get_pcvar_num(invistime)
		set_task(0.1, "timer_invis", id)
		invis[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEINVIS")
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if(is_user_alive(id))
		{
			set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd, invismax)
			Timer = get_pcvar_num(invistime)
			set_task(0.1, "timer_invis", id)
			invis[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEINVIS")
			
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_ammo(id)
{
	new cost = get_pcvar_num(ammocost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		new clip, ammo, weapon = get_user_weapon(id,clip,ammo)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEAMMO")
		
		switch(weapon) { 
			
			case CSW_P228: { 
				give_item(id,"ammo_357sig")
			}
			case CSW_SCOUT: { 
				give_item(id,"ammo_762nato")
			}
			case CSW_HEGRENADE: { 
				return PLUGIN_HANDLED
			}
			case CSW_XM1014: { 
				give_item(id,"ammo_buckshot")
				
			}
			case CSW_C4: { 
				return PLUGIN_HANDLED
			}
			case CSW_MAC10: { 
				give_item(id,"ammo_45acp")
			}
			case CSW_AUG: { 
				give_item(id,"ammo_556nato")
			}
			case CSW_SMOKEGRENADE: { 
				return PLUGIN_HANDLED
			}
			case CSW_ELITE: { 
				give_item(id,"ammo_9mm")
			}
			case CSW_FIVESEVEN: { 
				give_item(id,"ammo_57mm")
			}
			case CSW_UMP45: { 
				give_item(id,"ammo_45acp")
			}
			case CSW_SG550: { 
				give_item(id,"ammo_556nato")
			}
			case CSW_GALI: { 
				give_item(id,"ammo_556nato")	
			}
			case CSW_FAMAS: { 
				give_item(id,"ammo_556nato")
			}
			case CSW_USP: { 
				give_item(id,"ammo_45acp")
			}
			case CSW_GLOCK18: { 
				give_item(id,"ammo_9mm")
			}
			case CSW_AWP: { 
				give_item(id,"ammo_338magnum")
			}
			case CSW_MP5NAVY: { 
				give_item(id,"ammo_9mm")
			}
			case CSW_M249: { 
				give_item(id,"ammo_556natobox")
			}
			case CSW_M3: { 
				give_item(id,"ammo_buckshot")
				
			}
			case CSW_M4A1: { 
				give_item(id,"ammo_556nato")
			}
			case CSW_TMP: { 
				give_item(id,"ammo_9mm")
			}
			case CSW_G3SG1: { 
				give_item(id,"ammo_762nato")
			}
			case CSW_FLASHBANG: { 
				return PLUGIN_HANDLED
			}
			case CSW_DEAGLE: { 
				give_item(id,"ammo_50ae")
			}
			case CSW_SG552: { 
				give_item(id,"ammo_556nato")
			}
			case CSW_AK47: { 
				give_item(id,"ammo_762nato")
			}
			case CSW_KNIFE: { 
				return PLUGIN_HANDLED
			}
			case CSW_P90: { 
				give_item(id,"ammo_57mm")
			}
			default: return PLUGIN_CONTINUE
		}
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
	return PLUGIN_CONTINUE
}

public give_onlyhs(id)
{
	new cost = get_pcvar_num(hscost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_hitzones(0, id, 2)
		onlyhs[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEONLYHS")
		Timer = get_pcvar_num(onlyhstime)
		set_task(0.1, "timer_onlyhs", id)
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_hitzones(0, id, 2)
			onlyhs[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVEONLYHS")
			Timer = get_pcvar_num(onlyhstime)
			set_task(0.1, "timer_onlyhs", id)
			
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_swalk(id)
{
	new cost = get_pcvar_num(swalkcost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_footsteps(id, 1)
		swalk[id] = true
		Timer = get_pcvar_num(swalktime)
		set_task(0.1, "timer_swalk", id)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESWALK")
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_footsteps(id, 1)
			swalk[id] = true
			Timer = get_pcvar_num(swalktime)
			set_task(0.1, "timer_swalk", id)
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVESWALK")
			
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_noclip(id)
{
	new cost = get_pcvar_num(noclipcost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		set_user_noclip(id, 1)
		noclip[id] = true
		Timer = get_pcvar_num(nocliptime)
		set_task(0.1, "timer_noclip", id)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVENOCLIP")
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			set_user_noclip(id, 1)
			noclip[id] = true
			Timer = get_pcvar_num(nocliptime)
			set_task(0.1, "timer_noclip", id)
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVENOCLIP")
			
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
	return PLUGIN_CONTINUE
}

public give_camouflage(id)
{
	new cost = get_pcvar_num(camouflagecost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		camouflage[id] = true
		Timer = get_pcvar_num(camouflagetime)
		set_task(0.1, "timer_camouflage", id)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVECAMOUFLAGE")
		
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			cs_set_user_model(id, MODEL_TT[random(MODELS_TT)])
		}
		
		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			cs_set_user_model(id, MODEL_CT[random(MODELS_CT)])
		}
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	} 
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			camouflage[id] = true
			Timer = get_pcvar_num(camouflagetime)
			set_task(0.1, "timer_camouflage", id)
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVECAMOUFLAGE")
			
			if(cs_get_user_team(id) == CS_TEAM_T)
			{
				cs_set_user_model(id, MODEL_TT[random(MODELS_CT)])
			}
			
			else if(cs_get_user_team(id) == CS_TEAM_CT)
			{
				cs_set_user_model(id, MODEL_CT[random(MODELS_TT)])
			}
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
	return PLUGIN_CONTINUE
}

public give_recoil(id)
{
	new cost = get_pcvar_num(recoilcost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
		recoil[id] = true
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERECOIL")
		Timer = get_pcvar_num(recoiltime)
		set_task(0.1, "timer_recoil", id)
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
			recoil[id] = true
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERECOIL")
			Timer = get_pcvar_num(recoiltime)
			set_task(0.1, "timer_recoil", id)
			
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_respawn(id)
{
	new cost = get_pcvar_num(respawncost)
	
	if (kills >= cost && !is_user_alive(id))
	{
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 1)
		}
		
		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 2)
		}
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERESPAWN")
	}
	
	else if(is_user_alive(id))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "ALIVE")
	}
	
	else if (randomn[id] == true)
	{
		if (!is_user_alive(id))
		{
			if(cs_get_user_team(id) == CS_TEAM_T)
			{
				cs_user_spawn(id)
				cs_set_user_team(id, 1)
			}
			
			else if(cs_get_user_team(id) == CS_TEAM_CT)
			{
				cs_user_spawn(id)
				cs_set_user_team(id, 2)
			}
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERESPAWN")
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
}

public give_longjump(id)
{
	new cost = get_pcvar_num(longjumpcost)
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		fm_set_user_longjump(id, true)
		longjump[id] = true
		Timer = get_pcvar_num(longjumptime)
		set_task(0.1, "timer_longjump", id)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVELONGJUMP")
		
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else if(randomn[id] == true)
	{
		if (is_user_alive(id))
		{
			fm_set_user_longjump(id, true)
			longjump[id] = true
			Timer = get_pcvar_num(longjumptime)
			set_task(0.1, "timer_longjump", id)
			ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVELONGJUMP")	
		}
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
	return PLUGIN_CONTINUE
}

public give_random(id)
{
	new cost = get_pcvar_num(randomcost)
	new money = cs_get_user_money(id)
	
	
	if(kills >= cost && is_user_alive(id))
	{
		set_user_frags(id, kills - cost)
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "GIVERANDOM")
		randomn[id] = true
		
		switch (random_num(1, 16))
		{
			case 1: give_noclip(id)
				case 2:{
				if (is_user_alive(id))
				{
					user_kill(id, 1)
					ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "KILL")
				}
			}	
			case 3: ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOTHING")
				case 4:{
				if (is_user_alive(id))
				{
					set_user_frags(id, kills - cost)
					ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "LOSTFRAG")
				}
			}
			case 5: give_armor(id)
				case 6: give_health(id)
				case 7: give_invis(id)
				case 8: give_god(id)
				case 9: give_camouflage(id)
				case 10: give_onlyhs(id)
				case 11: give_swalk(id)
				case 12: give_speed(id)
				case 13: give_gravity(id)
				case 14: give_recoil(id)
				case 15: give_longjump(id)
				case 16:{
				if (is_user_alive(id))
				{
					if(money > 12000)
					{
						ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOMONEY")
					}
					
					else
					{
						cs_set_user_money(id, randommoney)
						ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "MONEY")
					}
				}
			}
		}
	}
	
	else if(!(is_user_alive(id)))
	{
		ColorChat(id, GREEN, "^x01[Balkan Community] ^x04%L", id, "DEAD")
	}
	
	else
	{
		ColorChat(id, RED, "^x01[Balkan Community] ^x03%L", id, "NOBUY")
	}
	return PLUGIN_CONTINUE
}

public timer_speed(id)
{	
	if(!speed[id]) return;
	
	--Timer
	set_task(1.0, "timer_speed", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Speed: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_speed", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Speed: [Over]")
		set_task(0.1, "remove_speed", id)
	}
}

public timer_gravity(id)
{
	if(!gravity[id]) return;
	
	--Timer
	set_task(1.0, "timer_gravity", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Gravity: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_gravity", id) 
	} 
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Gravity: [Over]")
		set_task(0.1, "remove_gravity", id)
	}
}

public timer_god(id)
{
	if(!godmode[id]) return;
	
	--Timer
	set_task(1.0, "timer_god", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Godmode: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_god", id) 
	} 
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Godmode: [Over]")
		set_task(0.1, "remove_god", id)
	}
}

public timer_invis(id)
{
	if(!invis[id]) return;
	
	--Timer
	set_task(1.0, "timer_invis", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Invisible: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_invis", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Invisible: [Over]")
		set_task(0.1, "remove_invis", id)
	}
}

public timer_onlyhs(id)
{
	if(!onlyhs[id]) return;
	
	--Timer
	set_task(1.0, "timer_onlyhs", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Only Headshot: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_onlyhs", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Only Headshot: [Over]")
		set_task(0.1, "remove_onlyhs", id)
	}
}

public timer_swalk(id)
{	
	if(!swalk[id]) return;
	
	--Timer
	set_task(1.0, "timer_swalk", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Silent Walk: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_swalk", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Silent Walk: [Over]")
		set_task(0.1, "remove_swalk", id)
	}
}

public timer_noclip(id)
{	
	if(!noclip[id]) return;
	--Timer
	set_task(1.0, "timer_noclip", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Noclip: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_noclip", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Noclip: [Over]")
		set_task(0.1, "remove_noclip", id)
	}
}

public timer_camouflage(id)
{
	if(!camouflage[id]) return;
	--Timer
	set_task(1.0, "timer_camouflage", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Camouflage: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_camouflage", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Camouflage: [Over]")
		set_task(0.1, "remove_camouflage", id)
	}
}

public timer_recoil(id)
{
	if(!recoil[id]) return;
	--Timer
	set_task(1.0, "timer_recoil", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "No Recoil: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_recoil", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "No Recoil: [Over]")
		set_task(0.1, "remove_recoil", id)
	}
}

public timer_longjump(id)
{
	if(!longjump[id]) return;
	--Timer
	set_task(1.0, "timer_longjump", id)
	set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 12.0)
	show_hudmessage(id, "Longjump: [%i]",Timer)
	
	if(!(is_user_alive(id))) 
	{ 
		remove_task(id)
		set_task(0.1, "remove_longjump", id) 
	}
	
	if(Timer < 1)
	{
		remove_task(id)
		set_hudmessage(255, 255, 255, 0.01, 0.3, 0, 6.0, 3.0)
		show_hudmessage(id, "Longjump: [Over]")
		set_task(0.1, "remove_longjump", id)
	}
}

public remove_speed(id)
{	
	if(speed[id] == true)
	{
		set_user_maxspeed(id, 250.0)
		speed[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVESPEED")
	}
}

public remove_gravity(id)
{
	if(gravity[id] == true)
	{
		set_user_gravity(id, 1.0)
		gravity[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEGRAVITY")
	}
}

public remove_god(id)
{
	if(godmode[id] == true)
	{
		set_user_godmode(id, 0)
		godmode[id] = false
		set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEGODMODE")
	}
}

public remove_invis(id)
{
	if(invis[id] == true)
	{
		set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderNormal,255)
		invis[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEINVIS")
	}
}

public remove_onlyhs(id)
{
	if(onlyhs[id] == true)
	{
		set_user_hitzones(0, 0, 255)
		onlyhs[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVEONLYHS")
	}
}

public remove_swalk(id)
{	
	if(swalk[id] == true)
	{
		set_user_footsteps(id, 0)
		swalk[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVESWALK")
	}
}

public remove_noclip(id)
{	
	if(noclip[id] == true)
	{
		set_user_noclip(id, 0)
		noclip[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVENOCLIP")
	}
}

public remove_camouflage(id)
{
	if(camouflage[id] == true)
	{
		cs_reset_user_model(id)
		camouflage[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVECAMOUFLAGE")
	}
}

public remove_recoil(id)
{
	if(recoil[id] == true)
	{
		recoil[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVERECOIL")
	}
}

public remove_longjump(id)
{
	if(longjump[id] == true)
	{
		fm_set_user_longjump(id, false)
		longjump[id] = false
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x03%L", id, "REMOVELONGJUMP")
	}
}

public frags(id)
{
	if(is_user_alive(id))
	{
		ColorChat(id, BLUE, "^x01[Balkan Community] ^x04%L", id, "FRAGS", get_user_frags(id))
	}
}

public event_round_start()
{
	for (new id = 1; id <= g_maxplayers; id++) 
	{
		if(!is_user_alive(id)) continue;
		
		if (camouflage[id] == true) remove_camouflage(id)
		if (godmode[id] == true) remove_god(id)
		if (gravity[id] == true) remove_gravity(id)
		if (invis[id] == true) remove_invis(id)
		if (noclip[id] == true) remove_noclip(id)
		if(onlyhs[id] == true) remove_onlyhs(id)
		if (speed[id] == true) remove_speed(id)
		if (swalk[id] == true) remove_swalk(id)
		if (longjump[id] == true) remove_longjump(id)
		if (recoil[id] == true) remove_recoil(id)
		if (randomn[id] == true)
		{
			remove_camouflage(id)
			remove_god(id)
			remove_gravity(id)
			remove_invis(id)
			remove_noclip(id)
			remove_onlyhs(id)
			remove_speed(id)
			remove_swalk(id)
			remove_longjump(id)
			remove_recoil(id)	
		}
		set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
		inmenu[id] = false
	}
} 

public change_weapon(id) 
{ 
	if(speed[id]) 
	{ 
		set_user_maxspeed(id, get_pcvar_float(speedmax))
	} 
	
	if (recoil[id])
	{
		entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
	}	
}

//********************************************* *******************************************//
//************Stuck*********** by *********** NL)Ramon(NL ********************************//
//********************************************* *******************************************//

public checkstuck() {
	if(get_pcvar_num(cvar[0]) >= 1) {
		static players[32], pnum, player
		get_players(players, pnum)
		static Floatrigin[3]
		static Float:mins[3], hull
		static Float:vec[3]
		static o,i
		for(i=0; i<pnum; i++){
			player = players[i]
			if (is_user_connected(player) && is_user_alive(player)) {
				pev(player, pev_origin, origin)
				hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
				if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
					++stuck[player]
					if(stuck[player] >= get_pcvar_num(cvar[1])) {
						pev(player, pev_mins, mins)
						vec[2] = origin[2]
						for (o=0; o < sizeof size; ++o) {
							vec[0] = origin[0] - mins[0] * size[o][0]
							vec[1] = origin[1] - mins[1] * size[o][1]
							vec[2] = origin[2] - mins[2] * size[o][2]
							if (is_hull_vacant(vec, hull,player)) {
								engfunc(EngFunc_SetOrigin, player, vec)
								effects(player)
								set_pev(player,pev_velocity,{0.0,0.0,0.0})
								o = sizeof size
							}
						}
					}
				}
				else
				{
					stuck[player] = 0
				}
			}
		}
	}
}

stock bool:is_hull_vacant(const Floatrigin[3], hull,id) {
	static tr
	engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
	if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
		return true
	
	return false
}

public effects(id) {
	if(get_pcvar_num(cvar[0])) {
		set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
		show_hudmessage(id,"You should be unstucked now!") // HUDMESSAGE
		message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0}, id ) 
		write_short(1<<10) // fade lasts this long duration
		write_short(1<<10) // fade lasts this long hold time
		write_short(1<<1) // fade type (in / out)
		write_byte(20) // fade red
		write_byte(255) // fade green
		write_byte(255) // fade blue
		write_byte(255) // fade alpha
		message_end()
		client_cmd(id,"spk fvox/blip.wav")
	}
}

public tryCreateNPC(id, level, cid)
{
	if(!cmd_access(id, level, cid, 1))
		return FMRES_IGNORED;
	createNPC(id);
	return FMRES_HANDLED;
}

public tryRemoveNPC(id, level, cid)
{
	if(!cmd_access(id, level, cid, 1))
		return FMRES_IGNORED;
	removeNPC(id);
	return FMRES_HANDLED;
}

public loadNPC()
	createNPC(0);

public createNPC(id)
{	
	if(npcMade && pev_valid(g_npc))
	{
		engfunc(EngFunc_RemoveEntity, g_npc);
		engfunc(EngFunc_RemoveEntity, g_weapon);
	}
	npcMade = true;
	
	new Floatrigin[3], Float:angles[3];
	if(id > 0)
	{
		pev(id, pev_origin, origin);
		pev(id, pev_angles, angles);
	}
	else
	{
		new file = fopen(filename, "r");
		if(file)
		{
			// File exists
			new data[128];
			new i;
			
			while(!feof(file))
			{
				fgets(file, data, 127);
				if(i <= 2) // Line 1-3 = origin
				{
					origin[i] = str_to_float(data);
				}
				else if(i == 3) angles[0] = str_to_float(data);
					else if(i == 4) angles[1] = str_to_float(data);
					else if(i == 5) angles[2] = str_to_float(data);
					i++;
			}
			fclose(file);
		}
		else
		{
			// File doesn't exist, exit function
			return FMRES_IGNORED;
		}
	}
	
	// Create the npc entity
	g_npc = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	
	engfunc(EngFunc_SetModel, g_npc, npcModel);
	engfunc(EngFunc_SetSize, g_npc, Float:{-17.0,-17.0,-36.0}, Float:{17.0,17.0,36.0});
	angles[0] = 0.0;
	set_pev(g_npc, pev_angles, angles);
	
	engfunc(EngFunc_SetOrigin, g_npc, origin);
	
	if(id > 0)
	{
		origin[2] += 80;
		engfunc(EngFunc_SetOrigin, id, origin);
	}
	
	set_pev(g_npc, pev_solid, SOLID_BBOX);
	//set_pev(g_npc, pev_movetype, MOVETYPE_TOSS);
	set_pev(g_npc, pev_classname, "shacks_npc");
	
	// Set the default animation
	set_pev(g_npc, pev_animtime, 2.0);
	set_pev(g_npc, pev_framerate, 1.0);
	set_pev(g_npc, pev_sequence, 1);
	
	// Set bone positions
	set_pev(g_npc, pev_controller_0, 125);
	set_pev(g_npc, pev_controller_1, 125);
	set_pev(g_npc, pev_controller_2, 125);
	set_pev(g_npc, pev_controller_3, 125);
	
	// Set damage and hp
	set_pev(g_npc, pev_takedamage, 0.0);
	
	// Drop to ground?
	engfunc(EngFunc_DropToFloor, g_npc);
	
	// Give item
	give_item1(g_npc)
	
	// Save the origin + angles
	if(id > 0)
	{
		new filepointer = fopen(filename, "w+");
		if(filepointer)
		{
			fprintf(filepointer, "%f^n%f^n%f^n%f^n%f^n%f", origin[0], origin[1], origin[2], angles[0], angles[1], angles[2]);
			fclose(filepointer);
			client_print(id, print_chat, "The NPC has been created and saved.");
		}
	}
	
	return FMRES_HANDLED;
}

public removeNPC(id)
{
	remove_entity(g_npc)
	client_print(id, print_chat, "The NPC has been deleted.");
}

public give_item1(ent)
{
	g_weapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	set_pev(g_weapon, pev_classname, "npc_weapon");
	set_pev(g_weapon, pev_solid, SOLID_NOT);
	set_pev(g_weapon, pev_movetype, MOVETYPE_FOLLOW);
	set_pev(g_weapon, pev_aiment, ent);
	set_pev(g_weapon, pev_sequence, 1);
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode