Raised This Month: $ Target: $400
 0% 

Can anyone help fix this plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KhaledAwesome
Member
Join Date: Jul 2013
Old 05-14-2020 , 06:38   Can anyone help fix this plugin?
Reply With Quote #1

This plugin has some problems in compiling, is it anything serious? It does compile tho,

anyone know how to fix?
https://forums.alliedmods.net/showthread.php?t=86375

https://imgur.com/tFOvitI
couldn't put it in attachments


Quote:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>





#define PLUGIN "weapon box"
#define AUTHOR "apocalips"
#define VERSION "0.3"



new munitieModel[] = "models/ammo4.mdl"
new aimVector[3]


new explode
new Float:g_origin[33][3];
new Float:nr_bullets[33];

new projectile_MODEL[] = "models/projectile.mdl";
new projectile_SOUND[] = "ar2laungher.wav";





new open_box[] = "open_box.wav";

new VIEW_MODEL[] = "models/v_ar2.mdl"
new PLAYER_MODEL[] = "models/p_ar2.mdl"

new munitieEnt
new box_file[200]
new Configsdir[200]




public plugin_precache()
{
precache_model(munitieModel)

precache_model(VIEW_MODEL)
precache_model(PLAYER_MODEL)

explode = precache_model("sprites/zerogxplode33.spr")
engfunc(EngFunc_PrecacheModel, projectile_MODEL);
engfunc(EngFunc_PrecacheSound, projectile_SOUND);
engfunc(EngFunc_PrecacheSound, open_box);


}



public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("munitie_spawn","create",ADMIN _SLAY,"")
register_clcmd("remove","delet_munitie",ADMIN _SLAY,"")
register_clcmd("removeall","delet_munitie_all ",ADMIN_SLAY,"")

register_forward(FM_Touch,"fw_touch");
register_menucmd(register_menuid("\yweapons:" ), 1023, "menu_command" );


register_forward(FM_Touch,"plasma_interact");
register_event("CurWeapon", "Event_CurWeapon", "be","1=1")


set_task(1.0,"map_load_weapon_box")



}



public create(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED


set_task( 1.0 , "lada_munitie" , id )

}








public lada_munitie(id)
{



new Floatrigin[3]
new Float:angles[3]
new Float:v_angle[3]

entity_get_vector(id,EV_VEC_v_angle,v_angle)
entity_get_vector(id,EV_VEC_angles,angles)




munitieEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));


set_pev(munitieEnt, pev_classname, "munitie");
get_user_origin(id, aimVector, 3) //where the player is aiming


IVecFVec(aimVector, origin); //covert aim origin(int) to float.


set_pev(munitieEnt, pev_origin, origin);

engfunc(EngFunc_SetModel, munitieEnt, munitieModel);

set_pev(munitieEnt,pev_solid,SOLID_BBOX);



new Float:vRetVector[3]
entity_get_vector(id, EV_VEC_v_angle, vRetVector)
vRetVector[0]=float(0)
entity_set_vector(munitieEnt, EV_VEC_angles, vRetVector)



