SA-MP Forums Archive
house help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: house help (/showthread.php?tid=236665)



house help - \\ BlenderBoy // - 08.03.2011

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


Respuesta: house help - Alex_Obando - 08.03.2011

Код:

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;
}



Re: Respuesta: house help - \\ BlenderBoy // - 08.03.2011

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?


Re: house help - HyperZ - 08.03.2011

Have you check that on Wiki?

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint


Re: house help - \\ BlenderBoy // - 08.03.2011

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


Re: house help - antonio112 - 08.03.2011

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.