Quote:
Originally Posted by Unrea1
Use switch, is more fast.
PHP код:
SetPlayerLevelName(playerid)
{
switch(PlayerInfo[playerid][pLevel])
{
case 1: PlayerInfo[playerid][pLevelName] = "Private I";
case 2: PlayerInfo[playerid][pLevelName] = "Private II";
case 3: PlayerInfo[playerid][pLevelName] = "Private III";
case 4: PlayerInfo[playerid][pLevelName] = "Private First Class";
case 5: PlayerInfo[playerid][pLevelName] = "Specialist";
case 6: PlayerInfo[playerid][pLevelName] = "Corporal";
case 7: PlayerInfo[playerid][pLevelName] = "Sergeant";
case 8: PlayerInfo[playerid][pLevelName] = "Staff Sergeant";
case 9: PlayerInfo[playerid][pLevelName] = "Sergeant First Class";
case 10: PlayerInfo[playerid][pLevelName] = "Master Sergeant";
case 11: PlayerInfo[playerid][pLevelName] = "First Sergeant";
case 12: PlayerInfo[playerid][pLevelName] = "Sergeant Major";
case 13: PlayerInfo[playerid][pLevelName] = "Command Sergeant Major";
case 14: PlayerInfo[playerid][pLevelName] = "Sergeant Major of the Army";
case 15: PlayerInfo[playerid][pLevelName] = "Warrant Officer";
case 16: PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer II";
case 17: PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer III";
case 18: PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer IV";
case 19: PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer V";
case 20: PlayerInfo[playerid][pLevelName] = "Second Lieutenant";
case 21: PlayerInfo[playerid][pLevelName] = "First Lieutenant";
case 22: PlayerInfo[playerid][pLevelName] = "Captain";
case 23: PlayerInfo[playerid][pLevelName] = "Major";
case 24: PlayerInfo[playerid][pLevelName] = "Lieutenant Colonel";
case 25: PlayerInfo[playerid][pLevelName] = "Colonel";
case 26: PlayerInfo[playerid][pLevelName] = "Brigadier General";
case 27: PlayerInfo[playerid][pLevelName] = "Major General";
case 28: PlayerInfo[playerid][pLevelName] = "Lieutenant General";
case 29: PlayerInfo[playerid][pLevelName] = "General";
case 30: PlayerInfo[playerid][pLevelName] = "General of the Army";
}
return 1;
}
Try increasing the value of the PlayerInfo[playerid][pLevelName]
PHP код:
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pVIP,
pXP,
pLevel,
pLevelName[128],
pTeam
}
|
I've already tried increasing the size of pLevelName. Oddly enough this issue only appeared after I made this command:
Код:
CMD:stats(playerid, params[])
{
new name[24], string1[128], string2[128], string3[128], year, month, day;
GetPlayerName(playerid, name, sizeof(name));
getdate(year,month,day);
SendClientMessage(playerid, COLOR_YELLOW, "-| Stats |-");
format(string1, sizeof(string1), "Name: %s | Joined on %d/%d/%d | Team: %s", name, month, day, year, GetPlayerTeamName(playerid));
format(string2, sizeof(string2), "Level: %d (%s) | XP: %d | Cash: $%s | Kills: %d | Deaths: %d", PlayerInfo[playerid][pLevel], GetPlayerLevelName(playerid), PlayerInfo[playerid][pXP], GetPlayerMoney(playerid), PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
format(string3, sizeof(string3), "VIP Level: %d | Admin Level: %d", PlayerInfo[playerid][pVIP], PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW, string1);
SendClientMessage(playerid, COLOR_YELLOW, string2);
SendClientMessage(playerid, COLOR_YELLOW, string3);
return 1;
}
which I don't understand why they'd be related