if( ((vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
{
engfunc(EngFunc_SetSize, munitieEnt, Float:{-30.0, -20.0, -90.0}, Float:{30.0, 20.0, 90.0} )
}
else
{
engfunc(EngFunc_SetSize, munitieEnt, Float:{-20.0, -30.0, -90.0}, Float:{20.0, 30.0, 90.0} )
}









get_configsdir( Configsdir, 199 )
format(box_file, 199, "%s/weapon_box.ini", Configsdir )





new mapname[32]
new string[16]
get_mapname(mapname,31)
format(mapname,31,"[%s]",mapname)
write_file(box_file,mapname,-1)



format(string,15,"%f",origin[0])
write_file(box_file,string,-1)
format(string,15,"%f",origin[1])
write_file(box_file,string,-1)
format(string,15,"%f",origin[2])
write_file(box_file,string,-1)
format(string,15,"%f",angles[0])
write_file(box_file,string,-1)
format(string,15,"%f",angles[1])
write_file(box_file,string,-1)
format(string,15,"%f",angles[2])
write_file(box_file,string,-1)
format(string,15,"%f",v_angle[0])
write_file(box_file,string,-1)
format(string,15,"%f",v_angle[1])
write_file(box_file,string,-1)
format(string,15,"%f",v_angle[2])
write_file(box_file,string,-1)




return PLUGIN_HANDLED
}










public map_load_weapon_box(id)
{




new mapname[32]
get_mapname(mapname,31)
format(mapname,31,"[%s]",mapname)
get_configsdir( Configsdir, 199 )
format(box_file, 199, "%s/weapon_box.ini", Configsdir )
new read[32], trash


new Floatrigin[3], Float:angles[3], Float:v_angle[3]





if(file_exists(box_file))
{



for(new i=0;i<file_size(box_file,1);i++)
{


read_file(box_file,i,read,31,trash)
if(equali(read,mapname))
{
i++




read_file(box_file,i,read,31,trash)
origin[0] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
origin[1] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
origin[2] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
angles[0] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
angles[1] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
angles[2] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
v_angle[0] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
v_angle[1] = str_to_float(read)
i++
read_file(box_file,i,read,31,trash)
v_angle[2] = str_to_float(read)

v_angle[0] = 0.000000






munitieEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));


set_pev(munitieEnt, pev_classname, "munitie");

set_pev(munitieEnt, pev_origin, origin);

engfunc(EngFunc_SetModel, munitieEnt, munitieModel);

set_pev(munitieEnt,pev_solid,SOLID_BBOX);

entity_set_vector(munitieEnt, EV_VEC_angles, v_angle)


new Float:vRetVector[3]
entity_get_vector(id, EV_VEC_v_angle, vRetVector)





if( ((vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
{
engfunc(EngFunc_SetSize, munitieEnt, Float:{-30.0, -20.0, -90.0}, Float:{30.0, 20.0, 90.0} )
}
else
{
engfunc(EngFunc_SetSize, munitieEnt, Float:{-20.0, -30.0, -90.0}, Float:{20.0, 30.0, 90.0} )
}



}
}
}
}












public close_box(param[2])
{
new munitieEnt = param[0];


if(!pev_valid(munitieEnt))
return FMRES_IGNORED;


set_pev(munitieEnt, pev_sequence, 4);
set_pev(munitieEnt, pev_framerate, 1.0);

}



public fw_touch(id,munitieEnt)
{



if(!pev_valid(munitieEnt))
return FMRES_IGNORED;

new classname[32]
pev(munitieEnt,pev_classname,classname,31)

if(!equal(classname, "munitie"))
return FMRES_IGNORED;




if(is_user_connected(id) && is_user_alive(id))
{

new team = get_user_team(id);

if(team == 1)
return FMRES_IGNORED;



set_pev(munitieEnt, pev_sequence, 1);
set_pev(munitieEnt, pev_framerate, 1.0);

emit_sound( id, CHAN_AUTO, open_box, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );



new weapon = get_user_weapon(id)



switch(weapon)
{
case CSW_M4A1,CSW_SG552,CSW_FAMAS,CSW_GALIL,CSW_SG 550,CSW_AUG: fm_give_item(id, "ammo_556nato");
case CSW_XM1014,CSW_M3: fm_give_item(id, "ammo_buckshot");
case CSW_MAC10,CSW_UMP45: fm_give_item(id, "ammo_45acp");
case CSW_MP5NAVY,CSW_TMP: fm_give_item(id, "ammo_9mm");
case CSW_P90: fm_give_item(id, "ammo_57mm");
case CSW_AWP: fm_give_item(id, "ammo_338magnum");
case CSW_M249: fm_give_item(id, "ammo_556natobox");
case CSW_G3SG1,CSW_AK47: fm_give_item(id, "ammo_762nato");




default:
{

if(weapon == CSW_DEAGLE,CSW_FIVESEVEN,CSW_KNIFE,CSW_GLOCK1 8,CSW_ELITE,CSW_P228,CSW_USP)
{


switch(weapon)
{
case CSW_DEAGLE: fm_give_item(id, "ammo_50ae");
case CSW_P228: fm_give_item(id, "ammo_357sig");
case CSW_ELITE,CSW_GLOCK18: fm_give_item(id, "ammo_9mm");
case CSW_FIVESEVEN: fm_give_item(id, "ammo_57mm");
case CSW_USP: fm_give_item(id, "ammo_45acp");

}




new szMenuBody[256];
new keys;

new nLen = format( szMenuBody, 255, "\yweapons:^n" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. xm1014" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. aug" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. awp" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. m249" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. m3" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. m4a1" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. g3sg1" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. ak47" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. ar2" );
nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" );

keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8 |1<<9)

show_menu( id, keys, szMenuBody, -1 );



}
}
}


new param[2];
param[0] = munitieEnt;

set_task(2.0, "close_box", 1234, param, 2);


}
return FMRES_IGNORED;
}



public menu_command(id,key)
{

switch( key )
{
case 0: {
fm_give_item(id, "weapon_xm1014")

}
case 1: {
fm_give_item(id, "weapon_aug")

}
case 2: {
fm_give_item(id, "weapon_awp")

}
case 3: {
fm_give_item(id, "weapon_m249")

}
case 4: {
fm_give_item(id, "weapon_m3")

}
case 5: {
fm_give_item(id, "weapon_m4a1")

}
case 6: {
fm_give_item(id, "weapon_g3sg1")

}
case 7: {
fm_give_item(id, "weapon_ak47")

}
case 8: {
fm_give_item(id, "weapon_p90")

}




}
}






public delet_munitie(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED


new body;

get_user_aiming(id, munitieEnt, body);


new classname[32]
pev(munitieEnt,pev_classname,classname,31)

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

fm_remove_entity(munitieEnt);

client_print(id,print_chat,"[AMXX] removed weapon box !");
}

return FMRES_IGNORED;

}



public delet_munitie_all(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED



new ammo = -1;
while ((ammo = fm_find_ent_by_class(ammo, "munitie")))
engfunc(EngFunc_RemoveEntity, ammo);

client_print(id,print_chat,"[AMXX] You removed all weapon box !");

}


////////////////////////////
// weapon ar2 (hl2) //



public client_PreThink(id)
{

new weapon = get_user_weapon(id)
if(weapon == CSW_P90)
{

if(get_user_button(id) & IN_ATTACK2)
{
ar2_plasma(id);

}

}
}


public ar2_plasma(id)
{

new Float:nexTime = get_gametime();
if(nr_bullets[id] > nexTime)
{
return PLUGIN_CONTINUE;
}
else
{


new Float:StartOrigin[3], Float:Angle[3]

new PlayerOrigin[3]
get_user_origin(id, PlayerOrigin, 1)

StartOrigin[0] = float(PlayerOrigin[0])
StartOrigin[1] = float(PlayerOrigin[1])
StartOrigin[2] = float(PlayerOrigin[2])

entity_get_vector(id, EV_VEC_v_angle, Angle)
Angle[0] = Angle[0] * -1.0
new ar2_plasm = create_entity("info_target")
entity_set_string(ar2_plasm, EV_SZ_classname, "plasma_classname")
entity_set_model(ar2_plasm, "models/projectile.mdl")
entity_set_origin(ar2_plasm, StartOrigin)
entity_set_vector(ar2_plasm, EV_VEC_angles, Angle)

new Float:MinBox[3] = {-1.0, -1.0, -1.0}
new Float:MaxBox[3] = {1.0, 1.0, 1.0}
entity_set_vector(ar2_plasm, EV_VEC_mins, MinBox)
entity_set_vector(ar2_plasm, EV_VEC_maxs, MaxBox)

entity_set_int(ar2_plasm, EV_INT_solid, 2)
entity_set_int(ar2_plasm, EV_INT_movetype, 5)
entity_set_edict(ar2_plasm, EV_ENT_owner, id)

new Float:Velocity[3]
VelocityByAim(id, 1000, Velocity)
entity_set_vector(ar2_plasm, EV_VEC_velocity, Velocity)



client_cmd(id, "spk ^"%s^"",projectile_SOUND)

nr_bullets[id] = nexTime + 20.0;
}

}


public plasma_interact(ar2_plasm,other)
{

if(!pev_valid(ar2_plasm))
return FMRES_IGNORED;

new classname[32]
pev(ar2_plasm,pev_classname,classname,31)

if(!equal(classname, "plasma_classname"))
return FMRES_IGNORED;

remove_task(ar2_plasm)


new Float:fOrigin[3]
new iOrigin[3]

entity_get_vector(ar2_plasm, EV_VEC_origin, fOrigin)

FVecIVec(fOrigin, iOrigin)

message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iO rigin);
write_byte(TE_EXPLOSION);
write_coord(iOrigin[0]);
write_coord(iOrigin[1]);
write_coord(iOrigin[2]);
write_short(explode);
write_byte(30);
write_byte(15);
write_byte(0);
message_end();


RadiusDamage(fOrigin, 15, 10)

remove_entity(ar2_plasm)


if(is_user_connected(other))
{
user_kill(other, 0)
}

}


public Event_CurWeapon(id)
{

new weaponID = read_data(2)

if(weaponID != CSW_P90)
return PLUGIN_CONTINUE

set_pev(id, pev_viewmodel2, VIEW_MODEL)
set_pev(id, pev_weaponmodel2, PLAYER_MODEL)

}



/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Last edited by KhaledAwesome; 05-14-2020 at 06:43.
KhaledAwesome is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-14-2020 , 07:12   Re: Can anyone help fix this plugin?
Reply With Quote #2

nexttime:
HTML Code:
register_clcmd ("amx_mycommand", "MyFunction", ADMIN_KICK, "Description of the command")
This code is so messy, I don't even know if it's going to work for you.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>



#define PLUGIN "weapon box"
#define AUTHOR "apocalips"
#define VERSION "0.3"

new munitieModel[] = "models/ammo4.mdl"
new aimVector[3]

new 
explode
new Float:g_origin[33][3];
new 
Float:nr_bullets[33];

new 
projectile_MODEL[] = "models/projectile.mdl";
new 
projectile_SOUND[] = "ar2laungher.wav";

new 
open_box[] = "open_box.wav";

new 
VIEW_MODEL[] = "models/v_ar2.mdl"
new PLAYER_MODEL[] = "models/p_ar2.mdl"

new munitieEnt
new box_file[200]
new 
Configsdir[200]

public 
plugin_precache()
{
    
precache_model(munitieModel)
    
    
precache_model(VIEW_MODEL)
    
precache_model(PLAYER_MODEL)
    
    
explode precache_model("sprites/zerogxplode33.spr")
    
engfunc(EngFunc_PrecacheModelprojectile_MODEL);
    
engfunc(EngFunc_PrecacheSoundprojectile_SOUND);
    
engfunc(EngFunc_PrecacheSoundopen_box);
    
    
}



public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("munitie_spawn","create"ADMIN_SLAY"Description of the command")
    
//register_clcmd ("amx_mycommand", "MyFunction", ADMIN_KICK, "Description of the command")
    
register_clcmd("remove","delet_munitie"ADMIN_SLAY"Description of the command")
    
register_clcmd("removeall","delet_munitie_all ",ADMIN_SLAY,"")
    
    
register_forward(FM_Touch,"fw_touch");
    
register_menucmd(register_menuid("\yweapons:" ), 1023"menu_command" );
    
    
    
register_forward(FM_Touch,"plasma_interact");
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
    
    
set_task(1.0,"map_load_weapon_box")
    
    
    
}



