07.05.2013, 00:00
pawn Code:
new str1[800],str2[64];
new prim[12],secon[12],melee[12],spec[12],armor[12];
GetWeaponName(FactionInfo[factionid][fClass1Primary],prim,sizeof(prim));
GetWeaponName(FactionInfo[factionid][fClass1Secondary],secon,sizeof(secon));
GetWeaponName(FactionInfo[factionid][fClass1Melee],melee,sizeof(melee));
GetWeaponName(FactionInfo[factionid][fClass1Special],spec,sizeof(spec));
switch(FactionInfo[factionid][fClass1Armor]) {
case 25: format(armor,sizeof(armor),"Stab vest");
case 50: format(armor,sizeof(armor),"Half body armor");
case 100: format(armor,sizeof(armor),"Full body armor");
}
format(str1,sizeof(str1),"Rename class\nRank restriction (Current: %s)\nChange primary (Current: %s)\nChange secondary (Current: %s)\nChange melee (Current: %s)\nChange special (Current: %s)\nChange armor (Current: %s)",GetFactionRankName(factionid,FactionInfo[factionid][fClass1Rank]),prim,secon,melee,spec,armor);
format(str2,sizeof(str2),"Class %i - %s",classid,FactionInfo[factionid][fClass1Name]);
ShowPlayerDialog(playerid,DIALOG_FCLASSEDIT,DIALOG_STYLE_LIST,str2,str1,"Select","Back");
I'm aware of the few weapon IDs that GetWeaponName is incompatible with, but I'm not using those.
Edit: fixed this for the time being with a custom weapon name function:
pawn Code:
stock GetGunName(gunid)
{
new res[24];
switch(gunid) {
case 0: format(res,sizeof(res),"Fist");
case 1: format(res,sizeof(res),"Brass Knuckles");
case 2: format(res,sizeof(res),"Golf Club");
case 3: format(res,sizeof(res),"Nightstick");
case 4: format(res,sizeof(res),"Knife");
case 5: format(res,sizeof(res),"Baseball Bat");
case 6: format(res,sizeof(res),"Shovel");
case 7: format(res,sizeof(res),"Pool Cue");
case 8: format(res,sizeof(res),"Katana");
case 9: format(res,sizeof(res),"Chainsaw");
case 10: format(res,sizeof(res),"Double-ended Dildo");
case 11: format(res,sizeof(res),"Dildo");
case 12: format(res,sizeof(res),"Vibrator");
case 13: format(res,sizeof(res),"Silver Vibrator");
case 14: format(res,sizeof(res),"Flowers");
case 15: format(res,sizeof(res),"Cane");
case 16: format(res,sizeof(res),"Grenade");
case 17: format(res,sizeof(res),"Tear Gas");
case 18: format(res,sizeof(res),"Molotov Cocktail");
case 22: format(res,sizeof(res),"9mm Pistol");
case 23: format(res,sizeof(res),"Silenced 9mm Pistol");
case 24: format(res,sizeof(res),"Desert Eagle");
case 25: format(res,sizeof(res),"Pump Shotgun");
case 26: format(res,sizeof(res),"Sawnoff Shotgun");
case 27: format(res,sizeof(res),"Combat Shotgun");
case 28: format(res,sizeof(res),"Uzi");
case 29: format(res,sizeof(res),"MP5");
case 30: format(res,sizeof(res),"AK-47");
case 31: format(res,sizeof(res),"M4");
case 32: format(res,sizeof(res),"Tec-9");
case 33: format(res,sizeof(res),"Country Rifle");
case 34: format(res,sizeof(res),"Sniper Rifle");
case 35: format(res,sizeof(res),"RPG");
case 36: format(res,sizeof(res),"Heat Seeker");
case 37: format(res,sizeof(res),"Flamethrower");
case 38: format(res,sizeof(res),"Minigun");
case 39: format(res,sizeof(res),"Satchel Charge");
case 40: format(res,sizeof(res),"Detonator");
case 41: format(res,sizeof(res),"Pepper Spray");
case 42: format(res,sizeof(res),"Fire Extinguisher");
case 43: format(res,sizeof(res),"Camera");
case 44: format(res,sizeof(res),"Night Vision Goggles");
case 45: format(res,sizeof(res),"Thermal Goggles");
case 46: format(res,sizeof(res),"Parachute");
default: format(res,sizeof(res),"Unknown");
}
return res;
}