stock SetPlayerLevelName(playerid) { if(PlayerInfo[playerid][pLevel] == 1) PlayerInfo[playerid][pLevelName] = "Private I"; if(PlayerInfo[playerid][pLevel] == 2) PlayerInfo[playerid][pLevelName] = "Private II"; if(PlayerInfo[playerid][pLevel] == 3) PlayerInfo[playerid][pLevelName] = "Private III"; if(PlayerInfo[playerid][pLevel] == 4) PlayerInfo[playerid][pLevelName] = "Private First Class"; if(PlayerInfo[playerid][pLevel] == 5) PlayerInfo[playerid][pLevelName] = "Specialist"; if(PlayerInfo[playerid][pLevel] == 6) PlayerInfo[playerid][pLevelName] = "Corporal"; if(PlayerInfo[playerid][pLevel] == 7) PlayerInfo[playerid][pLevelName] = "Sergeant"; if(PlayerInfo[playerid][pLevel] == 8) PlayerInfo[playerid][pLevelName] = "Staff Sergeant"; if(PlayerInfo[playerid][pLevel] == 9) PlayerInfo[playerid][pLevelName] = "Sergeant First Class"; if(PlayerInfo[playerid][pLevel] == 10) PlayerInfo[playerid][pLevelName] = "Master Sergeant"; if(PlayerInfo[playerid][pLevel] == 11) PlayerInfo[playerid][pLevelName] = "First Sergeant"; if(PlayerInfo[playerid][pLevel] == 12) PlayerInfo[playerid][pLevelName] = "Sergeant Major"; if(PlayerInfo[playerid][pLevel] == 13) PlayerInfo[playerid][pLevelName] = "Command Sergeant Major"; if(PlayerInfo[playerid][pLevel] == 14) PlayerInfo[playerid][pLevelName] = "Sergeant Major of the Army"; if(PlayerInfo[playerid][pLevel] == 15) PlayerInfo[playerid][pLevelName] = "Warrant Officer"; if(PlayerInfo[playerid][pLevel] == 16) PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer II"; if(PlayerInfo[playerid][pLevel] == 17) PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer III"; if(PlayerInfo[playerid][pLevel] == 18) PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer IV"; if(PlayerInfo[playerid][pLevel] == 19) PlayerInfo[playerid][pLevelName] = "Chief Warrant Officer V"; if(PlayerInfo[playerid][pLevel] == 20) PlayerInfo[playerid][pLevelName] = "Second Lieutenant"; if(PlayerInfo[playerid][pLevel] == 21) PlayerInfo[playerid][pLevelName] = "First Lieutenant"; if(PlayerInfo[playerid][pLevel] == 22) PlayerInfo[playerid][pLevelName] = "Captain"; if(PlayerInfo[playerid][pLevel] == 23) PlayerInfo[playerid][pLevelName] = "Major"; if(PlayerInfo[playerid][pLevel] == 24) PlayerInfo[playerid][pLevelName] = "Lieutenant Colonel"; if(PlayerInfo[playerid][pLevel] == 25) PlayerInfo[playerid][pLevelName] = "Colonel"; if(PlayerInfo[playerid][pLevel] == 26) PlayerInfo[playerid][pLevelName] = "Brigadier General"; if(PlayerInfo[playerid][pLevel] == 27) PlayerInfo[playerid][pLevelName] = "Major General"; if(PlayerInfo[playerid][pLevel] == 28) PlayerInfo[playerid][pLevelName] = "Lieutenant General"; if(PlayerInfo[playerid][pLevel] == 29) PlayerInfo[playerid][pLevelName] = "General"; if(PlayerInfo[playerid][pLevel] == 30) PlayerInfo[playerid][pLevelName] = "General of the Army"; }
enum pInfo { pPass, pCash, pAdmin, pKills, pDeaths, pVIP, pXP, pLevel, pLevelName[64], pTeam }
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;
}
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pVIP,
pXP,
pLevel,
pLevelName[128],
pTeam
}
Use switch, is more fast.
PHP код:
PHP код:
|
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; }
stock GetPlayerLevelName(playerid) { SetPlayerLevelName(playerid); return PlayerInfo[playerid][pLevelName]; }
SetPlayerLevelName(playerid)
{
strdel(PlayerInfo[playerid][pLevelName],0,128);
switch(PlayerInfo[playerid][pLevel])
{
case 1: strins(PlayerInfo[playerid][pLevelName],"Private I",0,128);
case 2: strins(PlayerInfo[playerid][pLevelName],"Private II",0,128);
case 3: strins(PlayerInfo[playerid][pLevelName],"Private III",0,128);
case 4: strins(PlayerInfo[playerid][pLevelName],"Private First Class",0,128);
case 5: strins(PlayerInfo[playerid][pLevelName],"Specialist",0,128);
case 6: strins(PlayerInfo[playerid][pLevelName],"Corporal",0,128);
case 7: strins(PlayerInfo[playerid][pLevelName],"Sergeant",0,128);
case 8: strins(PlayerInfo[playerid][pLevelName],"Staff Sergeant",0,128);
case 9: strins(PlayerInfo[playerid][pLevelName],"Sergeant First Class",0,128);
case 10: strins(PlayerInfo[playerid][pLevelName],"Master Sergeant",0,128);
case 11: strins(PlayerInfo[playerid][pLevelName],"First Sergeant",0,128);
case 12: strins(PlayerInfo[playerid][pLevelName],"Sergeant Major",0,128);
case 13: strins(PlayerInfo[playerid][pLevelName],"Command Sergeant Major",0,128);
case 14: strins(PlayerInfo[playerid][pLevelName],"Sergeant Major of the Army",0,128);
case 15: strins(PlayerInfo[playerid][pLevelName],"Warrant Officer",0,128);
case 16: strins(PlayerInfo[playerid][pLevelName],"Chief Warrant Officer II",0,128);
case 17: strins(PlayerInfo[playerid][pLevelName],"Chief Warrant Officer III",0,128);
case 18: strins(PlayerInfo[playerid][pLevelName],"Chief Warrant Officer IV",0,128);
case 19: strins(PlayerInfo[playerid][pLevelName],"Chief Warrant Officer V",0,128);
case 20: strins(PlayerInfo[playerid][pLevelName],"Second Lieutenant",0,128);
case 21: strins(PlayerInfo[playerid][pLevelName],"First Lieutenant",0,128);
case 22: strins(PlayerInfo[playerid][pLevelName],"Captain",0,128);
case 23: strins(PlayerInfo[playerid][pLevelName],"Major",0,128);
case 24: strins(PlayerInfo[playerid][pLevelName],"Lieutenant Colonel",0,128);
case 25: strins(PlayerInfo[playerid][pLevelName],"Colonel",0,128);
case 26: strins(PlayerInfo[playerid][pLevelName],"Brigadier General",0,128);
case 27: strins(PlayerInfo[playerid][pLevelName],"Major General",0,128);
case 28: strins(PlayerInfo[playerid][pLevelName],"Lieutenant General",0,128);
case 29: strins(PlayerInfo[playerid][pLevelName],"General",0,128);
case 30: strins(PlayerInfo[playerid][pLevelName],"General of the Army",0,128);
}
return 1;
}
SetPlayerLevelName(playerid)
{
PlayerInfo[playerid][pLevelName] = EOS;
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;
}
PHP код:
|
stock GetPlayerTeamName(playerid); { new team; team = GetPlayerTeam(playerid); if(team == TEAM_USA) return "United States"; if(team == TEAM_CANADA) return "Canada"; if(team == TEAM_BRITAIN) return "Britain"; if(team == TEAM_AUSTRALIA) return "Australia"; if(team == TEAM_RUSSIA) return "Russia"; if(team == TEAM_GERMANY) return "Germany"; if(team == TEAM_ITALY) return "Italy"; if(team == TEAM_FRANCE) return "France"; if(team == TEAM_CHINA) return "China"; if(team == TEAM_INDIA) return "India"; }
C:\Users\keega\OneDrive\Desktop\SAMP server\pawno\include\YSI\..\YSI_Storage\..\YSI_Core\y_utils.inc(430) : warning 201: redefinition of constant/macro (symbol "isnull(%1)") C:\Users\keega\OneDrive\Desktop\SAMP server\pawno\include\mGates.inc(346) : warning 213: tag mismatch C:\Users\keega\OneDrive\Desktop\SAMP server\pawno\include\mGates.inc(378) : warning 213: tag mismatch C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(103) : warning 213: tag mismatch C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(104) : warning 213: tag mismatch C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(567) : error 004: function "GetPlayerTeamName" is not implemented C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(746) : warning 219: local variable "team" shadows a variable at a preceding level C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(843) : error 055: start of function body without function header C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(845) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(846) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(847) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(848) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(849) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(850) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(851) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(852) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(853) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(854) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(855) : error 010: invalid function or declaration C:\Users\keega\OneDrive\Desktop\SAMP server\gamemodes\maude1.pwn(857) : warning 203: symbol is never used: "team" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 13 Errors.
GetPlayerTeamName(playerid)
{
new szString[24];
switch(GetPlayerTeam(playerid))
{
case TEAM_USA: szString = "United States";
case TEAM_CANADA: szString = "Canada";
case TEAM_BRITAIN: szString = "Britain";
case TEAM_AUSTRALIA: szString = "Australia";
case TEAM_RUSSIA: szString = "Russia";
case TEAM_GERMANY: szString = "Germany";
case TEAM_ITALY: szString = "Italy";
case TEAM_FRANCE: szString = "France";
case TEAM_CHINA: szString = "China";
case TEAM_INDIA: szString = "India";
}
return szString;
}