public 
create(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    
    set_task
1.0 "lada_munitie" id )
    
}








public 
lada_munitie(id)
{
    
    
    
    new 
Floatrigin[3]
    new 
Float:angles[3]
    new 
Float:v_angle[3]
    
    
entity_get_vector(id,EV_VEC_v_angle,v_angle)
    
entity_get_vector(id,EV_VEC_angles,angles)
    
    
munitieEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
    
    
    
set_pev(munitieEntpev_classname"munitie");
    
get_user_origin(idaimVector3//where the player is aiming
    
    
IVecFVec(aimVectorFloatrigin); //covert aim origin(int) to float.
    
set_pev(munitieEntpev_originFloatrigin);
    
    
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
    
    
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
    
    
    
    new 
Float:vRetVector[3]
    
entity_get_vector(idEV_VEC_v_anglevRetVector)
    
vRetVector[0]=float(0)
    
entity_set_vector(munitieEntEV_VEC_anglesvRetVector)
    
    
    
    if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
    {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
    }
    else
    {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
    }
    
    
    
    
    
    
    
    
    
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    
    
    
    
    
    new 
mapname[32]
    new 
string[16]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
write_file(box_file,mapname,-1)
    
    
    
    
format(string,15,"%f",Floatrigin[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",Floatrigin[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",Floatrigin[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[2])
    
write_file(box_file,string,-1)
    
    
    
    
    return 
PLUGIN_HANDLED
}










public 
map_load_weapon_box(id)
{
    
    
    
    
    new 
mapname[32]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    new 
read[32], trash
    
    
    
new Floatrigin[3], Float:angles[3], Float:v_angle[3]
    
    
    
    
    
    if(
file_exists(box_file))
    {
        
        
        
        for(new 
i=0;i<file_size(box_file,1);i++)
        {
            
            
            
read_file(box_file,i,read,31,trash)
            if(
equali(read,mapname))
            {
                
i++
                
                
                
                
                
read_file(box_file,i,read,31,trash)
                
Floatrigin[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
Floatrigin[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
Floatrigin[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[2] = str_to_float(read)
                
                
v_angle[0] = 0.000000
                
                
                
                
                
                
                munitieEnt 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
                
                
                
set_pev(munitieEntpev_classname"munitie");
                
                
set_pev(munitieEntpev_originFloatrigin);
                
                
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
                
                
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
                
                
entity_set_vector(munitieEntEV_VEC_anglesv_angle)
                
                
                new 
Float:vRetVector[3]
                
entity_get_vector(idEV_VEC_v_anglevRetVector)
                
                
                
                
                
                if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
                }
                else
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
                }
                
                
                
            }
        }
    }
}












public 
close_box(param[2])
{
    new 
munitieEnt param[0];
    
    
    if(!
pev_valid(munitieEnt))
        return 
FMRES_IGNORED;
    
    
    
set_pev(munitieEntpev_sequence4);
    
set_pev(munitieEntpev_framerate1.0);
    
}



public 
fw_touch(id,munitieEnt)
{
    
    
    
    if(!
pev_valid(munitieEnt))
        return 
FMRES_IGNORED;
    
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    
    if(!
equal(classname"munitie"))
        return 
FMRES_IGNORED;
    
    
    
    
    if(
is_user_connected(id) && is_user_alive(id))
    {
        
        new 
team get_user_team(id);
        
        if(
team == 1)
            return 
FMRES_IGNORED;
        
        
        
        
set_pev(munitieEntpev_sequence1);
        
set_pev(munitieEntpev_framerate1.0);
        
        
emit_soundidCHAN_AUTOopen_boxVOL_NORMATTN_NORM0PITCH_NORM );
        
        
        
        new 
weapon get_user_weapon(id)
        
        
        
        switch(
weapon)
        {
                case 
CSW_M4A1,CSW_SG552,CSW_FAMAS,CSW_GALIL,CSW_SG550,CSW_AUGfm_give_item(id"ammo_556nato");
                case 
CSW_XM1014,CSW_M3fm_give_item(id"ammo_buckshot");
                case 
CSW_MAC10,CSW_UMP45fm_give_item(id"ammo_45acp");
                case 
CSW_MP5NAVY,CSW_TMPfm_give_item(id"ammo_9mm");
                case 
CSW_P90fm_give_item(id"ammo_57mm");
                case 
CSW_AWPfm_give_item(id"ammo_338magnum");
                case 
CSW_M249fm_give_item(id"ammo_556natobox");
                case 
CSW_G3SG1,CSW_AK47fm_give_item(id"ammo_762nato");
                
            
            
            
            default:
        {
            
            if(
weapon == CSW_DEAGLE,CSW_FIVESEVEN,CSW_KNIFE,CSW_GLOCK18,CSW_ELITE,CSW_P228,CSW_USP)
            {
                
                
                switch(
weapon)
                {
                    case 
CSW_DEAGLEfm_give_item(id"ammo_50ae");
                        case 
CSW_P228fm_give_item(id"ammo_357sig");
                            case 
CSW_ELITE,CSW_GLOCK18fm_give_item(id"ammo_9mm");
                            case 
CSW_FIVESEVENfm_give_item(id"ammo_57mm");
                            case 
CSW_USPfm_give_item(id"ammo_45acp");
                            
                    }
                    
                    
                    
                    
                    new 
szMenuBody[256];
                    new 
keys;
                    
                    new 
nLen formatszMenuBody255"\yweapons:^n" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w1. xm1014" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w2. aug" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w3. awp" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w4. m249" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w5. m3" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w6. m4a1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w7. g3sg1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w8. ak47" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\w9. ar2" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\w0. Exit" );
                    
                    
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<|1<<9)
                    
                    
show_menuidkeysszMenuBody, -);
                    
                    
                    
                }
            }
        }
        
        
        new 
param[2];
        
param[0] = munitieEnt;
        
        
set_task(2.0"close_box"1234param2);
        
        
    }
    return 
FMRES_IGNORED;
}



