SA-MP Forums Archive
Error in this script - 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: Error in this script (/showthread.php?tid=611469)



Error in this script - Immortal99 - 06.07.2016

This is my script here see case 11 i wanna continue on a next line.

Код:
CMD:ocmds(playerid, params[])
{
	new string[256];
	if (GetPVarInt(playerid, "playerorg") == 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You aren't in an organization!");
	format(string, 10, "ORG%d", GetPVarInt(playerid, "playerorg"));
	SendPlayerFormattedText(playerid, COLOR_LBLUE, "%s commands:", dini_Get(AddDirFile(dir_orgfiles, string), "name"), "");
	switch (orgcata[GetPVarInt(playerid, "playerorg")-1])
	{
		case 2: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /selldrugs, /shipdrugs, /collectdrugs, /robbank, /zones, /open, /close, /resign.");

		case 3: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /heal, /open, /close, /resign.");

		case 4: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /ad, /open, /close, /resign.");

		case 5: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /ad, /open, /close, /resign.");

		case 6: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /confirmhit, /ad, /open, /close, /resign, /trace, /taser.");

		case 7: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /open, /close, /resign.");

		case 11: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /gc, /jail, /unjail, /fine, /want, /cuff, /uncuff, /loc, /pu, /addpoints, /frisk, /takeitem");
                case 11: SendClientMessage2(playerid, COLOR_WHITE, "/open, /close, /resign, /911reply, /taser");

		case 12: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /gc, /jail, /unjail, /want, /cuff, /uncuff, /loc, /pu, /open, /close, /resign, /taser.");

		case 13: SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /gc, /jail, /unjail, /want, /cuff, /uncuff, /loc, /pu, /open, /close, /resign, /taser.");
	}
	return 1;
}
I get this error

Код:
C:\Users\Immortal99\Desktop\Phoenix Gaming\gamemodes\ImmortalRoleplay.pwn(23988) : error 040: duplicate "case" label (value 11)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Help Me


Re: Error in this script - Vince - 06.07.2016

Has it occured to you that you can just use braces?
PHP код:
case 11
{
    
// stuff




Re: Error in this script - Immortal99 - 06.07.2016

I dont know, i got this script from a friend and im trying to put /open, /close, /resign, /911reply, /taser on a new line because that whole case 11 is to long


Re: Error in this script - WrathOfGenesis - 07.07.2016

As Vince said; using braces makes this a lot easier to follow and add more functions to

pawn Код:
case 11:
{
    SendClientMessage2(playerid, COLOR_WHITE, "/oskin, /oc, /gc, /jail, /unjail, /fine, /want, /cuff, /uncuff, /loc, /pu, /addpoints, /frisk, /takeitem");
    SendClientMessage2(playerid, COLOR_WHITE, "/open, /close, /resign, /911reply, /taser");
}