house help
#1

hello, i am trying to add a function IsPlayerInRangeofPoint near a house door, and when somebody is entering in that red area to teleport the player to a interior how i can do that?
i need some help thanks
Reply
#2

Код:

public OnPlayerSpawn(playerid)
{
   if(IsPlayerInRangeOfPoint(playerid, 7.0, //coords here near the checkpoint))
    SetPlayerCheckpoint(playerid, //Do /save ingame then copy the coordinates to here (Here will go the red thing)., 3.0);
    return 1;
}
 
public OnPlayerEnterCheckpoint(playerid)
{
    SetPlayerPos(playerid,//Put here where you want the player to teleport (/save as well) ,6.0)
    SetPlayerInterior(playerid, 1);
    return 1;
}
Reply
#3

i did that and the compiler didn't gived me errors, but when i entered in the game, the red circle wasn't on the door near the house, what did i do wrong?
Reply
#4

Have you check that on Wiki?

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
Reply
#5

yes and i did corectly.
look this is my code:
public OnPlayerSpawn(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, -2017.4309,970.1254,45.4794))
SetPlayerCheckpoint(playerid, -2017.4309,970.1254,45.4794,3.0);
return 1;
}
And this is the code for entering the checkpoint
public OnPlayerEnterCheckpoint(playerid)
{
SetPlayerPos(playerid, 1527.229980,-11.574499,1002.097106);
SetPlayerInterior(playerid, 3);
return 1;
}
it's something wrong in the code? i can't figured it out what it can be
Reply
#6

Well, you can aswell, try this method.

First:
pawn Код:
new hcheckpoint1;
to define the checkpoint.

Now,on
pawn Код:
public OnGameModeInit()
put: hcheckpoint1 = CreateCheckpoint( bla bla bla )

And on
pawn Код:
Player enter Checkpoint[/b]
pawn Код:
if( checkpointid = hcheckpoint1)
    {
          SetPlayerPos(playerid, 1527.229980,-11.574499,1002.097106);
          SetPlayerInterior(playerid, 3);
          return 1;
    }
Now, I`m not 100% it`s checkpointid or something else, since I didn`t use checkpoints so often... If it`s not correct, you can try cpid = hcheckpoint1

But, this way will set a checkpoint for all players to see it ... not only for the ones who are in that range.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)