public 
menu_command(id,key)
{
    
    switch( 
key )
    {
        case 
0: {
            
fm_give_item(id"weapon_xm1014")
            
        }
        case 
1: {
            
fm_give_item(id"weapon_aug")
            
        }
        case 
2: {
            
fm_give_item(id"weapon_awp")
            
        }
        case 
3: {
            
fm_give_item(id"weapon_m249")
            
        }
        case 
4: {
            
fm_give_item(id"weapon_m3")
            
        }
        case 
5: {
            
fm_give_item(id"weapon_m4a1")
            
        }
        case 
6: {
            
fm_give_item(id"weapon_g3sg1")
            
        }
        case 
7: {
            
fm_give_item(id"weapon_ak47")
            
        }
        case 
8: {
            
fm_give_item(id"weapon_p90")
            
        }
        
        
        
        
    }
}






public 
delet_munitie(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    
    
new body;
    
    
get_user_aiming(idmunitieEntbody);
    
    
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    
    if (
equali(classname"munitie"))
    {
        
        
fm_remove_entity(munitieEnt);
        
        
client_print(id,print_chat,"[AMXX] removed weapon box !");
    }
    
    return 
FMRES_IGNORED;
    
}



public 
delet_munitie_all(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    
    
    
new ammo = -1;
    while ((
ammo fm_find_ent_by_class(ammo"munitie")))
        
engfunc(EngFunc_RemoveEntityammo);
    
    
client_print(id,print_chat,"[AMXX] You removed all weapon box !");
    
}


////////////////////////////
// weapon ar2 (hl2) //



public client_PreThink(id)
{
    
    new 
weapon get_user_weapon(id)
    if(
weapon == CSW_P90)
    {
        
        if(
get_user_button(id) & IN_ATTACK2)
        {
            
ar2_plasma(id);
            
        }
        
    }
}


public 
ar2_plasma(id)
{
    
    new 
Float:nexTime get_gametime();
    if(
nr_bullets[id] > nexTime)
    {
        return 
PLUGIN_CONTINUE;
    }
    else
    {
        
        
        new 
Float:StartOrigin[3], Float:Angle[3]
        
        new 
PlayerOrigin[3]
        
get_user_origin(idPlayerOrigin1)
        
        
StartOrigin[0] = float(PlayerOrigin[0])
        
StartOrigin[1] = float(PlayerOrigin[1])
        
StartOrigin[2] = float(PlayerOrigin[2])
        
        
entity_get_vector(idEV_VEC_v_angleAngle)
        
Angle[0] = Angle[0] * -1.0
        
new ar2_plasm create_entity("info_target")
        
entity_set_string(ar2_plasmEV_SZ_classname"plasma_classname")
        
entity_set_model(ar2_plasm"models/projectile.mdl")
        
entity_set_origin(ar2_plasmStartOrigin)
        
entity_set_vector(ar2_plasmEV_VEC_anglesAngle)
        
        new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
        new 
Float:MaxBox[3] = {1.01.01.0}
        
entity_set_vector(ar2_plasmEV_VEC_minsMinBox)
        
entity_set_vector(ar2_plasmEV_VEC_maxsMaxBox)
        
        
entity_set_int(ar2_plasmEV_INT_solid2)
        
entity_set_int(ar2_plasmEV_INT_movetype5)
        
entity_set_edict(ar2_plasmEV_ENT_ownerid)
        
        new 
Float:Velocity[3]
        
VelocityByAim(id1000Velocity)
        
entity_set_vector(ar2_plasmEV_VEC_velocityVelocity)
        
        
        
        
client_cmd(id"spk ^"%s^"",projectile_SOUND)
        
        
nr_bullets[id] = nexTime 20.0;
    }
    
}


public 
plasma_interact(ar2_plasm,other)
{
    
    if(!
pev_valid(ar2_plasm))
        return 
FMRES_IGNORED;
    
    new 
classname[32]
    
pev(ar2_plasm,pev_classname,classname,31)
    
    if(!
equal(classname"plasma_classname"))
        return 
FMRES_IGNORED;
    
    
remove_task(ar2_plasm)
    
    
    new 
Float:fOrigin[3]
    new 
iOrigin[3]
    
    
entity_get_vector(ar2_plasmEV_VEC_originfOrigin)
    
    
FVecIVec(fOriginiOrigin)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin);
    
write_byte(TE_EXPLOSION);
    
write_coord(iOrigin[0]);
    
write_coord(iOrigin[1]);
    
write_coord(iOrigin[2]);
    
write_short(explode);
    
write_byte(30);
    
write_byte(15);
    
write_byte(0);
    
message_end();
    
    
    
RadiusDamage(fOrigin1510)
    
    
remove_entity(ar2_plasm)
    
    
    if(
is_user_connected(other))
    {
        
user_kill(other0)
    }
    
}


