Is there a way
#2

pawn Код:
stock GetWeaponID(name[])
{
    for(new wps=0; wps < 48; wps++)
    {
        if (wps==19||wps==20||wps== 21) continue;
        if (strfind(WeaponNames[wps],name, true) != -1) {
            return wps;
        }
    }
    return -1;
}
pawn Код:
new WeaponNames[][] = {
    {"Unarmed (Fist)"},{"Brass Knuckles"}, {"Golf Club"}, {"Night Stick"}, {"Knife"}, {"Baseball Bat"}, {"Shovel"}, {"Pool Cue"}, {"Katana"}, {"Chainsaw"},
    {"Purple Dildo"}, {"Big White Vibrator"}, {"Medium White Vibrator"}, {"Small White Vibrator"}, {"Flowers"}, {"Cane"}, {"Grenade"}, {"Teargas"},{"Molotov"},
    {" "},{" "},{" "},{"Colt "},{"Colt  (Silenced)"},{"Desert Eagle"},{"Normal Shotgun"},{"Sawnoff Shotgun"},{"Combat Shotgun"}, {"Micro Uzi (Mac )"},
    {"MP"},{"AK"},{"M4"},{"Tec"},{"Country Rifle"},{"Sniper Rifle"},{"Rocket Launcher"},{"Heat-Seeking Rocket Launcher"},{"Flamethrower"}, {"Minigun"},
    {"Satchel Charge"},{"Detonator"},{"Spray Can"},{"Fire Extinguisher"},{"Camera"},{"Night Vision Goggles"},{"Infrared Vision Goggles"},{"Parachute"},{"Fake Pistol"}
};

...
pawn Код:
YCMD:giveweapon(playerid, params[], help)
{
    new pid;
    new str[128];
    new weapon[32];
    new ammo;
    if(PlayerInfo[playerid][pAdmin] < 8 && !IsPlayerAdmin(playerid)) return
        SendClientMessage(playerid, COLOR_GREY, ADMIN_CMD_ERROR);
    if (help) return
        SendClientMessage(playerid, COMMAND_HELP_COLOR, "Gives a player a gun.");
    if (sscanf(params, "us[32]d", pid,weapon,ammo)) return
        SendClientMessage(playerid, COMMAND_PRINT, "Usage: /giveweapon <playerid/name> <weaponid> <ammo amount>.");
    if(!IsPlayerConnected(pid)) return
       SendClientMessage(playerid, ERROR_COLOR, PCONNECT);
    new wepname = GetWeaponID(weapon);
    format(str, sizeof (str), "You have given %s [%d] Weapon id [%d] With %d amount of ammo %s",GetName(pid),pid,weapon,ammo,WeaponNames[weaponid]);
    SendClientMessage(playerid, COMMAND_PRINT, str);
    GivePlayerWeapon(pid,wepname,ammo);
    return 1;
}

prob some warning but fix it
Reply


Messages In This Thread
Is there a way - by ihatetn931 - 16.04.2011, 08:09
Re: Is there a way - by iJumbo - 16.04.2011, 08:16
Re: Is there a way - by Seven_of_Nine - 16.04.2011, 08:17
Re: Is there a way - by ihatetn931 - 16.04.2011, 08:19

Forum Jump:


Users browsing this thread: 1 Guest(s)