AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   weapon and ammo box (https://forums.alliedmods.net/showthread.php?t=86375)

apocalips 02-24-2009 16:57

weapon and ammo box
 
5 Attachment(s)
Description: This plugin creates a box with ammunition and weapons, who touches the box will have bullets and if not the weapon will show automatically a list with some weapons
(that player can have 9 primary weapons )
admins comands "munitie_spawn" create box and "remove" and "removeall" remove box
I modified pluginul now used only amxmodx, amxmisc, fakemeta_util, now can open archive (.zip)

new in new version: new model with animation, open closed, and save the location where it was created

[IMG]http://img509.**************/img509/6531/box.png[/IMG]

fysiks 02-24-2009 17:09

Re: weapon and ammo box
 
Change:
Code:

register_plugin(PLUGIN, AUTHOR, VERSION)
:arrow:
Code:

register_plugin(PLUGIN, VERSION, AUTHOR)
Also, I can't open .rar files. Need a .zip.

minimiller 02-24-2009 17:13

Re: weapon and ammo box
 
oh dear

Quote:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
->
Quote:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
Indent your code better plz
My eyes are bleeding
=[

BOYSplayCS 02-24-2009 17:40

Re: weapon and ammo box
 
Here you go:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <fakemeta>
#include <fun>

#define PLUGIN "lada cu munitie"
#define AUTHOR "apocalips"
#define VERSION "0.1"

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


public 
plugin_precache()
{
    
precache_model(munitieModel)
}



public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("munitie","lada_munitie",ADMIN_SLAY,"")
    
register_clcmd("remove","delet_munitie",ADMIN_SLAY,"")
    
register_forward(FM_Touch,"fw_touch");
    
register_menucmd(register_menuid("\yweapons:"), 1023"menu_command" );
    
Enable register_cvar("touch_enable""1");
    
set_task(3.0"touch_begin",_,_,_,"b");
    
    
}



public 
lada_munitie(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 
    
    
    
new munitieEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"func_wall"));
    
    
    
set_pev(munitieEntpev_classname"munitie");
    
get_user_origin(idaimVector3//where the player is aiming
    
    
new Float:fOrigin[3];
    
IVecFVec(aimVectorfOrigin); //covert aim origin(int) to float.
    
    
set_pev(munitieEntpev_originfOrigin);
    
    
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
    
    
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
    
engfunc(EngFunc_SetSizemunitieEntFloat:{-16.0, -16.0, -16.0}, Float:{16.016.016.0} )
    
    
    
    return 
PLUGIN_HANDLED
}


public 
fw_touch(ent,id)
{
    
    if(
get_pcvar_num(Enable) == 0)
        return 
FMRES_IGNORED;
    
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    new 
classname[32]
    
pev(ent,pev_classname,classname,31)
    
    if(!
equal(classname"munitie"))  // check for kit 
        
return FMRES_IGNORED;
    
    
    new 
weapon get_user_weapon(id)
    
    
    switch(
weapon)
    {
        case 
CSW_M4A1,CSW_SG552,CSW_FAMAS,CSW_GALIL,CSW_SG550,CSW_AUGgive_item(id"ammo_556nato"); 
            case 
CSW_XM1014,CSW_M3give_item(id"ammo_buckshot");
            case 
CSW_MAC10,CSW_UMP45give_item(id"ammo_45acp");
            case 
CSW_MP5NAVY,CSW_TMPgive_item(id"ammo_9mm");
            case 
CSW_P90give_item(id"ammo_57mm");
            case 
CSW_AWPgive_item(id"ammo_338magnum");
            case 
CSW_M249give_item(id"ammo_556natobox");
            case 
CSW_G3SG1,CSW_AK47give_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_DEAGLEgive_item(id"ammo_50ae");
                    case 
CSW_P228give_item(id"ammo_357sig");
                        case 
CSW_ELITE,CSW_GLOCK18give_item(id"ammo_9mm");
                        case 
CSW_FIVESEVENgive_item(id"ammo_57mm");
                        case 
CSW_USPgive_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. p90" );
                
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<<8|1<<9)
                
                
show_menuidkeysszMenuBody, -);
                
server_cmd("touch_enable 0")
            }                   
        }
    }
    return 
FMRES_IGNORED;
    
}

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



public 
touch_begin()
{
    
    if(
get_pcvar_num(Enable) ==0)
    {
        
server_cmd("touch_enable 1")
    }
    return 
PLUGIN_HANDLED;
}


public 
delet_munitie(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);
    
    return 
FMRES_IGNORED;
    



danielkza 02-24-2009 18:22

Re: weapon and ammo box
 
RAR file removed. Please attach a ZIP file according to the rules if you want the plugin to be approved. Also, provide a better description about the plugin, the current one is too vague.

YamiKaitou 02-24-2009 18:49

Re: weapon and ammo box
 
AMXX file removed, do not upload it again. Also, there is really no point in having the SMA in the zip so I removed it as well

fysiks 02-24-2009 19:29

Re: weapon and ammo box
 
Quote:

Originally Posted by BOYSplayCS (Post 768318)
Here you go:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <fakemeta>
#include <fun>
 
#define PLUGIN "lada cu munitie"
#define AUTHOR "apocalips"
#define VERSION "0.1"
 
new Enable
new munitieModel[] = "models/munitie.mdl"
new aimVector[3]
 
 
public 
plugin_precache()
{
    
precache_model(munitieModel)
}
 
 
 
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("munitie","lada_munitie",ADMIN_SLAY,"")
    
register_clcmd("remove","delet_munitie",ADMIN_SLAY,"")
    
register_forward(FM_Touch,"fw_touch");
    
register_menucmd(register_menuid("\yweapons:"), 1023"menu_command" );
    
