[Help] please im stuck on this one
#1

Hiya can anyone help i have made a job help system and if i just use pjob 1 on its onw it works fine but when i add the next job to the code it fucks up and dont work proberly. what am i doing wrong guys any idea?

[quote]
public JobHelp(playerid, time, block)
{
switch(PlayerInfo[playerid][pJob])
{
case 1:
switch(block)
{
case 0:
{
TogglePlayerControllable(playerid, 0);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
SendClientMessage(playerid, COLOR_GREEN, "harvister job Help.");
SendClientMessage(playerid, COLOR_YELLOW, "Head over to this barn and hop into one of there Harvisters .");
SendClientMessage(playerid, COLOR_YELLOW, "Type /harvest to activate the harvest job .");
}
case 1:
{
SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
SendClientMessage(playerid, COLOR_YELLOW, "Head threw the Markers to havest the feilds without killing yourselve.");
SendClientMessage(playerid, COLOR_YELLOW, "Then drop your load at this shed and receve your payment .");
}
case 2:
{
SendClientMessage(playerid, COLOR_YELLOW, "You will need to wait 30 miniutes before you can harvest again .");
SendClientMessage(playerid, COLOR_GREEN, "We Hope this Tutorial Helped Have Fun And get Farming .");
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);

}
default: return true; //the default need to be added else this function will repeat and repeat :S
}
default: return SendClientMessage(playerid, COLOR_YELLOW, "Jobid isnt defined! Please report this to an admin!");
}
switch(PlayerInfo[playerid][pJob])
{
case 2:
switch(block)
{
case 0:
{
TogglePlayerControllable(playerid, 0);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
SendClientMessage(playerid, COLOR_GREEN, "txt here.");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
}
case 1:
{
SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
SendClientMessage(playerid, COLOR_YELLOW, "txt here.");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
}
case 2:
{
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
SendClientMessage(playerid, COLOR_GREEN, "txt here .");
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);

}
default: return true; //the default need to be added else this function will repeat and repeat :S
}
default: return SendClientMessage(playerid, COLOR_YELLOW, "Jobid isnt defined! Please report this to an admin!");
}
return SetTimerEx("JobHelp", time, false, "ddd", playerid, time, block + 2);
}
Reply
#2

You Dont need a switch i think; just use

Код:
If(PlayerInfo[playerid][Pjob] == (job number)
{
   (the stuff)
}

So Number your jobs, and when people sign up for a job, just Give Them There Job number


Код:
PlayerInfo[playerid][pjob] == 1;
Reply
#3

Awww ok im getting errors now can anyone help me to get this working i really need it thanks

[quote]
forward JobHelp(playerid, time, block);

if(!strcmp("/jobhelp", cmdtext, true))
return JobHelp(playerid, 20000, 0);

public JobHelp(playerid, time, block)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 1)
{
case 1:
{
TogglePlayerControllable(playerid, 0);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
SendClientMessage(playerid, COLOR_GREEN, "harvister job Help.");
SendClientMessage(playerid, COLOR_YELLOW, "Head over to this barn and hop into one of there Harvisters .");
SendClientMessage(playerid, COLOR_YELLOW, "Type /harvest to activate the harvest job .");
}
case 2:
{
SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
SendClientMessage(playerid, COLOR_YELLOW, "Head threw the Markers to havest the feilds without killing yourselve.");
SendClientMessage(playerid, COLOR_YELLOW, "Then drop your load at this shed and receve your payment .");
}
case 3:
{
SendClientMessage(playerid, COLOR_YELLOW, "You will need to wait 30 miniutes before you can harvest again .");
SendClientMessage(playerid, COLOR_GREEN, "We Hope this Tutorial Helped Have Fun And get Farming smiley .");
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);

}
default: return true; //the default need to be added else this function will repeat and repeat :S
}
default: return SendClientMessage(playerid, COLOR_YELLOW, "Jobid isnt defined! Please report this to an admin!");
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 2)
{
case 0:
{
TogglePlayerControllable(playerid, 0);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
SendClientMessage(playerid, COLOR_GREEN, "txt here.");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
}
case 1:
{
SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
SendClientMessage(playerid, COLOR_YELLOW, "txt here.");
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
}
case 2:
{
SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
SendClientMessage(playerid, COLOR_GREEN, "txt here .");
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);

}
default: return true; //the default need to be added else this function will repeat and repeat :S
}
default: return SendClientMessage(playerid, COLOR_YELLOW, "Jobid isnt defined! Please report this to an admin!");
}
return SetTimerEx("JobHelp", time, false, "ddd", playerid, time, block + 2);
}
Reply
#4

Right well the top one compiles fine with no errors but ig when im pjob1 and do /jobhelp it starts and works fine but misses the middle part of the info but if im pjob 2 it comes up with the isint defines speek to an admin txt what have i done wrong with this?? can someone help me plzzzz
Reply
#5

ok got it working thanks for the help not

Код:
public JobHelp(playerid, time, block)
{
	switch(PlayerInfo[playerid][pJob])
	{
		case 1:
			switch(block)
			{
				case 0:
				{
					TogglePlayerControllable(playerid, 0);
					SetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
					SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
					SendClientMessage(playerid, COLOR_GREEN, "harvister job Help.");
					SendClientMessage(playerid, COLOR_YELLOW, "Head over to this barn and hop into one of there Harvisters .");
					SendClientMessage(playerid, COLOR_YELLOW, "Type /harvest to activate the harvest job .");
				}
				case 1:
				{
				  SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
					SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
					SendClientMessage(playerid, COLOR_YELLOW, "Head threw the Markers to havest the feilds without killing yourselve.");
					SendClientMessage(playerid, COLOR_YELLOW, "Then drop your load at this shed and receve your payment  .");
				}
				case 2:
				{
					SendClientMessage(playerid, COLOR_YELLOW, "You will need to wait 30 miniutes before you can harvest again .");
					SendClientMessage(playerid, COLOR_GREEN, "We Hope this Tutorial Helped Have Fun And get Farming :-) .");
					SetCameraBehindPlayer(playerid);
					TogglePlayerControllable(playerid, 1);

				}
				default: return true; //the default need to be added else this function will repeat and repeat :S
		 }
		case 2:
			switch(block)
			{
				case 0:
				{
					TogglePlayerControllable(playerid, 0);
					SetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerCameraPos(playerid, -325.9247,-1468.2753,38.1411);
					SetPlayerCameraLookAt(playerid, -375.1844,-1446.1946,25.7266);
					SendClientMessage(playerid, COLOR_GREEN, "txt here.");
					SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
					SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
				}
				case 1:
				{
				  SetPlayerCameraPos(playerid, -562.0946,-1394.1616,41.4293);
					SetPlayerCameraLookAt(playerid, -581.2280,-1487.2173,10.6660);
					SendClientMessage(playerid, COLOR_YELLOW, "txt here.");
					SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
				}
				case 2:
				{
					SendClientMessage(playerid, COLOR_YELLOW, "txt here .");
					SendClientMessage(playerid, COLOR_GREEN, "txt here .");
					SetCameraBehindPlayer(playerid);
					TogglePlayerControllable(playerid, 1);

				}
				default: return true; //the default need to be added else this function will repeat and repeat :S
			}
			default: return SendClientMessage(playerid, COLOR_YELLOW, "Jobid isnt defined! Please report this to an admin!");
	}
	return SetTimerEx("JobHelp", time, false, "ddd", playerid, time, block + 1);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)