public 
Event_CurWeapon(id)
{
    
    new 
weaponID read_data(2)
    
    if(
weaponID != CSW_P90)
        return 
PLUGIN_CONTINUE
    
    set_pev
(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    
}



/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-14-2020 , 07:35   Re: Can anyone help fix this plugin?
Reply With Quote #3

I don't see any errors. Those are warning and are not going to bother the plugin in any way. If you read what they say, you should know how to fix them. Indent your code properly and return values in the end of every function if you already used a return value in that function.

Also, that is not a code block, it's a quote block. Use [code] tags when pasting codes in the forum. You destroyed all indentation by using a [quote] tag and made people scroll for no reason.
__________________

Last edited by OciXCrom; 05-14-2020 at 07:36.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-15-2020 , 08:25   Re: Can anyone help fix this plugin?
Reply With Quote #4

Quote:
Originally Posted by KhaledAwesome View Post
This plugin has some problems in compiling, is it anything serious? It does compile tho,

anyone know how to fix?
https://forums.alliedmods.net/showthread.php?t=86375

https://imgur.com/tFOvitI
couldn't put it in attachments
I HAVE FIXED MANY THINGS IN THIS PLUGIN, There's 9 warnings But the plugin will working without any problem

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>

new munitieModel[] = "models/ammo4.mdl"
new aimVector[3]

new 
explode
new Float:g_origin[33][3];
new 
Float:nr_bullets[33];

new 
projectile_MODEL[] = "models/projectile.mdl";
new 
projectile_SOUND[] = "ar2laungher.wav";

new 
open_box[] = "open_box.wav";

new 
VIEW_MODEL[] = "models/v_ar2.mdl"
new PLAYER_MODEL[] = "models/p_ar2.mdl"

new munitieEnt
new box_file[200]
new 
Configsdir[200]

public 
plugin_precache() {
    
precache_model(munitieModel);
    
precache_model(VIEW_MODEL);
    
precache_model(PLAYER_MODEL);
    
engfunc(EngFunc_PrecacheModelprojectile_MODEL);
    
engfunc(EngFunc_PrecacheSoundprojectile_SOUND);
    
engfunc(EngFunc_PrecacheSoundopen_box);
    
    
explode precache_model("sprites/zerogxplode33.spr")
}

public 
plugin_init() {
    
register_plugin("weapon box""0.3""apocalips");
    
register_clcmd("munitie_spawn","create",ADMIN_SLAY,"");
    
register_clcmd("remove","delet_munitie",ADMIN_SLAY,"");
    
register_clcmd("removeall","delet_munitie_all ",ADMIN_SLAY,"");
    
register_forward(FM_Touch,"fw_touch");
    
register_menucmd(register_menuid("\yweapons:" ), 1023"menu_command" );
    
register_forward(FM_Touch,"plasma_interact");
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
    
set_task(1.0,"map_load_weapon_box")
}

public 
create(id,level,cid) {
    if(!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED;
    
set_task1.0 "lada_munitie" id )
}


public 
lada_munitie(id) {
    new 
Float:origin[3]
    new 
Float:angles[3]
    new 
Float:v_angle[3]
    
    
entity_get_vector(id,EV_VEC_v_angle,v_angle)
    
entity_get_vector(id,EV_VEC_angles,angles)
    
    
munitieEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
    
    
set_pev(munitieEntpev_classname"munitie");
    
get_user_origin(idaimVector3//where the player is aiming
    
IVecFVec(aimVectororigin); //covert aim origin(int) to float.
    
    
set_pev(munitieEntpev_originorigin);
    
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
    
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
    
    new 
Float:vRetVector[3]
    
entity_get_vector(idEV_VEC_v_anglevRetVector)
    
vRetVector[0]=float(0)
    
entity_set_vector(munitieEntEV_VEC_anglesvRetVector)
    
    if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) ) {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
    }
    else
    {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
    }
    
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    
    new 
mapname[32]
    new 
string[16]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
write_file(box_file,mapname,-1)
    
    
format(string,15,"%f",origin[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",origin[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",origin[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[2])
    
write_file(box_file,string,-1)
    
    return 
PLUGIN_HANDLED;

}

public 
map_load_weapon_box(id) {
    new 
mapname[32]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    new 
read[32], trash
    
new Floatrigin[3], Float:angles[3], Float:v_angle[3], Float:origin[3]
    
    if(
file_exists(box_file))
    {
        for(new 
i=0;i<file_size(box_file,1);i++)
        {
            
read_file(box_file,i,read,31,trash)
            if(
equali(read,mapname))
            {
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[2] = str_to_float(read)
                
v_angle[0] = 0.000000
                
                munitieEnt 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
                
set_pev(munitieEntpev_classname"munitie");
                
set_pev(munitieEntpev_originorigin);
                
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
                
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
                
entity_set_vector(munitieEntEV_VEC_anglesv_angle);
                new 
Float:vRetVector[3]
                
entity_get_vector(idEV_VEC_v_anglevRetVector)
                
                if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
                }
                else
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
                }

            }
        }
    }
}

public 
close_box(param[2]) {
    new 
munitieEnt param[0];
    if(!
pev_valid(munitieEnt))
    return 
FMRES_IGNORED;
    
    
set_pev(munitieEntpev_sequence4);
    
set_pev(munitieEntpev_framerate1.0);

}

public 
fw_touch(id,munitieEnt) {
    if(!
pev_valid(munitieEnt))
    return 
FMRES_IGNORED;
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    if(!
equal(classname"munitie"))
    return 
FMRES_IGNORED;
    
    if(
is_user_connected(id) && is_user_alive(id))
    {
        new 
team get_user_team(id);
        if(
team == 1)
        return 
FMRES_IGNORED;
        
set_pev(munitieEntpev_sequence1);
        
set_pev(munitieEntpev_framerate1.0);
        
emit_soundidCHAN_AUTOopen_boxVOL_NORMATTN_NORM0PITCH_NORM );
        new 
weapon get_user_weapon(id)
        
        switch(
weapon)
        {
            case 
CSW_M4A1CSW_SG552CSW_FAMASCSW_GALILCSW_SG550CSW_AUGfm_give_item(id"ammo_556nato");
            case 
CSW_XM1014CSW_M3fm_give_item(id"ammo_buckshot");
            case 
CSW_MAC10CSW_UMP45fm_give_item(id"ammo_45acp");
            case 
CSW_MP5NAVYCSW_TMPfm_give_item(id"ammo_9mm");
            case 
CSW_P90fm_give_item(id"ammo_57mm");
            case 
CSW_AWPfm_give_item(id"ammo_338magnum");
            case 
CSW_M249fm_give_item(id"ammo_556natobox");
            case 
CSW_G3SG1CSW_AK47fm_give_item(id"ammo_762nato");
            
            default:
            {
                if(
weapon == CSW_DEAGLECSW_FIVESEVENCSW_KNIFECSW_GLOCK18CSW_ELITECSW_P228CSW_USP)
                {
                    switch(
weapon)
                    {
                        case 
CSW_DEAGLEfm_give_item(id"ammo_50ae");
                        case 
CSW_P228fm_give_item(id"ammo_357sig");
                        case 
CSW_ELITECSW_GLOCK18fm_give_item(id"ammo_9mm");
                        case 
CSW_FIVESEVENfm_give_item(id"ammo_57mm");
                        case 
CSW_USPfm_give_item(id"ammo_45acp");
                    }
                    
                    new 
szMenuBody[256];
                    new 
keys;
                    new 
nLen formatszMenuBody255"\yweapons:^n" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r1.\w xm1014" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r2.\w aug" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r3.\w awp" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r4.\w m249" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r5.\w m3" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r6.\w m4a1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r7.\w g3sg1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r8.\w ak47" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r9.\w ar2" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\r0.\w Exit" );
                    
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<|1<<9)
                    
show_menuidkeysszMenuBody, -);

                }
            }


        }
        new 
