12.05.2012, 15:32
Hello again guys...i want to make something in /stats to show the Weapon Name by his ID! Can somebody give me an example? REP++;
if(!strcmp(cmdtext,"/myweapon"))
{
new GunName[32], VBString[64];
GetWeaponName(GetPlayerWeapon(playerid),GunName,sizeof GunName);
format(VBString,sizeof VBString,"Your current gun : %s", GunName);
SendClientMessagel(playerid, -1, VBString);
return true;
}
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));