Checkpoint problem
#3

for checkpoint-decisions, try switch{case{}case{}} instead of if{}if{}. if's will get called even if the first one got triggered when you didnt use an else-if. even if you use the else, then it will loop through them until a decision is done or w/o result: it uses CPU time if you extend the amount later.
the switch/case avoids that behavior, it prepares a quick decision "table", and for one case it triggers the action. well, i describe it horribly, just look at this piece:
Код:
	new NewVehicleID = GetPlayerVehicleID(playerid);
	switch(checkpointid)
	{
		case Mcheck[0]:
		{
			if(OldVehicleID[playerid] != NewVehicleID) return SendClientMessage(playerid,COLOR_RED,"This vehicle does not contain a passenger!");
			// stop previous CP
			DestroyDynamicCP(Mcheck[0]);
			Mcheck[1] = CreateDynamicCP(mInfo[playerid][Del_x], mInfo[playerid][Del_y], mInfo[playerid][Del_z], 2.0, -1, -1, playerid, 400000.0);
		}
		case Mcheck[1]:
		{
			SendClientMessage(playerid,COLOR_RED,"completed the mission");
		}
	}
iam curious if this works. didnt test it indeed ^^
Reply


Messages In This Thread
Checkpoint problem - by knackworst - 08.10.2011, 21:31
Re: Checkpoint problem - by =WoR=G4M3Ov3r - 08.10.2011, 22:19
Re: Checkpoint problem - by Babul - 08.10.2011, 22:33
Re: Checkpoint problem - by knackworst - 08.10.2011, 22:36
Re: Checkpoint problem - by Babul - 08.10.2011, 22:56
Re: Checkpoint problem - by knackworst - 08.10.2011, 23:05
Re: Checkpoint problem - by Babul - 08.10.2011, 23:13
Re: Checkpoint problem - by knackworst - 08.10.2011, 23:17
Re: Checkpoint problem - by Babul - 09.10.2011, 20:02

Forum Jump:


Users browsing this thread: 3 Guest(s)