param[2];
        
param[0] = munitieEnt;
        
set_task(2.0"close_box"1234param2);

    }
    return 
FMRES_IGNORED;    
}


public 
menu_command(id,key) {
    switch( 
key )
    {
        case 
0: { 
            
fm_give_item(id"weapon_xm1014")
        }
        case 
1: {
            
fm_give_item(id"weapon_aug")
        }
        case 
2: {
            
fm_give_item(id"weapon_awp")
        }
        case 
3: {
            
fm_give_item(id"weapon_m249")
        }
        case 
4: {
            
fm_give_item(id"weapon_m3")
        }
        case 
5: {
            
fm_give_item(id"weapon_m4a1")
        }
        case 
6: {
            
fm_give_item(id"weapon_g3sg1")
        }
        case 
7: {
            
fm_give_item(id"weapon_ak47")
        }
        case 
8: {
            
fm_give_item(id"weapon_p90")
        }
        
    }
    
}

public 
delet_munitie(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED;
    
    new 
body;
    
get_user_aiming(idmunitieEntbody);
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    
    if (
equali(classname"munitie"))
    {
        
fm_remove_entity(munitieEnt);
        
client_print(id,print_chat,"[AMXX] removed weapon box !");
    }
    return 
FMRES_IGNORED;

}

public 
delet_munitie_all(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED
    
    
new ammo = -1;
    while ((
ammo fm_find_ent_by_class(ammo"munitie")))
    
engfunc(EngFunc_RemoveEntityammo);
    
client_print(id,print_chat,"[AMXX] You removed all weapon box !");

}

/*--------- weapon ar2 (hl2) ---------*/

public client_PreThink(id){
    new 
weapon get_user_weapon(id)
    if(
weapon == CSW_P90)
    {
        if(
get_user_button(id) & IN_ATTACK2)
        {
            
ar2_plasma(id);
        }
    }

    
}

public 
ar2_plasma(id) {
    new 
Float:nexTime get_gametime();
    if(
nr_bullets[id] > nexTime)
    {
        return 
PLUGIN_CONTINUE;
    }
    else
    {
        new 
Float:StartOrigin[3], Float:Angle[3]
        new 
PlayerOrigin[3]
        
get_user_origin(idPlayerOrigin1)
        
StartOrigin[0] = float(PlayerOrigin[0])
        
StartOrigin[1] = float(PlayerOrigin[1])
        
StartOrigin[2] = float(PlayerOrigin[2])
        
entity_get_vector(idEV_VEC_v_angleAngle)
        
Angle[0] = Angle[0] * -1.0
        
new ar2_plasm create_entity("info_target")
        
entity_set_string(ar2_plasmEV_SZ_classname"plasma_classname")
        
entity_set_model(ar2_plasm"models/projectile.mdl")
        
entity_set_origin(ar2_plasmStartOrigin)
        
entity_set_vector(ar2_plasmEV_VEC_anglesAngle)
        new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
        new 
Float:MaxBox[3] = {1.01.01.0}
        
entity_set_vector(ar2_plasmEV_VEC_minsMinBox)
        
entity_set_vector(ar2_plasmEV_VEC_maxsMaxBox)
        
entity_set_int(ar2_plasmEV_INT_solid2)
        
entity_set_int(ar2_plasmEV_INT_movetype5)
        
entity_set_edict(ar2_plasmEV_ENT_ownerid)
        new 
Float:Velocity[3]
        
VelocityByAim(id1000Velocity)
        
entity_set_vector(ar2_plasmEV_VEC_velocityVelocity)
        
client_cmd(id"spk ^"%s^"",projectile_SOUND)
        
nr_bullets[id] = nexTime 20.0;
    }

}

public 
plasma_interact(ar2_plasm,other) {
    if(!
pev_valid(ar2_plasm))
    return 
FMRES_IGNORED;
    
    new 
classname[32]
    
pev(ar2_plasm,pev_classname,classname,31)
    
    if(!
equal(classname"plasma_classname"))
    return 
FMRES_IGNORED;
    
remove_task(ar2_plasm)
    
    new 
Float:fOrigin[3]
    new 
iOrigin[3]
    
entity_get_vector(ar2_plasmEV_VEC_originfOrigin)
    
FVecIVec(fOriginiOrigin)
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITYiOrigin);
    
write_byte(TE_EXPLOSION);
    
write_coord(iOrigin[0]);
    
write_coord(iOrigin[1]);
    
write_coord(iOrigin[2]);
    
write_short(explode);
    
write_byte(30);
    
write_byte(15);
    
write_byte(0);
    
message_end();
    
    
RadiusDamage(fOrigin1510)
    
