Errors help. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors help. (
/showthread.php?tid=514218)
Errors help. -
PrinceOfPersia - 20.05.2014
Hello, I've got error in this line 51440
Код:
C:\Users\Mido\Desktop\test server\gamemodes\HSRP.pwn(51440) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Mido\Desktop\test server\gamemodes\HSRP.pwn(51440) : error 017: undefined symbol "cmd_d"
C:\Users\Mido\Desktop\test server\gamemodes\HSRP.pwn(51440) : error 029: invalid expression, assumed zero
C:\Users\Mido\Desktop\test server\gamemodes\HSRP.pwn(51440) : fatal error 107: too many error messages on one line
Line
Код:
CMD:d(playerid, params[])
Re: Errors help. -
Campbell- - 20.05.2014
Check the switch that refers to the first error. There has to be some sort of mistake there as your command follows a case. You're propably missing the end of the switch structure.
Re: Errors help. -
PrinceOfPersia - 20.05.2014
Can you edit it and send it to me, please ?
Re: Errors help. -
PrinceOfPersia - 20.05.2014
Did you forget or something ?
Re: Errors help. -
superrobot48 - 20.05.2014
do u have zcmd?
Re: Errors help. -
PrinceOfPersia - 20.05.2014
Yes, I have ZCMD.
Re: Errors help. -
JFF - 20.05.2014
show us the whole code of the command?
Re: Errors help. -
superrobot48 - 20.05.2014
re-compile ur zcmd include. stop bumping
Re: Errors help. -
PrinceOfPersia - 20.05.2014
Whole code of the cmd
Код:
CMD:d(playerid, params[])
new string[128];
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_RED, "USAGE: (/d)epartments [department chat]");
new employer[16], rank[64], division[16];
switch (PlayerInfo[playerid][pMember]) // employer/rank/division data is pulled from here
{
case 1:
{
employer = "[SAPD]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Police Officer";
case 2: rank = "Corporal";
case 3: rank = "Sergeant";
case 4: rank = "Liuetenant";
case 5: rank = "Captain";
case 6: rank = "Chief of Police";
default: rank = "Probationary Officer";
}
}
case 2:
{
employer = "[FBI]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Probationary Agent";
case 2: rank = "Federal Agent";
case 3: rank = "Senior Federal Agent";
case 4: rank = "Special Federal Agent";
case 5: rank = "Assistant Federal Director";
case 6: rank = "Federal Director";
default: rank = "Probationary Agent";
}
}
case 3:
{
employer = "[SASP]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Officer";
case 2: rank = "Corporal";
case 3: rank = "Sergeant";
case 4: rank = "Lieutenant";
case 5: rank = "Captain";
case 6: rank = "Chief";
default: rank = "Cadet";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(HR) ";
case 2: division = "(ERT) ";
case 3: division = "(IA) ";
case 4: division = "(SO) ";
default: division = "";
}
}
case 4:
{
employer = "[FDSA]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "EMT Intermediate";
case 2: rank = "EMT Paramedic";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "Deputy Chief";
case 6: rank = "Chief";
default: rank = "EMT Basic";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(FD) ";
case 2: division = "(LF) ";
case 3: division = "(T&R) ";
default: division = "";
}
}
case 5:
{
employer = "[Supreme Court]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Clerk of Court";
case 2: rank = "District Attorney";
case 3: rank = "District Judge";
case 4: rank = "Appellate Judge";
case 5: rank = "Associate Justice of the Supreme Court";
case 6: rank = "Chief Justice of the Supreme Court";
default: rank = "Clerk of Court";
}
}
case 6:
{
employer = "[Government]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Staff Member";
case 2: rank = "G.E.T. Officer";
case 3: rank = "Legislator";
case 4: rank = "Government Cabinet";
case 5: rank = "Lieutenant Governor";
case 6: rank = "Governor";
default: rank = "Intern";
}
}
case 7:
{
employer = "[SAST]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "State Trooper";
case 2: rank = "State Corporal";
case 3: rank = "State Sergeant";
case 4: rank = "State Liuetenant";
case 5: rank = "State Colonel";
case 6: rank = "State General";
default: rank = "State Cadet";
}
switch(PlayerInfo[playerid][pDivision])
{
case 2: division = "(TET) ";
case 3: division = "(SCU) ";
case 4: division = "(SORT) ";
case 5: division = "(FTO) ";
default: division = "";
}
}
case 11:
{
employer = "National Guard";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank= "Private";
case 1: rank = "Corporal";
case 2: rank = "Sergeant";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "Major";
case 6: rank = "General";
default: rank = "Private";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(AIR) ";
case 2: division = "(ARM) ";
case 3: division = "(VET) ";
case 4: division = "(AIR SF) ";
case 5: division = "(ARM SF) ";
case 6: division = "(INF) ";
default: division = "";
}
}
case 11:
{
employer = "Trojan International";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank= "Probationary Operative";
case 1: rank = "Operative";
case 2: rank = "Operative II";
case 3: rank = "Trusted Operative";
case 4: rank = "Trusted Operative II";
case 5: rank = "Co-Chief Operative";
case 6: rank = "Chief Operative";
default: rank = "Probationary Agent";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(AIR) ";
case 2: division = "(ARM) ";
case 3: division = "(VET) ";
case 4: division = "(AIR SF) ";
case 5: division = "(ARM SF) ";
case 6: division = "(INF) ";
default: division = "";
}
}
case 13:
{
employer = "[NOOSE]";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank = "Ensign";
case 1: rank = "Marksman";
case 2: rank = "Elite Marksman";
case 3: rank = "Operative";
case 4: rank = "Elite Operative";
case 5: rank = "Vice Commander";
case 6: rank = "Supreme Commander";
default: rank = "Ensign";
}
division = "";
}
Re: Errors help. -
JFF - 20.05.2014
u used case 11 twice try this
pawn Код:
CMD:d(playerid, params[])
{
new string[128];
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_RED, "USAGE: (/d)epartments [department chat]");
new employer[16], rank[64], division[16];
switch (PlayerInfo[playerid][pMember]) // employer/rank/division data is pulled from here
{
case 1:
{
employer = "[SAPD]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Police Officer";
case 2: rank = "Corporal";
case 3: rank = "Sergeant";
case 4: rank = "Liuetenant";
case 5: rank = "Captain";
case 6: rank = "Chief of Police";
default: rank = "Probationary Officer";
}
}
case 2:
{
employer = "[FBI]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Probationary Agent";
case 2: rank = "Federal Agent";
case 3: rank = "Senior Federal Agent";
case 4: rank = "Special Federal Agent";
case 5: rank = "Assistant Federal Director";
case 6: rank = "Federal Director";
default: rank = "Probationary Agent";
}
}
case 3:
{
employer = "[SASP]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Officer";
case 2: rank = "Corporal";
case 3: rank = "Sergeant";
case 4: rank = "Lieutenant";
case 5: rank = "Captain";
case 6: rank = "Chief";
default: rank = "Cadet";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(HR) ";
case 2: division = "(ERT) ";
case 3: division = "(IA) ";
case 4: division = "(SO) ";
default: division = "";
}
}
case 4:
{
employer = "[FDSA]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "EMT Intermediate";
case 2: rank = "EMT Paramedic";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "Deputy Chief";
case 6: rank = "Chief";
default: rank = "EMT Basic";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(FD) ";
case 2: division = "(LF) ";
case 3: division = "(T&R) ";
default: division = "";
}
}
case 5:
{
employer = "[Supreme Court]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Clerk of Court";
case 2: rank = "District Attorney";
case 3: rank = "District Judge";
case 4: rank = "Appellate Judge";
case 5: rank = "Associate Justice of the Supreme Court";
case 6: rank = "Chief Justice of the Supreme Court";
default: rank = "Clerk of Court";
}
}
case 6:
{
employer = "[Government]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Staff Member";
case 2: rank = "G.E.T. Officer";
case 3: rank = "Legislator";
case 4: rank = "Government Cabinet";
case 5: rank = "Lieutenant Governor";
case 6: rank = "Governor";
default: rank = "Intern";
}
}
case 7:
{
employer = "[SAST]";
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "State Trooper";
case 2: rank = "State Corporal";
case 3: rank = "State Sergeant";
case 4: rank = "State Liuetenant";
case 5: rank = "State Colonel";
case 6: rank = "State General";
default: rank = "State Cadet";
}
switch(PlayerInfo[playerid][pDivision])
{
case 2: division = "(TET) ";
case 3: division = "(SCU) ";
case 4: division = "(SORT) ";
case 5: division = "(FTO) ";
default: division = "";
}
}
case 11:
{
employer = "National Guard";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank= "Private";
case 1: rank = "Corporal";
case 2: rank = "Sergeant";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "Major";
case 6: rank = "General";
default: rank = "Private";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(AIR) ";
case 2: division = "(ARM) ";
case 3: division = "(VET) ";
case 4: division = "(AIR SF) ";
case 5: division = "(ARM SF) ";
case 6: division = "(INF) ";
default: division = "";
}
}
case 12:
{
employer = "Trojan International";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank= "Probationary Operative";
case 1: rank = "Operative";
case 2: rank = "Operative II";
case 3: rank = "Trusted Operative";
case 4: rank = "Trusted Operative II";
case 5: rank = "Co-Chief Operative";
case 6: rank = "Chief Operative";
default: rank = "Probationary Agent";
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "(AIR) ";
case 2: division = "(ARM) ";
case 3: division = "(VET) ";
case 4: division = "(AIR SF) ";
case 5: division = "(ARM SF) ";
case 6: division = "(INF) ";
default: division = "";
}
}
case 13:
{
employer = "[NOOSE]";
switch(PlayerInfo[playerid][pRank])
{
case 0: rank = "Ensign";
case 1: rank = "Marksman";
case 2: rank = "Elite Marksman";
case 3: rank = "Operative";
case 4: rank = "Elite Operative";
case 5: rank = "Vice Commander";
case 6: rank = "Supreme Commander";
default: rank = "Ensign";
}
division = "";
}
}
}