12.10.2013, 14:19
Hi-
I made a public function for faction ranks (probably noobish :c)
But anyway. Made a test command, too.
There's that. But for the command, it's giving me one error.
Error:
(Don't care about the warnings)
Line 3089:
I made a public function for faction ranks (probably noobish :c)
But anyway. Made a test command, too.
Код:
forward GetPlayerRank(playerid); public GetPlayerRank(playerid) { new ranktext[64]; new faction = PlayerInfo[playerid][pFaction]; switch(faction) { case 1: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "Sheriff"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Undersheriff"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "Assistant Sheriff"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "Captain"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "Lieutenant"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "Sergeant"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Corporal"; } else if(PlayerInfo[playerid][pRank] == 8) { ranktext = "Deputy Sheriff II"; } else if(PlayerInfo[playerid][pRank] == 9) { ranktext = "Deputy Sheriff I"; } else if(PlayerInfo[playerid][pRank] == 10) { ranktext = "Deputy Sheriff Generalist"; } else { ranktext = "Civilian Field Assistant"; } } case 2: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "Fire Chief"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Deputy Chief"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "Assistant Chief"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "Fire Captain"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "Fire Lieutenant"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "Supervisor"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Fire Fighter II"; } else if(PlayerInfo[playerid][pRank] == 8) { ranktext = "Fire Fighter I"; } else if(PlayerInfo[playerid][pRank] == 9) { ranktext = "Probationary FireFighter"; } else { ranktext = "Probationary FireFighter"; } } case 3: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "EMS Supervisor"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Part-time Supervisor"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "EMS Team Leader"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "EMT-P"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "EMT-B"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "EMT Student"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Attendant"; } else { ranktext = "Attendant"; } } case 4: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "Race Leader"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Race Underleader"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "Pro Racer"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "Race Technician"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "Outside Racer"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "Track Tester"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Beginner"; } else { ranktext = "Unknown"; } } case 5: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "Commissioner"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Deputy Commissioner"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "Assistant Commissioner"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "Captain"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "Lieutenant"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "Staff Sergeant"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Sergeant"; } else if(PlayerInfo[playerid][pRank] == 8) { ranktext = "Corporal"; } else if(PlayerInfo[playerid][pRank] == 9) { ranktext = "Senior Correction Officer"; } else if(PlayerInfo[playerid][pRank] == 10) { ranktext = "Correction Officer"; } else { ranktext = "Contract Worker"; } } case 6: { if(PlayerInfo[playerid][pRank] == 1) { ranktext = "Chief of Police"; } else if(PlayerInfo[playerid][pRank] == 2) { ranktext = "Assistant Chief of Police"; } else if(PlayerInfo[playerid][pRank] == 3) { ranktext = "Commander"; } else if(PlayerInfo[playerid][pRank] == 4) { ranktext = "Captain"; } else if(PlayerInfo[playerid][pRank] == 5) { ranktext = "Lieutenant"; } else if(PlayerInfo[playerid][pRank] == 6) { ranktext = "Sergeant III"; } else if(PlayerInfo[playerid][pRank] == 7) { ranktext = "Sergeant II"; } else if(PlayerInfo[playerid][pRank] == 8) { ranktext = "Sergeant I"; } else if(PlayerInfo[playerid][pRank] == 9) { ranktext = "Senior Lead Officer"; } else if(PlayerInfo[playerid][pRank] == 10) { ranktext = "Police Officer III"; } else if(PlayerInfo[playerid][pRank] == 11) { ranktext = "Police Officer II"; } else if(PlayerInfo[playerid][pRank] == 12) { ranktext = "Police Officer I"; } else { ranktext = "Police Officer I"; } } } return 1; }
Код:
CMD:test(playerid, params[]) { new sendername[MAX_PLAYER_NAME], string[128]; new rank[64] = GetPlayerRank(playerid); new faction = PlayerInfo[playerid][pFaction]; new ftext[64]; if(isnull(params)) return SCM(playerid, COLOR_WHITE,"{808080}USAGE: /test(deparments)"); if(PlayerInfo[playerid][pFaction] == 0) return SCM(playerid, COLOR_GREY, "You must be FD/SD/FBI to use this!"); GetPlayerName(playerid,sendername,sizeof(sendername)); sendername[strfind(sendername,"_")] = ' '; switch(faction) { case 1: { ftext = "LAW"; } case 2: { ftext = "FD"; } case 3: { ftext = "EMS"; } case 5: { ftext = "DoC"; } case 6: { ftext = "LAW"; } } format(string,sizeof(string), "** [%s] %s %s: %s **", ftext, rank, sendername, params); DBroadCast(COLOR_DEP,string); format(string,sizeof(string)," (Radio) %s says: %s ", sendername, params); SetPlayerChatBubble(playerid, string, COLOR_WHITE, 100.0, 10000); return 1; }
Код:
C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(1035) : warning 202: number of arguments does not match definition C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(1163) : warning 202: number of arguments does not match definition C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(2320) : warning 219: local variable "string" shadows a variable at a preceding level C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(3089) : error 008: must be a constant expression; assumed zero C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(4419) : warning 217: loose indentation C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(4427) : warning 217: loose indentation C:\Users\Scoot\Desktop\gecko\gamemodes\Gecko.pwn(6369) : warning 203: symbol is never used: "id" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Line 3089:
Код:
new rank[64] = GetPlayerRank(playerid);