SA-MP Forums Archive
Dynamic Checkpoints 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: Dynamic Checkpoints Problem (/showthread.php?tid=602411)



Dynamic Checkpoints Problem - Sensation - 06.03.2016

Hi all! I am using Incognito's dynamic checkpoints system. My problem:

When I entered a checkpoint (created by CP[id][cpid] = CreateDynamicCP(.....); ) and use this command, it says "You are not in checkpoint". How can i fix this problem. Please help me.


Код:
CMD:cptest(playerid,params[])
{
foreach(new i : checkpoints)
{
if(!IsPlayerInDynamicCP(playerid,CP[i][cpid]))
{
SendClientMessage(playerid,-1,"You are not in checkpoint!");
return 1;
}
}
.
.
.
.
.
return 1;
}



Re: Dynamic Checkpoints Problem - N0FeaR - 06.03.2016

Show me the command.


Re: Dynamic Checkpoints Problem - DRIFT_HUNTER - 06.03.2016

You will start looping thru all CP's (i guess only valid ones but its not the point now)
Then you check if player is not inside CP, and if he is not you send error message. After that you just return, meaning you terminate your code.


Basically, if player is not in first CP from that loop, it will send error and finish processing your command...

Try these...
Код:
CMD:cptest(playerid,params[])
{
	foreach(new i : checkpoints)
	{
		if(IsPlayerInDynamicCP(playerid,CP[i][cpid]))
		{
			//Yay we found out that player is in these CP, do what you want...
			return 1;
		}
	}
	//If we ever reach these point in code that means player is not in any CP from loop....
	SendClientMessage(playerid,-1,"You are not in checkpoint!");
	return 1;
}



Re: Dynamic Checkpoints Problem - Sensation - 06.03.2016

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
You will start looping thru all CP's (i guess only valid ones but its not the point now)
Then you check if player is not inside CP, and if he is not you send error message. After that you just return, meaning you terminate your code.


Basically, if player is not in first CP from that loop, it will send error and finish processing your command...

Try these...
Код:
CMD:cptest(playerid,params[])
{
	foreach(new i : checkpoints)
	{
		if(IsPlayerInDynamicCP(playerid,CP[i][cpid]))
		{
			//Yay we found out that player is in these CP, do what you want...
			return 1;
		}
	}
	//If we ever reach these point in code that means player is not in any CP from loop....
	SendClientMessage(playerid,-1,"You are not in checkpoint!");
	return 1;
}
It's working. Thank you so much.. +rep