AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Helpo] with adding one thing (https://forums.alliedmods.net/showthread.php?t=253018)

nixh 12-13-2014 13:36

[Helpo] with adding one thing
 
hy there, could someone help me with this one? its a shop/npc and i need that this would only work for Terrorist team.


PHP 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[] = "lol2"

new npcModel[63]

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

new 
enabled
new kills 
new hpcostarmorcostgravitycostspeedcosthecostflashcostsmokecostgodcostinviscostammocosthscostswalkcostnoclipcostcamouflagecostrandomcostrecoilcostrespawncostlongjumpcost
new hparmorinvisAlphaglowcustomrandommoney
new glowcolor
new godtimeinvistimegravitytimegravitymaxspeedtimespeedmaxonlyhstimeswalktimenocliptimecamouflagetimerecoiltimelongjumptime
new bool:gravity[33], bool:speed[33], bool:godmode[33], bool:noclip[33], bool:onlyhs[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.00.01.0}, {0.00.0, -1.0}, {0.01.00.0}, {0.0, -1.00.0}, {1.00.00.0}, {-1.00.00.0}, {-1.01.01.0}, {1.01.01.0}, {1.0, -1.01.0}, {1.01.0, -1.0}, {-1.0, -1.01.0}, {1.0, -1.0, -1.0}, {-1.01.0, -1.0}, {-1.0, -1.0, -1.0},
    {
0.00.02.0}, {0.00.0, -2.0}, {0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}, {-2.02.02.0}, {2.02.02.0}, {2.0, -2.02.0}, {2.02.0, -2.0}, {-2.0, -2.02.0}, {2.0, -2.0, -2.0}, {-2.02.0, -2.0}, {-2.0, -2.0, -2.0},
    {
0.00.03.0}, {0.00.0, -3.0}, {0.03.00.0}, {0.0, -3.00.0}, {3.00.00.0}, {-3.00.00.0}, {-3.03.03.0}, {3.03.03.0}, {3.0, -3.03.0}, {3.03.0, -3.0}, {-3.0, -3.03.0}, {3.0, -3.0, -3.0}, {-3.03.0, -3.0}, {-3.0, -3.0, -3.0},
    {
0.00.04.0}, {0.00.0, -4.0}, {0.04.00.0}, {0.0, -4.00.0}, {4.00.00.0}, {-4.00.00.0}, {-4.04.04.0}, {4.04.04.0}, {4.0, -4.04.0}, {4.04.0, -4.0}, {-4.0, -4.04.0}, {4.0, -4.0, -4.0}, {-4.04.0, -4.0}, {-4.0, -4.0, -4.0},
    {
0.00.05.0}, {0.00.0, -5.0}, {0.05.00.0}, {0.0, -5.00.0}, {5.00.00.0}, {-5.00.00.0}, {-5.05.05.0}, {5.05.05.0}, {5.0, -5.05.0}, {5.05.0, -5.0}, {-5.0, -5.05.0}, {5.0, -5.0, -5.0}, {-5.05.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(PLUGINVERSIONAUTHOR)
    
    
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(filename255)
    
get_configsdir(confFolder31)
    
format(filename255"%s/npc/%s.coord"confFolderfilename)
    
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","be","1=1")
    
    
register_dictionary("shop.txt")
    
    
g_maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
formatex(npcModel63"models/player/%s/%s.mdl"model_npcmodel_npc)
    
    
precache_model(npcModel)
}

public 
plugin_cfg()
{
    new 
ConfigsDir[64]
    
get_localinfo("amxx_configsdir"ConfigsDircharsmax(ConfigsDir))
    
format(ConfigsDircharsmax(ConfigsDir), "%s/%s"ConfigsDirg_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(entid)
{
    if(
get_pcvar_num(enabled) == 0
    { 
        
client_print(idprint_chat"[AMXX] 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(entpev_classnameclassname31);
    
    if((
equali(classname"worldspawn") || equali(classname"func_wall")) && !(pev(entpev_flags) & FL_ONGROUND))
    {
        
remove_task(id);
    }
    
    if(
equali(classname"shacks_npc"))
    {
        
    
set_task(0.1"frags"id)    

    
inmenu[id] = true
        
    
new hnsmenu menu_create("Shop menu""ShopHandler")
    new 
item[32]
    
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"HEALTH"id"COST"get_pcvar_num(hpcost))
    
menu_additem(hnsmenuitem"1"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"ARMOR"id"COST"get_pcvar_num(armorcost))
    
menu_additem(hnsmenuitem"2"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"GRAVITY"id"COST"get_pcvar_num(gravitycost))
    
menu_additem(hnsmenuitem"3"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"SPEED"id"COST"get_pcvar_num(speedcost))
    
menu_additem(hnsmenuitem"4"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"HE"id"COST"get_pcvar_num(hecost))
    
menu_additem(hnsmenuitem"5"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"FLASH"id"COST"get_pcvar_num(flashcost))
    
menu_additem(hnsmenuitem"6"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"SMOKE"id"COST"get_pcvar_num(smokecost))
    
menu_additem(hnsmenuitem"7"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"GODMODE"id"COST"get_pcvar_num(godcost))
    
menu_additem(hnsmenuitem"8"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"INVIS"id"COST"get_pcvar_num(inviscost))
    
menu_additem(hnsmenuitem"9"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"AMMO"id"COST"get_pcvar_num(ammocost))
    
menu_additem(hnsmenuitem"10"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"ONLYHS"id"COST"get_pcvar_num(hscost))
    
menu_additem(hnsmenuitem"11"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"SWALK"id"COST"get_pcvar_num(swalkcost))
    
menu_additem(hnsmenuitem"12"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"NOCLIP"id"COST"get_pcvar_num(noclipcost))
    
menu_additem(hnsmenuitem"13"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"CAMOUFLAGE"id"COST"get_pcvar_num(camouflagecost))
    
menu_additem(hnsmenuitem"14"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"RECOIL"id"COST"get_pcvar_num(recoilcost))
    
menu_additem(hnsmenuitem"15"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"RESPAWN"id"COST"get_pcvar_num(respawncost))
    
menu_additem(hnsmenuitem"16"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"LONGJUMP"id"COST"get_pcvar_num(longjumpcost))
    
menu_additem(hnsmenuitem"17"ADMIN_ALL)
    
formatex(itemsizeof(item)-1"%L \y(%L)"id"RANDOM"id"COST"get_pcvar_num(randomcost))
    
menu_additem(hnsmenuitem"18"ADMIN_ALL)
    
    
menu_setprop(hnsmenuMPROP_EXITMEXIT_ALL)
    
menu_display(idhnsmenu0)
    }
    return 
PLUGIN_HANDLED
}

public 
ShopHandler(idhnsmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(hnsmenu)
        
inmenu[id] = false
        
return PLUGIN_HANDLED
    
}
    
    new 
Data[6], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(hnsmenuitemAccessDatasizeof(Data)-1Namesizeof(Name)-1Callback)
    
    
kills get_user_frags(id)
    
    new 
Key str_to_num(Data)
    
    switch (
Key)
    {
        case 
1give_health(id)
        case 
2give_armor(id)
        case 
3give_gravity(id)
        case 
4give_speed(id)
        case 
5give_he(id)
        case 
6give_flash(id)
        case 
7give_smoke(id)
        case 
8give_god(id)
        case 
9give_invis(id)
        case 
10give_ammo(id)
        case 
11give_onlyhs(id)
        case 
12give_swalk(id)
        case 
13give_noclip(id)
        case 
14give_camouflage(id)
        case 
15give_recoil(id)
        case 
16give_respawn(id)
        case 
17give_longjump(id)
        case 
18give_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(idkills cost)
        
set_user_health(idget_user_health(id) + item
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVEHEALTH")
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if (
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_health(idget_user_health(id) + item
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVEHEALTH")
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
set_user_armor(idget_user_armor(id) + item
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVEARMOR")
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_armor(idget_user_armor(id) + item
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVEARMOR")
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
set_user_gravity(idFloat:gravedad
        
gravity[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEGRAVITY")
        
Timer get_pcvar_num(gravitytime)
        
set_task(0.1"timer_gravity"id)    
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_gravity(idFloat:gravedad
            
gravity[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEGRAVITY")
            
Timer get_pcvar_num(gravitytime)
            
set_task(0.1"timer_gravity"id)
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
set_user_maxspeed(idFloat:speedy)
        
speed[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVESPEED")
        
Timer get_pcvar_num(speedtime)
        
set_task(0.1"timer_speed"id)
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_maxspeed(idFloat:speedy)
            
speed[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVESPEED")
            
Timer get_pcvar_num(speedtime)
            
set_task(0.1"timer_speed"id)
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

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

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

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

public 
give_god(id)
{
    new 
cost get_pcvar_num(godcost)
    new 
Colores[12], rgb[3][4], iRediGreeniBlue
    
    
if(kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        
set_user_godmode(id1)
        
Timer get_pcvar_num(godtime)
        
set_task(0.1"timer_god"id)    
        
godmode[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEGODMODE")
        
        if(
get_pcvar_num(glowcustom) == 1)
        {
            
glow_custom(id)
        }
        
        else if(
get_pcvar_num(glowcustom) == 0)
        {
            
get_pcvar_string(glowcolorColorescharsmax(Colores))
            
parse(Coloresrgb[0], 3rgb[1], 3rgb[2], 3)
            
iRed clamp(str_to_num(rgb[0]), 0255)
            
iGreen clamp(str_to_num(rgb[1]), 0255)
            
iBlue clamp(str_to_num(rgb[2]), 0255)
            
set_user_rendering(idkRenderFxGlowShelliRediGreeniBluekRenderNormal25)
        }
    }
        
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_godmode(id1)
            
Timer get_pcvar_num(godtime)
            
set_task(0.1"timer_god"id)    
            
godmode[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^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(glowcolorColorescharsmax(Colores))
            
parse(Coloresrgb[0], 3rgb[1], 3rgb[2], 3)
            
iRed clamp(str_to_num(rgb[0]), 0255)
            
iGreen clamp(str_to_num(rgb[1]), 0255)
            
iBlue clamp(str_to_num(rgb[2]), 0255)
            
set_user_rendering(idkRenderFxGlowShelliRediGreeniBluekRenderNormal25)
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

public 
glow_custom(id)
{
    
set_user_rendering(idkRenderFxGlowShellrandom_num(0255), random_num(0255), random_num(0255), kRenderNormal25)
    
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(idkills cost)
        
set_user_rendering(id,kRenderFxNone0,0,0kRenderTransAddinvismax
        
Timer get_pcvar_num(invistime)
        
set_task(0.1"timer_invis"id)
        
invis[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEINVIS")

    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if(
is_user_alive(id))
        {
            
set_user_rendering(id,kRenderFxNone0,0,0kRenderTransAddinvismax)
            
Timer get_pcvar_num(invistime)
            
set_task(0.1"timer_invis"id)
            
invis[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEINVIS")

        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

public 
give_ammo(id)
{
    new 
cost get_pcvar_num(ammocost)
    
    if(
kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        new 
clipammoweapon get_user_weapon(id,clip,ammo)
        
ColorChat(idGREEN"^x01[AMXX] ^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(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
set_user_hitzones(0id2)
        
onlyhs[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEONLYHS")
        
Timer get_pcvar_num(onlyhstime)
        
set_task(0.1"timer_onlyhs"id)

    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_hitzones(0id2)
            
onlyhs[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVEONLYHS")
            
Timer get_pcvar_num(onlyhstime)
            
set_task(0.1"timer_onlyhs"id)

        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

public 
give_swalk(id)
{
    new 
cost get_pcvar_num(swalkcost)
    
    if(
kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        
set_user_footsteps(id1)
        
swalk[id] = true
        Timer 
get_pcvar_num(swalktime)
        
set_task(0.1"timer_swalk"id)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVESWALK")

    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_footsteps(id1)
            
swalk[id] = true
            Timer 
get_pcvar_num(swalktime)
            
set_task(0.1"timer_swalk"id)
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVESWALK")

        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

public 
give_noclip(id)
{
    new 
cost get_pcvar_num(noclipcost)
    
    if(
kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        
set_user_noclip(id1)
        
noclip[id] = true
        Timer 
get_pcvar_num(nocliptime)
        
set_task(0.1"timer_noclip"id)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVENOCLIP")
        
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
set_user_noclip(id1)
            
noclip[id] = true
            Timer 
get_pcvar_num(nocliptime)
            
set_task(0.1"timer_noclip"id)
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVENOCLIP")
                 
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
camouflage[id] = true
        Timer 
get_pcvar_num(camouflagetime)
        
set_task(0.1"timer_camouflage"id)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVECAMOUFLAGE")
                
        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            
cs_set_user_model(idMODEL_TT[random(MODELS_TT)])
             }
         
        else if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_model(idMODEL_CT[random(MODELS_CT)])
        }
    }
       
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^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(idGREEN"^x01[AMXX] ^x04%L"id"GIVECAMOUFLAGE")
        
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                
cs_set_user_model(idMODEL_TT[random(MODELS_CT)])
            }
            
            else if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
cs_set_user_model(idMODEL_CT[random(MODELS_TT)])
            }
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0})
        
recoil[id] = true
        ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVERECOIL")
        
Timer get_pcvar_num(recoiltime)
        
set_task(0.1"timer_recoil"id)

    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0})
            
recoil[id] = true
            ColorChat
(idGREEN"^x01[AMXX] ^x04%L"id"GIVERECOIL")
            
Timer get_pcvar_num(recoiltime)
            
set_task(0.1"timer_recoil"id)

        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(id1)
             }
         
        else if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_user_spawn(id)
            
cs_set_user_team(id2)
        }
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVERESPAWN")
    }
    
    else if(
is_user_alive(id))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^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(id1)
            }
            
            else if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
cs_user_spawn(id)
                
cs_set_user_team(id2)
            }
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVERESPAWN")
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
}

public 
give_longjump(id)
{
    new 
cost get_pcvar_num(longjumpcost)
    
    if(
kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        
fm_set_user_longjump(idtrue)
        
longjump[id] = true
        Timer 
get_pcvar_num(longjumptime)
        
set_task(0.1"timer_longjump"id)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVELONGJUMP")
        
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
fm_set_user_longjump(idtrue)
            
longjump[id] = true
            Timer 
get_pcvar_num(longjumptime)
            
set_task(0.1"timer_longjump"id)
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVELONGJUMP")             
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(idkills cost)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVERANDOM")
        
randomn[id] = true
        
        
switch (random_num(116))
        {
            case 
1give_noclip(id)
            case 
2:{
                if (
is_user_alive(id))
                {
                    
user_kill(id1)
                    
ColorChat(idRED"^x01[AMXX] ^x03%L"id"KILL")
                }
                }                
            case 
3ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOTHING")
            case 
4:{
                if (
is_user_alive(id))
                {
                    
set_user_frags(idkills cost)
                    
ColorChat(idRED"^x01[AMXX] ^x03%L"id"LOSTFRAG")
                }
                }
            case 
5give_armor(id)
            case 
6give_health(id)
            case 
7give_invis(id)
            case 
8give_god(id)
            case 
9give_camouflage(id)
            case 
10give_onlyhs(id)
            case 
11give_swalk(id)
            case 
12give_speed(id)
            case 
13give_gravity(id)
            case 
14give_recoil(id)
            case 
15give_longjump(id)
            case 
16:{
                if (
is_user_alive(id))
                {
                    if(
money 12000)
                    {
                        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOMONEY")
                    }
                    
                    else
                    {
                        
cs_set_user_money(idrandommoney)
                        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"MONEY")
                    }
                }
                }
        }
    }
    
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.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(2552552550.010.306.012.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(2552552550.010.306.03.0)
        
show_hudmessage(id"Longjump: [Over]")
        
set_task(0.1"remove_longjump"id)
    }
}
            
public 
remove_speed(id)
{    
    if(
speed[id] == true)
    {
        
set_user_maxspeed(id250.0)
        
speed[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVESPEED")
    }
}

public 
remove_gravity(id)
{
    if(
gravity[id] == true)
    {
        
set_user_gravity(id1.0)
        
gravity[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVEGRAVITY")
    }
}

public 
remove_god(id)
{
    if(
godmode[id] == true)
    {
        
set_user_godmode(id0)
        
godmode[id] = false
        set_user_rendering
(idkRenderFxGlowShell000kRenderNormal25)
        
ColorChat(idBLUE"^x01[AMXX] ^x03%L"id"REMOVEGODMODE")
    }
}

public 
remove_invis(id)
{
    if(
invis[id] == true)
    {
        
set_user_rendering(id,kRenderFxNone0,0,0kRenderNormal,255)
        
invis[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVEINVIS")
    }
}

public 
remove_onlyhs(id)
{
    if(
onlyhs[id] == true)
    {
        
set_user_hitzones(00255)
        
onlyhs[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVEONLYHS")
    }
}

public 
remove_swalk(id)
{    
    if(
swalk[id] == true)
    {
        
set_user_footsteps(id0)
        
swalk[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVESWALK")
    }
}

public 
remove_noclip(id)
{    
    if(
noclip[id] == true)
    {
        
set_user_noclip(id0)
        
noclip[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVENOCLIP")
    }
}

public 
remove_camouflage(id)
{
    if(
camouflage[id] == true)
    {
        
cs_reset_user_model(id)
        
camouflage[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVECAMOUFLAGE")
    }
}

public 
remove_recoil(id)
{
    if(
recoil[id] == true)
    {
        
recoil[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVERECOIL")
    }
}

public 
remove_longjump(id)
{
    if(
longjump[id] == true)
    {
        
fm_set_user_longjump(idfalse)
        
longjump[id] = false
        ColorChat
(idBLUE"^x01[AMXX] ^x03%L"id"REMOVELONGJUMP")
    }
}

public 
frags(id)
{
    if(
is_user_alive(id))
    {
        
ColorChat(idBLUE"^x01[AMXX] ^x04%L"id"FRAGS"get_user_frags(id))
    }
}

public 
event_round_start()
{
    for (new 
id 1id <= g_maxplayersid++) 
    {
    if(!
is_user_alive(id)) continue;
    
    if (
camouflage[id] == trueremove_camouflage(id)
    if (
godmode[id] == trueremove_god(id)
    if (
gravity[id] == trueremove_gravity(id)
    if (
invis[id] == trueremove_invis(id)
    if (
noclip[id] == trueremove_noclip(id)
    if(
onlyhs[id] == trueremove_onlyhs(id)
    if (
speed[id] == trueremove_speed(id)
    if (
swalk[id] == trueremove_swalk(id)
    if (
longjump[id] == trueremove_longjump(id)
    if (
recoil[id] == trueremove_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(idkRenderFxGlowShell000kRenderNormal25)
    
inmenu[id] = false
    
}
}  

public 
change_weapon(id

    if(
speed[id]) 
    { 
        
set_user_maxspeed(idget_pcvar_float(speedmax))
    } 
    
    if (
recoil[id])
    {
        
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0})
    }    
}

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

public checkstuck() {
    if(
get_pcvar_num(cvar[0]) >= 1) {
        static 
players[32], pnumplayer
        get_players
(playerspnum)
        static 
Float:origin[3]
        static 
Float:mins[3], hull
        
static Float:vec[3]
        static 
o,i
        
for(i=0i<pnumi++){
            
player players[i]
            if (
is_user_connected(player) && is_user_alive(player)) {
                
pev(playerpev_originorigin)
                
hull pev(playerpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN
                
if (!is_hull_vacant(originhull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
                    ++
stuck[player]
                    if(
stuck[player] >= get_pcvar_num(cvar[1])) {
                        
pev(playerpev_minsmins)
                        
vec[2] = origin[2]
                        for (
o=0sizeof 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(vechull,player)) {
                                
engfunc(EngFunc_SetOriginplayervec)
                                
effects(player)
                                
set_pev(player,pev_velocity,{0.0,0.0,0.0})
                                
sizeof size
                            
}
                        }
                    }
                }
                else
                {
                    
stuck[player] = 0
                
}
            }
        }
    }
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
    static 
tr
    engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
    if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_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.00.6506.01.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(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
        return 
FMRES_IGNORED;
    
createNPC(id);
    return 
FMRES_HANDLED;
}

public 
tryRemoveNPC(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
        return 
FMRES_IGNORED;
    
removeNPC(id);
    return 
FMRES_HANDLED;
}

public 
loadNPC()
    
createNPC(0);

public 
createNPC(id)
{    
    if(
npcMade && pev_valid(g_npc))
    {
        
engfunc(EngFunc_RemoveEntityg_npc);
        
engfunc(EngFunc_RemoveEntityg_weapon);
    }
    
npcMade true;
    
    new 
Float:origin[3], Float:angles[3];
    if(
id 0)
    {
        
pev(idpev_originorigin);
        
pev(idpev_anglesangles);
    }
    else
    {
        new 
file fopen(filename"r");
        if(
file)
        {
            
// File exists
            
new data[128];
            new 
i;
            
            while(!
feof(file))
            {
                
fgets(filedata127);
                if(
<= 2// Line 1-3 = origin
                
{
                    
origin[i] = str_to_float(data);
                }
                else if(
== 3angles[0] = str_to_float(data);
                else if(
== 4angles[1] = str_to_float(data);
                else if(
== 5angles[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_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
    
engfunc(EngFunc_SetModelg_npcnpcModel);
    
engfunc(EngFunc_SetSizeg_npcFloat:{-0.0,-0.0,-55.0}, Float:{10.0,10.0,36.0});
    
angles[0] = 0.0;
    
set_pev(g_npcpev_anglesangles);
    
    
engfunc(EngFunc_SetOriging_npcorigin);
    
    if(
id 0)
    {
        
origin[2] += 80;
        
engfunc(EngFunc_SetOriginidorigin);
    }
    
    
set_pev(g_npcpev_solidSOLID_BBOX);
    
//set_pev(g_npc, pev_movetype, MOVETYPE_TOSS);
    
set_pev(g_npcpev_classname"shacks_npc");
    
    
// Set the default animation
    
set_pev(g_npcpev_animtime2.0);
    
set_pev(g_npcpev_framerate1.0);
    
set_pev(g_npcpev_sequence1);
    
    
// Set bone positions
    
set_pev(g_npcpev_controller_0125);
    
set_pev(g_npcpev_controller_1125);
    
set_pev(g_npcpev_controller_2125);
    
set_pev(g_npcpev_controller_3125);
    
    
// Set damage and hp
    
set_pev(g_npcpev_takedamage0.0);
    
    
// Drop to ground?
    
engfunc(EngFunc_DropToFloorg_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(idprint_chat"The NPC has been created and saved.");
        }
    }
    
    return 
FMRES_HANDLED;
}

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

public 
give_item1(ent)
{
    
g_weapon engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
set_pev(g_weaponpev_classname"npc_weapon");
    
set_pev(g_weaponpev_solidSOLID_NOT);
    
set_pev(g_weaponpev_movetypeMOVETYPE_FOLLOW);
    
set_pev(g_weaponpev_aimentent);
    
set_pev(g_weaponpev_sequence1);




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

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