AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   /give weapon (https://forums.alliedmods.net/showthread.php?t=89194)

TitANious 04-03-2009 13:10

/give weapon
 
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "snipers"
#define VERSION "0.1"
#define AUTHOR "TitANious"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_clcmd("say /scout", "give_scout")
        register_clcmd("say /AWP", "give_awp")
        register_clcmd("say /sg552", "give_sg552")
        register_clcmd("say /g3sg1", "give_g3sg1")

public give_scout
{
        give_item, ("weapon_scout")
}
public give_g3sg1
{
        give_item, ("weapon_g3sg1")
}
public give_awp
{
        give_item, ("weapon_awp")
}
public give_sg552

        give_item, ("weapon_sg552")
}

Whats wrong? :S

xPaw 04-03-2009 13:15

Re: /give weapon
 
PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN        " Weapons? "
#define VERSION        "1.0"
#define AUTHOR        "TitANious (xPaw)"


public plugin_init( ) {
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd"say /scout",    "cmdGiveScout" );
    
register_clcmd"say /sg552",    "cmdGiveSG552" );
    
register_clcmd"say /g3sg1",    "cmdGiveG3SG1" );
    
register_clcmd"say /awp",    "cmdGiveAWP" );
}

public 
cmdGiveScoutid ) {
    
give_itemid"weapon_scout" );
    
    
// dont forge to give some ammo :D
}

public 
cmdGiveSG552id ) {
    
give_itemid"weapon_sg552" );
    
    
// dont forge to give some ammo :D
}

public 
cmdGiveG3SG1id ) {
    
give_itemid"weapon_g3sg1" );
    
    
// dont forge to give some ammo :D
}

public 
cmdGiveAWPid ) {
    
give_itemid"weapon_awp" );
    
    
// dont forge to give some ammo :D



TitANious 04-03-2009 13:36

Re: /give weapon
 
Im new at scripting, how? I just found out on any way to make that i have now ;)

xPaw 04-03-2009 13:56

Re: /give weapon
 
what you mean by "how"?

TitANious 04-03-2009 13:57

Re: /give weapon
 
Whats the code for it? For ammo

xPaw 04-03-2009 13:58

Re: /give weapon
 
same with give_item, just you need to find right ammo names, and give like
PHP Code:

give_itemid"ammo-name" ); 


TitANious 04-03-2009 14:00

Re: /give weapon
 
Like
PHP Code:

give_itemid"ammo-sg552" ); 

?

xPaw 04-03-2009 14:04

Re: /give weapon
 
no. watch this table http://wiki.amxmodx.org/CS_Weapons_Information

PHP Code:

public cmdGiveSG552id ) {
    
give_itemid"weapon_sg552" );
    
    
// you need to give ammo 3-6 times to fill the ammo.
    
give_itemid"ammo_556nato" );
    
give_itemid"ammo_556nato" );
    
give_itemid"ammo_556nato" );
    
give_itemid"ammo_556nato" );
    
give_itemid"ammo_556nato" );



ConnorMcLeod 04-03-2009 16:00

Re: /give weapon
 
Better with cs_set_bpammo.

Example for all weapons, and max ammo for each weapon.

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Give Weapon"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

new const g_iMaxBpAmmo[] = { -152, -190, -132110090, -1120100100909090100100,
        
30120200329012060, -1359090, -1100 }

public 
plugin_init()

    
register_plugin(PLUGINVERSIONAUTHOR)
     
    
register_clcmd"say""ClientCommand_GiveWeapon" )
    
register_clcmd"say_team""ClientCommand_GiveWeapon" )


public 
ClientCommand_GiveWeapon(id)
{
    new 
szArg1[14// smokegrenade

    
read_argv(1szArg1charsmax(szArg1))
    if( 
szArg1[0] == '/' )
    {
        new 
szWeaponName[20] = "weapon_" // weapon_smokegrenade
        
new iWeaponId
        add
(szWeaponNamecharsmax(szWeaponName), szArg1[1])
        if( ( 
iWeaponId get_weaponid(szWeaponName) ) )
        {
            
give_item(idszWeaponName)
            
cs_set_user_bpammo(idiWeaponIdg_iMaxBpAmmo[iWeaponId])
            return 
PLUGIN_HANDLED_MAIN
        
}
    }
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 02:25.

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