GetWeaponName acting up?
#2

Lol, that GetGunName is so unoptimized. You do 40+ conditions to get only one weapon name :/

I wrote this for u

pawn Code:
new GunName[47][20] =
{
    "Fist","Brass Knuckles","Golf Club","Nightstick","Knife","Basebal Bat","Shovel","Pool Cue","Katana","Chainsaw","Double-ended Dildo","Dildo","Vibrator",
    "Silver Vibrator","Flowers","Cane","Grenade","Tear Gas","Molotv Cocktail","?","?","?","9mm","Silenced 9mm","Desert Eagle","Shotgun","Sawnoff-Shotgun",
    "Combat Shotgun","Micro-SMG","MP5","Ak-47","M4","Tec9","Country Rifle","Sniper Rifle","RPG","HS-RPG","Flame-Thrower","Minigun","Satchel Charge","Detonator",
    "Spray Can","Fire Extinguisher","Camera","Night Goggles","Thermal Goggles","Parachute"
};

// Example of use:

CMD:mygun(playerid)
{
    new text[48];
    format(text,sizeof text,"You've got a nice: {FFFFFF}%s",GunName[GetPlayerWeapon(playerid)]);
    SendClientMessage(playerid,0xFFDD22FF,text);
    return 1;
}
And you don't need to format a string, if you will not use placeholders.

You cant just do:
pawn Code:
new var[30] = "Var Test";
// or

new var[35];
switch(playerid)
{
    case 0: var = "First Player!";
    case 1: var = "Second Player!";
    default: var = "You're not first neither second :/";
}
Reply


Messages In This Thread
GetWeaponName acting up? - by zDevon - 07.05.2013, 00:00
Re: GetWeaponName acting up? - by arakuta - 07.05.2013, 01:25

Forum Jump:


Users browsing this thread: 1 Guest(s)