Creating /giveweaponall?
#1

How to make /giveweaponall?

Code:
/giveweaponall <Weaponname/id>

ZCMD
Sscanf
Reply
#2

pawn Code:
for(new p; p < GetMaxPlayers(); p++) {
   if(IsPlayerConnected(p)) {
      GivePlayerWeapon(playerid, id, 99999);
   }
}
Reply
#3

the question is how about the ammo plus how to check if either WeaponID or WeaponName are type? not sure but thanks. meanwhile this is is my new question
Reply
#4

Make an array containing all the weapon names, loop through it and find the correct ID for the name.
Reply
#5

Is this correct?

pawn Code:
new WeaponName[][45] =
{
    "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 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"
};
i didn't include the frisk one. Next what should i do?
Reply
#6

pawn Code:
new gunname[45];
if(!sscanf(params, "s[45]", gunname)) {
    for(new g; g < sizeof(WeaponName); g++) {
        if(strcmp(gunname, WeaponName[g], true)) {
            for(new p; p < GetMaxPlayers(); p++) {
                 if(IsPlayerConnected(p)) {
                     GivePlayerWeapon(playerid, g, 99999);
                 }
             }
        }
    }
}
You can implement it into a command.
Reply
#7

pawn Code:
CMD:giveallweapon(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME], gunname[45];
    if(PlayerInfo[playerid][pAdmin] > 5)
    {
        if(!sscanf(params, "s[45]", gunname))
        {
            GetPlayerName(playerid, pname, sizeof(pname));
            for(new g; g < sizeof(WeaponName); g++)
            {
                if(strcmp(gunname, WeaponName[g], true))
                {
                    for(new p; p < GetMaxPlayers(); p++)
                    {
                        if(IsPlayerConnected(p))
                        {
                            GivePlayerWeapon(playerid, g, 4987);
                            format(string, sizeof(string), "ADMIN: %s for everyone!", g);
                            GameTextForAll(string);
                        }
                    }
                }
            }
        }
        else return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /giveallweapon <WeaponName>");
    }
    else return SendClientMessage(playerid, COLOR_RED, "Your not administrator!");
    return 1;
}
i get this warning

Code:
C:\DOCUME~1\Reklez112\MYDOCU~1\ReGMS\filterscript\Admin.pwn(466) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Reklez112\MYDOCU~1\ReGMS\filterscript\Admin.pwn(466) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#8

Which line is 466?
Reply
#9

never mind i found the error
Reply
#10

Sorry for double posting but.

when i type

"/giveallweapon 22"

it gives me almost all weapons. How could i do something like

"/giveallweapon 22"

or

"/giveallweapon 9mm"

?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)