remove_entity(ar2_plasm)
    
    if(
is_user_connected(other))
    {
        
user_kill(other0)
    }

}
public 
Event_CurWeapon(id) {
    new 
weaponID read_data(2)
    
    if(
weaponID != CSW_P90)
    return 
PLUGIN_CONTINUE;
    
    
set_pev(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    

Supremache is offline
KhaledAwesome
Member
Join Date: Jul 2013
Old 05-16-2020 , 01:00   Re: Can anyone help fix this plugin?
Reply With Quote #5

Quote:
Originally Posted by Supremache View Post
I HAVE FIXED MANY THINGS IN THIS PLUGIN, There's 9 warnings But the plugin will working without any problem

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>

new munitieModel[] = "models/ammo4.mdl"
new aimVector[3]

new 
explode
new Float:g_origin[33][3];
new 
Float:nr_bullets[33];

new 
projectile_MODEL[] = "models/projectile.mdl";
new 
projectile_SOUND[] = "ar2laungher.wav";

new 
open_box[] = "open_box.wav";

new 
VIEW_MODEL[] = "models/v_ar2.mdl"
new PLAYER_MODEL[] = "models/p_ar2.mdl"

new munitieEnt
new box_file[200]
new 
Configsdir[200]

public 
plugin_precache() {
    
precache_model(munitieModel);
    
precache_model(VIEW_MODEL);
    
precache_model(PLAYER_MODEL);
    
engfunc(EngFunc_PrecacheModelprojectile_MODEL);
    
engfunc(EngFunc_PrecacheSoundprojectile_SOUND);
    
engfunc(EngFunc_PrecacheSoundopen_box);
    
    
explode precache_model("sprites/zerogxplode33.spr")
}

public 
plugin_init() {
    
register_plugin("weapon box""0.3""apocalips");
    
register_clcmd("munitie_spawn","create",ADMIN_SLAY,"");
    
register_clcmd("remove","delet_munitie",ADMIN_SLAY,"");
    
register_clcmd("removeall","delet_munitie_all ",ADMIN_SLAY,"");
    
register_forward(FM_Touch,"fw_touch");
    
register_menucmd(register_menuid("\yweapons:" ), 1023"menu_command" );
    
register_forward(FM_Touch,"plasma_interact");
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
    
set_task(1.0,"map_load_weapon_box")
}

public 
create(id,level,cid) {
    if(!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED;
    
set_task1.0 "lada_munitie" id )
}


public 
lada_munitie(id) {
    new 
Float:origin[3]
    new 
Float:angles[3]
    new 
Float:v_angle[3]
    
    
entity_get_vector(id,EV_VEC_v_angle,v_angle)
    
entity_get_vector(id,EV_VEC_angles,angles)
    
    
munitieEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
    
    
set_pev(munitieEntpev_classname"munitie");
    
get_user_origin(idaimVector3//where the player is aiming
    
IVecFVec(aimVectororigin); //covert aim origin(int) to float.
    
    
set_pev(munitieEntpev_originorigin);
    
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
    
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
    
    new 
Float:vRetVector[3]
    
entity_get_vector(idEV_VEC_v_anglevRetVector)
    
vRetVector[0]=float(0)
    
entity_set_vector(munitieEntEV_VEC_anglesvRetVector)
    
    if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) ) {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
    }
    else
    {
        
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
    }
    
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    
    new 
mapname[32]
    new 
string[16]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
write_file(box_file,mapname,-1)
    
    
format(string,15,"%f",origin[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",origin[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",origin[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",angles[2])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[0])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[1])
    
write_file(box_file,string,-1)
    
format(string,15,"%f",v_angle[2])
    
write_file(box_file,string,-1)
    
    return 
PLUGIN_HANDLED;

}

public 
map_load_weapon_box(id) {
    new 
mapname[32]
    
get_mapname(mapname,31)
    
format(mapname,31,"[%s]",mapname)
    
get_configsdirConfigsdir199 )
    
format(box_file199"%s/weapon_box.ini"Configsdir )
    new 
read[32], trash
    
new Floatrigin[3], Float:angles[3], Float:v_angle[3], Float:origin[3]
    
    if(
file_exists(box_file))
    {
        for(new 
i=0;i<file_size(box_file,1);i++)
        {
            
read_file(box_file,i,read,31,trash)
            if(
equali(read,mapname))
            {
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
origin[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
angles[2] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[0] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[1] = str_to_float(read)
                
i++
                
read_file(box_file,i,read,31,trash)
                
v_angle[2] = str_to_float(read)
                
v_angle[0] = 0.000000
                
                munitieEnt 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
                
set_pev(munitieEntpev_classname"munitie");
                
set_pev(munitieEntpev_originorigin);
                
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
                
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
                
entity_set_vector(munitieEntEV_VEC_anglesv_angle);
                new 
Float:vRetVector[3]
                
entity_get_vector(idEV_VEC_v_anglevRetVector)
                
                if( ((
vRetVector[1]>=45.0) && (vRetVector[1]<=135.0)) || ((vRetVector[1]>=-135.0) && (vRetVector[1]<=-45.0)) )
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-30.0, -20.0, -90.0}, Float:{30.020.090.0} )
                }
                else
                {
                    
engfunc(EngFunc_SetSizemunitieEntFloat:{-20.0, -30.0, -90.0}, Float:{20.030.090.0} )
                }

            }
        }
    }
}

public 
close_box(param[2]) {
    new 
munitieEnt param[0];
    if(!
pev_valid(munitieEnt))
    return 
FMRES_IGNORED;
    
    
set_pev(munitieEntpev_sequence4);
    
set_pev(munitieEntpev_framerate1.0);

}

public 
fw_touch(id,munitieEnt) {
    if(!
pev_valid(munitieEnt))
    return 
FMRES_IGNORED;
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    if(!
equal(classname"munitie"))
    return 
FMRES_IGNORED;
    
    if(
is_user_connected(id) && is_user_alive(id))
    {
        new 
team get_user_team(id);
        if(
team == 1)
        return 
FMRES_IGNORED;
        
set_pev(munitieEntpev_sequence1);
        
set_pev(munitieEntpev_framerate1.0);
        
emit_soundidCHAN_AUTOopen_boxVOL_NORMATTN_NORM0PITCH_NORM );
        new 
weapon get_user_weapon(id)
        
        switch(
weapon)
        {
            case 
CSW_M4A1CSW_SG552CSW_FAMASCSW_GALILCSW_SG550CSW_AUGfm_give_item(id"ammo_556nato");
            case 
CSW_XM1014CSW_M3fm_give_item(id"ammo_buckshot");
            case 
CSW_MAC10CSW_UMP45fm_give_item(id"ammo_45acp");
            case 
CSW_MP5NAVYCSW_TMPfm_give_item(id"ammo_9mm");
            case 
CSW_P90fm_give_item(id"ammo_57mm");
            case 
CSW_AWPfm_give_item(id"ammo_338magnum");
            case 
CSW_M249fm_give_item(id"ammo_556natobox");
            case 
CSW_G3SG1CSW_AK47fm_give_item(id"ammo_762nato");
            
            default:
            {
                if(
weapon == CSW_DEAGLECSW_FIVESEVENCSW_KNIFECSW_GLOCK18CSW_ELITECSW_P228CSW_USP)
                {
                    switch(
weapon)
                    {
                        case 
CSW_DEAGLEfm_give_item(id"ammo_50ae");
                        case 
CSW_P228fm_give_item(id"ammo_357sig");
                        case 
CSW_ELITECSW_GLOCK18fm_give_item(id"ammo_9mm");
                        case 
CSW_FIVESEVENfm_give_item(id"ammo_57mm");
                        case 
CSW_USPfm_give_item(id"ammo_45acp");
                    }
                    
                    new 
szMenuBody[256];
                    new 
keys;
                    new 
nLen formatszMenuBody255"\yweapons:^n" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r1.\w xm1014" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r2.\w aug" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r3.\w awp" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r4.\w m249" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r5.\w m3" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r6.\w m4a1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r7.\w g3sg1" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r8.\w ak47" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n\r9.\w ar2" );
                    
nLen += formatszMenuBody[nLen], 255-nLen"^n^n\r0.\w Exit" );
                    
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<|1<<9)
                    
show_menuidkeysszMenuBody, -);

                }
            }


        }
        new 