Enable register_cvar("touch_enable""1");
    
set_task(3.0"touch_begin",_,_,_,"b");
 
 
}
 
 
 
public 
lada_munitie(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 
 
 
    
new munitieEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"func_wall"));
 
 
    
set_pev(munitieEntpev_classname"munitie");
    
get_user_origin(idaimVector3//where the player is aiming
 
    
new Float:fOrigin[3];
    
IVecFVec(aimVectorfOrigin); //covert aim origin(int) to float.
 
    
set_pev(munitieEntpev_originfOrigin);
 
    
engfunc(EngFunc_SetModelmunitieEntmunitieModel);
 
    
set_pev(munitieEnt,pev_solid,SOLID_BBOX);
    
engfunc(EngFunc_SetSizemunitieEntFloat:{-16.0, -16.0, -16.0}, Float:{16.016.016.0} )
 
 
 
    return 
PLUGIN_HANDLED
}
 
 
public 
fw_touch(ent,id)
{
 
    if(
get_pcvar_num(Enable) == 0)
        return 
FMRES_IGNORED;
 
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED;
 
    new 
classname[32]
    
pev(ent,pev_classname,classname,31)
 
    if(!
equal(classname"munitie"))  // check for kit 
        
return FMRES_IGNORED;
 
 
    new 
weapon get_user_weapon(id)
 
 
    switch(
weapon)
    {
        case 
CSW_M4A1,CSW_SG552,CSW_FAMAS,CSW_GALIL,CSW_SG550,CSW_AUGgive_item(id"ammo_556nato"); 
            case 
CSW_XM1014,CSW_M3give_item(id"ammo_buckshot");
            case 
CSW_MAC10,CSW_UMP45give_item(id"ammo_45acp");
            case 
CSW_MP5NAVY,CSW_TMPgive_item(id"ammo_9mm");
            case 
CSW_P90give_item(id"ammo_57mm");
            case 
CSW_AWPgive_item(id"ammo_338magnum");
            case 
CSW_M249give_item(id"ammo_556natobox");
            case 
CSW_G3SG1,CSW_AK47give_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_DEAGLEgive_item(id"ammo_50ae");
                    case 
CSW_P228give_item(id"ammo_357sig");
                        case 
CSW_ELITE,CSW_GLOCK18give_item(id"ammo_9mm");
                        case 
CSW_FIVESEVENgive_item(id"ammo_57mm");
                        case 
CSW_USPgive_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. p90" );
                
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<<8|1<<9)
 
                
show_menuidkeysszMenuBody, -);
                
server_cmd("touch_enable 0")
            }                   
        }
    }
    return 
FMRES_IGNORED;
 
}
 
public 
menu_command(id,key)
{
    switch( 
key )
    {
        case 
0: { 
            
give_item(id"weapon_xm1014")
            
server_cmd("touch_enable 1")      
        }
        case 
1: { 
            
give_item(id"weapon_aug")
            
server_cmd("touch_enable 1")      
        }
        case 
2: {
            
give_item(id"weapon_awp"
            
server_cmd("touch_enable 1")      
        }       
        case 
3: {
            
give_item(id"weapon_m249"
            
server_cmd("touch_enable 1")     
        }
        case 
4: {
            
give_item(id"weapon_m3")  
            
server_cmd("touch_enable 1")     
        }
        case 
5: {
            
give_item(id"weapon_m4a1"
            
server_cmd("touch_enable 1")      
        }
        case 
6: {
            
give_item(id"weapon_g3sg1"
            
server_cmd("touch_enable 1")     
        }
        case 
7: { 
            
give_item(id"weapon_ak47"
            
server_cmd("touch_enable 1")     
        }
        case 
8: {
            
give_item(id"weapon_p90")
            
server_cmd("touch_enable 1")     
        }
 
    }
}
 
 
 
public 
touch_begin()
{
 
    if(
get_pcvar_num(Enable) ==0)
    {
        
server_cmd("touch_enable 1")
    }
    return 
PLUGIN_HANDLED;
}
 
 
public 
delet_munitie(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);
 
    return 
FMRES_IGNORED;
 



This doensn't use tabs :(, or the forums replace tabs with spaces. If so, it will have to be done by the author if he chooses to do so :).

tuty 02-25-2009 00:30

Re: weapon and ammo box
 
wtf?

I,m from Romania too, but change the name of zip and name of plugin

Code:

#define PLUGIN "lada cu munitie"
into
Code:

ammo box
and change the zip file name into ammobox.zip because some peoples doesn't understand.. you must use the descriptive names and titles...

RO: ma, si un prieten hip_hop_x a avut un plugin si comenzile din el in romana.... si numele la plugin tot in romana, si un moderator i-a dat unaprove ca nu a avut titlu descriptiv, si na,, ..Aici tot ar trebui sa postezi in engleza, ca nu e greu :)

SnoW 02-26-2009 08:15

Re: weapon and ammo box
 
@Minimiller, why you said that he should not include fakemeta? It's just a same, cause fakemeta_util includes it anyway if it's not already included.
OT: @danielkza, nice title: :crab:AMX Mod X Plugin Approver:crab: and karma lvl increased too :mrgreen: GZ!

minimiller 02-26-2009 08:41

Re: weapon and ammo box
 
Quote:

Originally Posted by SnoW (Post 769384)
@Minimiller, why you said that he should not include fakemeta? It's just a same, cause fakemeta_util includes it anyway if it's not already included.
OT: @danielkza, nice title: :crab:AMX Mod X Plugin Approver:crab: and karma lvl increased too :mrgreen: GZ!

exactly my point
there no point including both fakemeta and fakemeta_util
Tidy code = happy people


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

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