/giveweapon using names instead of id
#7

havent tested it yet

pawn Код:
new aWeapons[] =
{
"Fist",
"Brass Knuckles",
"Golf Club",
"Nightstick",
"Knife",
"Baseball Bat",
"Shovel",
"Pool Cue",
"Katana",
"Chainsaw",
"Double-ended Dildo",
"Dildo",
"Vibrator",
"Silver Vibrator",
"Flowers",
"Cane",
"Grenade",
"Tear Gas",
"Molotov Cocktail",
"9mm",
"Silenced 9mm",
"Desert Eagle",
"Shotgun",
"Sawnoff Shotgun",
"Combat Shotgun",
"Micro SMG/Uzi",
"MP5",
"AK-47",
"M4",
"Tec-9",
"Country Rifle",
"Sniper Rifle",
"RPG",
"HS Rocket",
"Flamethrower",
"Minigun",
"Satchel Charge",
"Detonator",
"Spraycan",
"Fire Extinguisher",
"Camera",
"Night Vis Goggles",
"Thermal Goggles",
"Parachute"
};





YCMD:gweapon(playerid, params[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Give a player a weapon.");
    }
    else
    {
        new str[128], p1, p2[32], p3;
        if (isnull(params))
        {
            format(str, sizeof (str), "Usage: \"/%s [playerid] [weapon name] [ammo amount]\"", Command_GetDisplayNamed("gweapon", playerid));
            SendClientMessage(playerid, 0xFF0000AA, str);
        }
        else
        {
            if(!sscanf(params, "us[32]i", p1,p2,p3))
            {
                //
                for (new i = 0; i == sizeof(aWeapons); i++)
                {
                    if(strcmp(p2, aWeapons[i], true) == 0)
                    {
                        if(p1 != INVALID_PLAYER_ID)
                        {
                            GivePlayerWeapon(p1, i, p3);
                        }
                        return 1;
                    }

                }

            }
        }
    }
    return 1;
}
let me know how it works

could add some error checking and messages but this is the basic.
oh and Ima use this in my GM too.
Reply


Messages In This Thread
/giveweapon using names instead of id - by [LHT]Bally - 19.02.2012, 15:25
Re: /giveweapon using names instead of id - by Madd Kat - 19.02.2012, 15:40
Re: /giveweapon using names instead of id - by [LHT]Bally - 19.02.2012, 15:42
Re: /giveweapon using names instead of id - by Madd Kat - 19.02.2012, 15:44
Re: /giveweapon using names instead of id - by [LHT]Bally - 19.02.2012, 15:44
Re: /giveweapon using names instead of id - by Twisted_Insane - 19.02.2012, 15:57
Re: /giveweapon using names instead of id - by Madd Kat - 19.02.2012, 16:12
Re: /giveweapon using names instead of id - by [LHT]Bally - 19.02.2012, 16:22
Re: /giveweapon using names instead of id - by Madd Kat - 19.02.2012, 16:27
Re: /giveweapon using names instead of id - by emokidx - 19.02.2012, 16:27

Forum Jump:


Users browsing this thread: 1 Guest(s)