param[2];
        
param[0] = munitieEnt;
        
set_task(2.0"close_box"1234param2);

    }
    return 
FMRES_IGNORED;    
}


public 
menu_command(id,key) {
    switch( 
key )
    {
        case 
0: { 
            
fm_give_item(id"weapon_xm1014")
        }
        case 
1: {
            
fm_give_item(id"weapon_aug")
        }
        case 
2: {
            
fm_give_item(id"weapon_awp")
        }
        case 
3: {
            
fm_give_item(id"weapon_m249")
        }
        case 
4: {
            
fm_give_item(id"weapon_m3")
        }
        case 
5: {
            
fm_give_item(id"weapon_m4a1")
        }
        case 
6: {
            
fm_give_item(id"weapon_g3sg1")
        }
        case 
7: {
            
fm_give_item(id"weapon_ak47")
        }
        case 
8: {
            
fm_give_item(id"weapon_p90")
        }
        
    }
    
}

public 
delet_munitie(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED;
    
    new 
body;
    
get_user_aiming(idmunitieEntbody);
    new 
classname[32]
    
pev(munitieEnt,pev_classname,classname,31)
    
    if (
equali(classname"munitie"))
    {
        
fm_remove_entity(munitieEnt);
        
client_print(id,print_chat,"[AMXX] removed weapon box !");
    }
    return 
FMRES_IGNORED;

}

public 
delet_munitie_all(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED
    
    
new ammo = -1;
    while ((
ammo fm_find_ent_by_class(ammo"munitie")))
    
engfunc(EngFunc_RemoveEntityammo);
    
client_print(id,print_chat,"[AMXX] You removed all weapon box !");

}

/*--------- weapon ar2 (hl2) ---------*/

public client_PreThink(id){
    new 
weapon get_user_weapon(id)
    if(
weapon == CSW_P90)
    {
        if(
get_user_button(id) & IN_ATTACK2)
        {
            
ar2_plasma(id);
        }
    }

    
}

public 
ar2_plasma(id) {
    new 
Float:nexTime get_gametime();
    if(
nr_bullets[id] > nexTime)
    {
        return 
PLUGIN_CONTINUE;
    }
    else
    {
        new 
Float:StartOrigin[3], Float:Angle[3]
        new 
PlayerOrigin[3]
        
get_user_origin(idPlayerOrigin1)
        
StartOrigin[0] = float(PlayerOrigin[0])
        
StartOrigin[1] = float(PlayerOrigin[1])
        
StartOrigin[2] = float(PlayerOrigin[2])
        
entity_get_vector(idEV_VEC_v_angleAngle)
        
Angle[0] = Angle[0] * -1.0
        
new ar2_plasm create_entity("info_target")
        
entity_set_string(ar2_plasmEV_SZ_classname"plasma_classname")
        
entity_set_model(ar2_plasm"models/projectile.mdl")
        
entity_set_origin(ar2_plasmStartOrigin)
        
entity_set_vector(ar2_plasmEV_VEC_anglesAngle)
        new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
        new 
Float:MaxBox[3] = {1.01.01.0}
        
entity_set_vector(ar2_plasmEV_VEC_minsMinBox)
        
entity_set_vector(ar2_plasmEV_VEC_maxsMaxBox)
        
entity_set_int(ar2_plasmEV_INT_solid2)
        
entity_set_int(ar2_plasmEV_INT_movetype5)
        
entity_set_edict(ar2_plasmEV_ENT_ownerid)
        new 
Float:Velocity[3]
        
VelocityByAim(id1000Velocity)
        
entity_set_vector(ar2_plasmEV_VEC_velocityVelocity)
        
client_cmd(id"spk ^"%s^"",projectile_SOUND)
        
nr_bullets[id] = nexTime 20.0;
    }

}

public 
plasma_interact(ar2_plasm,other) {
    if(!
pev_valid(ar2_plasm))
    return 
FMRES_IGNORED;
    
    new 
classname[32]
    
pev(ar2_plasm,pev_classname,classname,31)
    
    if(!
equal(classname"plasma_classname"))
    return 
FMRES_IGNORED;
    
remove_task(ar2_plasm)
    
    new 
Float:fOrigin[3]
    new 
iOrigin[3]
    
entity_get_vector(ar2_plasmEV_VEC_originfOrigin)
    
FVecIVec(fOriginiOrigin)
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITYiOrigin);
    
write_byte(TE_EXPLOSION);
    
write_coord(iOrigin[0]);
    
write_coord(iOrigin[1]);
    
write_coord(iOrigin[2]);
    
write_short(explode);
    
write_byte(30);
    
write_byte(15);
    
write_byte(0);
    
message_end();
    
    
RadiusDamage(fOrigin1510)
    
remove_entity(ar2_plasm)
    
    if(
is_user_connected(other))
    {
        
user_kill(other0)
    }

}
public 
Event_CurWeapon(id) {
    new 
weaponID read_data(2)
    
    if(
weaponID != CSW_P90)
    return 
PLUGIN_CONTINUE;
    
    
set_pev(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    

This is not working, when i go near the box nothing happens but the original sma is working.

Also i tried the plugin and it works fine but there are 2 major problems i hope someone can help me fix them, i don't know how to code sorry for that. Your help would be very appreciated!

problem 1 : The sound.. when you touch the box once it makes the sound 1 time, but if you push yourself to the box and keep pushing it repeats the sound like a thousand times and make an irritating noise.

problem 2 : Can you guys remove the weapon list? i just needed it for some ammo, not weapons.
Thanks!

Last edited by KhaledAwesome; 05-16-2020 at 01:01.
KhaledAwesome is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-16-2020 , 03:28   Re: Can anyone help fix this plugin?
Reply With Quote #6

Quote:
Originally Posted by KhaledAwesome View Post
This is not working, when i go near the box nothing happens but the original sma is working.

Also i tried the plugin and it works fine but there are 2 major problems i hope someone can help me fix them, i don't know how to code sorry for that. Your help would be very appreciated!

problem 1 : The sound.. when you touch the box once it makes the sound 1 time, but if you push yourself to the box and keep pushing it repeats the sound like a thousand times and make an irritating noise.

problem 2 : Can you guys remove the weapon list? i just needed it for some ammo, not weapons.
Thanks!
These codes are not complete, This plugin need to be retyped, I checked it alot for fixing the problems but the problem are in the codes But it doesn't completed...
Supremache is offline
Reply



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 02:55.


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