Checkpoint
#1

Код:
	if(IsPlayerInRangeOfPoint(playerid, 5.0, 2227.7256, -1707.8555, 13.6281))
	{
	    SetPlayerCheckpoint(playerid, 2227.7256, -1707.8555, 13.6281, 1.0);
    }
Код:
	if(IsPlayerInRangeOfPoint(playerid, 1.0, 2227.7256, -1707.8555, 13.6281))
	{
       ShowPlayerDialog(playerid, ATM, DIALOG_STYLE_LIST, "ATM","View Balance\nWithdraw\nDeposit", "Select", "Cancel");
	}
This is my code, how can I make so when I left the checkpoint area the checkpoint disappears?
Reply
#2

Hi,

Try this one :

PHP код:
if(IsPlayerInRangeOfPoint(playerid1.02227.7256, -1707.855513.6281)) // Make a position when the player is far from the checkpoint
    
{
       
DisablePlayerCheckpoint(playerid);
    } 
Hope it helps.

KillerDVX,
Reply
#3

Some where in your code put
PHP код:
forward playerOnLeaveCheckPoint(playerid);
public 
playerOnLeaveCheckPoint(
     
DisablePlayerCheckpoint(playerid);
     return 
1;

Then in your main gamemode where it says
PHP код:
public OnPlayerLeaveCheckpoint(playerid) {
     
playerOnLeaveCheckPoint(playerid); // <-- Put that 

Reply
#4

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Some where in your code put
PHP код:
forward playerOnLeaveCheckPoint(playerid);
public 
playerOnLeaveCheckPoint(
     
DisablePlayerCheckpoint(playerid);
     return 
1;

Then under
PHP код:
public OnPlayerLeaveCheckpoint(playerid) {
     
playerOnLeaveCheckPoint(playerid);

Why would he define OnPlayerLeaveCheckpoint instead of making a far point of range?
Reply
#5

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
Why would he define OnPlayerLeaveCheckpoint instead of making a far point of range?
Do you not know how to read?
He said: He wants the checkpoint to delete when HE LEAVES it.

My code does that.
Your code deletes the checkpoint when he is in range of it.
Reply
#6

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Some where in your code put
PHP код:
forward playerOnLeaveCheckPoint(playerid);
public 
playerOnLeaveCheckPoint(
     
DisablePlayerCheckpoint(playerid);
     return 
1;

Then in your main gamemode where it says
PHP код:
public OnPlayerLeaveCheckpoint(playerid) {
     
playerOnLeaveCheckPoint(playerid); // <-- Put that 

Why not simply do:
Код:
public OnPlayerLeaveCheckpoint(playerid)
{ 
     DisablePlayerCheckpoint(playerid);
     return 1;  
}
Reply
#7

Quote:
Originally Posted by Larceny
Посмотреть сообщение
Why not simply do:
Код:
public OnPlayerLeaveCheckpoint(playerid)
{ 
     DisablePlayerCheckpoint(playerid);
     return 1;  
}
This would work but I have other checkpoints that creates new checkpoints and won't this destroy them?

How can I make so its only for a special selection of checkpoints?
Reply
#8

Quote:
Originally Posted by DavidSparks
Посмотреть сообщение
This would work but I have other checkpoints that creates new checkpoints and won't this destroy them?

How can I make so its only for a special selection of checkpoints?
You can check by the checkpoint position.

Код:

public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, CHECKPOINT_RADIUS + 2.0, 2227.7256, -1707.8555, 13.6281))
        DisablePlayerCheckpoint(playerid);
    return 1;  
}
Reply
#9

Quote:
Originally Posted by Larceny
Посмотреть сообщение
You can check by the checkpoint position.

Код:

public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, CHECKPOINT_RADIUS + 2.0, 2227.7256, -1707.8555, 13.6281))
        DisablePlayerCheckpoint(playerid);
    return 1;  
}
Thanks! +rep
Reply
#10

Quote:
Originally Posted by Larceny
Посмотреть сообщение
You can check by the checkpoint position.

Код:

public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, CHECKPOINT_RADIUS + 2.0, 2227.7256, -1707.8555, 13.6281))
        DisablePlayerCheckpoint(playerid);
    return 1;  
}
I get a error when I compile

Код:
error 017: undefined symbol "CHECKPOINT_RADIUS"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)