| TitANious |
04-04-2009 06:42 |
A bug in my plugin (Snipers)
PHP Code:
#include <amxmodx>
#include <fun>
#define PLUGIN " Snipers "
#define VERSION "1.0"
#define AUTHOR "TitANious (xPaw)"
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_clcmd( "say /scout", "cmdGiveSniper" );
register_clcmd( "say /sg550", "cmdGiveSniper" );
register_clcmd( "say /g3sg1", "cmdGiveSniper" );
register_clcmd( "say /awp", "cmdGiveSniper" );
register_clcmd( "say_team /scout", "cmdGiveSniper" );
register_clcmd( "say_team /sg550", "cmdGiveSniper" );
register_clcmd( "say_team /g3sg1", "cmdGiveSniper" );
register_clcmd( "say_team /awp", "cmdGiveSniper" );
}
public cmdGiveSniper( id )
{
new weapon = get_user_weapon(id, _, _);
new Arg[32], szWeapon[32], szAmmoName[32]
read_argv(1, Arg, charsmax(Arg))
switch( Arg[2] ) // Arg2 is /name, Arg[0] is '/', Arg[1] is first letter but 2 weapons share so check Arg[2]
{
case '3':
{
if(weapon == CSW_G3SG1)
{
szAmmoName = "ammo_762nato"
}
else
{
client_cmd(id, "slot 1; drop")
szWeapon = "weapon_g3sg1"
szAmmoName = "ammo_762nato"
}
give_item(id, szWeapon)
}
case 'c':
{
if(weapon == CSW_SCOUT)
{
szAmmoName = "ammo_762nato"
}
else
{
client_cmd(id, "slot 1; drop")
szWeapon = "weapon_scout"
szAmmoName = "ammo_762nato"
}
give_item(id, szWeapon)
}
case 'g':
{
if(weapon == CSW_SG550)
{
szAmmoName = "ammo_556nato"
}
else
{
client_cmd(id, "slot 1; drop")
szWeapon = "weapon_sg550"
szAmmoName = "ammo_556nato"
}
give_item(id, szWeapon)
}
case 'w':
{
if(weapon == CSW_AWP)
{
szAmmoName = "ammo_338magnum"
}
else
{
client_cmd(id, "slot 1; drop")
szWeapon = "weapon_awp"
szAmmoName = "ammo_338magnum"
}
give_item(id, szWeapon)
// 3 is the max for each ammo type, don't try to give 10.
for(new i; i<3; i++)
{
give_item(id, szAmmoName)
}
}
}
}
My bug:
Code:
Exampel:
Starting game.
I haven't bought anything
I press /scout
It dont equips, but drops
|