SA-MP Forums Archive
Job using switch problem - 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: Job using switch problem (/showthread.php?tid=341614)



Job using switch problem - D-12 - 11.05.2012

Hello. I've been trying to make this job script using switch. But I'm having some trouble. My job command gives a checkpoint to enter, as report to the boss. As you enter that checkpoint, you're given a new one, to fix a window. But entering the checkpoint basically spams you with the fix the window message, without a new checkpoint being displayed.

I get a warning on the compile.

Код:
SAMP 0.3d\gamemodes\Jobs.pwn(267) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warning.
This is the line for the switch, 267.

Код:
         	switch(ConstructionPickup[playerid][0])
The rest of the code, as you enter the checkpoints. Please tell me how to fix the problem and to improve it. I would appreciate it.

Код:
public OnPlayerEnterCheckpoint(playerid)

{
if(PlayerInfo[playerid][pJobWork] == 1)
         {
         	switch(ConstructionPickup[playerid][0])
          	{
			case 0:
			{
			SetPlayerCheckpoint(playerid, 1244.8558,-1265.6775,13.3878,2.0);
			SendClientMessage(playerid, COLOR_GREY, "The boss claims some kids smashed a window, you need to fix it.");
			}
			case 1:
			{
			SetPlayerCheckpoint(playerid, 1247.6848,-1256.4512,13.1026,2.0);
			SendClientMessage(playerid, COLOR_GREY, "You repair the window. Go ask for a new task.");
			}
			case 2:
			{
			SetPlayerCheckpoint(playerid, 1247.6848,-1256.4512,13.1026,2.0);
			SendClientMessage(playerid, COLOR_GREY, "You drop the mail into the mailbox. Go ask for a new task.");
			}
			case 3:
			{
			SetPlayerCheckpoint(playerid, 1241.5092,-1263.6698,13.3393,2.0);
			SendClientMessage(playerid, COLOR_GREY, "The power went out, you need to fix the generator.");
			}
			case 4:
			{
			SetPlayerCheckpoint(playerid, 1247.6848,-1256.4512,13.1026,2.0);
			SendClientMessage(playerid, COLOR_GREY, "You repair the generator. Go ask for a new task.");
			}
			case 5:
			{
			PlayerInfo[playerid][pJobWork] = 0;
			GivePlayerMoney(playerid, 1000);
   			DisablePlayerCheckpoint(playerid);
			SendClientMessage(playerid, COLOR_GREY, "The boss has no more tasks for you, the money has been transfered to your paycheck.");
			}
		}
	}
	return 1;
}
Hope you can help me.

D-12.


Re: Job using switch problem - SuperViper - 11.05.2012

Does the variable 'ConstructionPickup' have a tag before it such as Text:, Text3D:, Float:, etc? If so, remove that.


Re: Job using switch problem - D-12 - 11.05.2012

I have it under enum.

Код:
enum pickup
{
Construction
};

new ConstructionPickup[MAX_PLAYERS][pickup];



Re: Job using switch problem - D-12 - 12.05.2012

Any response would be great.