Weapon Name by ID - Help?
#5

that will break on id 18,44,45 Vini

heres a stock i just wrote for this
pawn Код:
stock GetWeaponNameByID(wid)
{
    new gunname[32];
    switch (wid)
    {
        case    1 .. 17,
                22 .. 43,
                46 :        GetWeaponName(wid,gunname,sizeof(gunname));
        case    0:          format(gunname,32,"%s","Fist");
        case    18:         format(gunname,32,"%s","Molotov Cocktail");
        case    44:         format(gunname,32,"%s","Night Vis Goggles");
        case    45:         format(gunname,32,"%s","Thermal Goggles");
        default:            format(gunname,32,"%s","Invalid Weapon Id");
   
    }
    return gunname;
}

//usage

new str[47];
format(str,sizeof str, "Your weapon : %s" ,GetWeaponNameByID(wid));

EDIT:

I updated the stock as it did not account for invalid ID's
should be perfect now, if anyone see's anything wrong please post.
Reply


Messages In This Thread
Weapon Name by ID - Help? - by nGen.SoNNy - 12.05.2012, 15:32
Re: Weapon Name by ID - Help? - by Jonny5 - 12.05.2012, 15:43
Re: Weapon Name by ID - Help? - by nGen.SoNNy - 12.05.2012, 15:47
Re: Weapon Name by ID - Help? - by ViniBorn - 12.05.2012, 16:01
Re: Weapon Name by ID - Help? - by Jonny5 - 12.05.2012, 16:04

Forum Jump:


Users browsing this thread: 2 Guest(s)