Checkpoint Entering Interior Problem
#1

Hello,
I have this on oncheckpointenter

Код:
case BAR_CP:
	    {
		    SetPlayerInterior(playerid, 11);
		    SetPlayerPos(playerid, 502.2838, -70.2034, 998.7578);
		    SetPlayerFacingAngle(playerid, 181.8469);//
		    return 1;
		}
Quote:
Originally Posted by Charalambos26
Посмотреть сообщение
but this is to difficult for a Scripting Noob like me, or?
Does anybody know how to make a no bugging checkpoint?
I want it to be a red checkpoint, but I should only enter it with an command, this will teleport me to a place.
Reply
#2

PHP код:
// Uses ZCMD/YCMD

CMD:enter(playeridparams[])
{
    if(
IsPlayerInRangeOfPoint(playerid3.0xyz)) // replace x y z with the coordinates of the entrance
    
{
        
SetPlayerInterior(playerid11);
        
SetPlayerPos(playerid502.2838, -70.2034998.7578);
        
SetPlayerFacingAngle(playerid181.8469);
        
SendClientMessage(playerid, -1"You have entered the building.");
    }
    else
    {
        
SendClientMessage(playerid, -1"You cannot enter anything here.");
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by Sellize
Посмотреть сообщение
PHP код:
// Uses ZCMD/YCMD
CMD:enter(playeridparams[])
{
    if(
IsPlayerInRangeOfPoint(playerid3.0xyz)) // replace x y z with the coordinates of the entrance
    
{
        
SetPlayerInterior(playerid11);
        
SetPlayerPos(playerid502.2838, -70.2034998.7578);
        
SetPlayerFacingAngle(playerid181.8469);
        
SendClientMessage(playerid, -1"You have entered the building.");
    }
    else
    {
        
SendClientMessage(playerid, -1"You cannot enter anything here.");
    }
    return 
1;

+1 rep
Thanks, should I put this on OnPlayercommandtext?
And how to make an exit command?
Reply
#4

Quote:
Originally Posted by Charalambos26
Посмотреть сообщение
+1 rep
Thanks, should I put this on OnPlayercommandtext?
And how to make an exit command?
Get the ZCMD include, include it and paste the command in.
Exit command works the same way except check if the player is in the interior and at the exit position and set their position to the entrance
Reply
#5

That is not at all maintenance friendly. If you have, say, 100 doors like that you're simply not going to copy-paste 100 coordinates beneath each other.

When the player enters a dynamic checkpoint, save that checkpointid to a global player variable. When they leave a dynamic checkpoint, reset that variable. Then, in the command, use IsPlayerInDynamicCheckpoint to establish that they're still in the checkpoint, using the ID you saved earlier. Then switch checkpointid to get the desired position.

This isn't the best way to do it, still, but at least it's better than copying sets of coordinates.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
That is not at all maintenance friendly. If you have, say, 100 doors like that you're simply not going to copy-paste 100 coordinates beneath each other.

When the player enters a dynamic checkpoint, save that checkpointid to a global player variable. When they leave a dynamic checkpoint, reset that variable. Then, in the command, use IsPlayerInDynamicCheckpoint to establish that they're still in the checkpoint, using the ID you saved earlier. Then switch checkpointid to get the desired position.

This isn't the best way to do it, still, but at least it's better than copying sets of coordinates.
but this is to difficult for a Scripting Noob like me, or?
Reply
#7

Quote:
Originally Posted by Charalambos26
Посмотреть сообщение
but this is to difficult for a Scripting Noob like me, or?
Does anybody know how to make it?
I want it to be a red checkpoint, but I should only enter it with an command, this will teleport me to a place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)