Dynamic Checkpoints Problem
#1

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;
}
Reply
#2

Show me the command.
Reply
#3

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;
}
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)