Building Entry Function, help please! -
Hamboni - 13.01.2013
Ok to begin I started with the latest version of Ravens Roleplay. I am trying to make a node outside of a building that teleports the player inside when they run onto it. I made this piece of code
Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1366.3108,-1279.5417,13.5469)) //near outside door of ammunation
{
SetPlayerPos(playerid, 315.4529,-143.0317,999.6016);//inside ammunation
SetPlayerInterior(playerid, 1);
}
but I don't know what to do with it because I want it to happen instantly if you run near the point, no key press or text command. I am thinking I need a new function, but I still have trouble with where I should define and call it, even after doing research. The big GameMode file is confusing to me

.
Please point me in the right direction

.
Re: Building Entry Function, help please! -
JustinAn - 13.01.2013
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1366.3108,-1279.5417,13.5469)) //near outside door of ammunation
{
SetPlayerPos(playerid, 315.4529,-143.0317,999.6016);//inside ammunation
SetPlayerInterior(playerid, 1);
}
return 1;
}
Here ya go. Simply in OnPlayerUpdate call back.
Re: Building Entry Function, help please! -
Hamboni - 13.01.2013
Man I thought there was somewhere existing i could put it thanks. Also, would it be safe(speed or any other problems) to put a big chain of code in there similar to that, but with coords for different buildings and of course exits?
Re: Building Entry Function, help please! -
JustinAn - 13.01.2013
Quote:
Originally Posted by Hamboni
Man I thought there was somewhere existing i could put it thanks. Also, would it be safe(speed or any other problems) to put a big chain of code in there similar to that, but with coords for different buildings and of course exits?
|
Do you mean like something will happen or crash, if you put a big code in OnPlayerUpdate? If yes, psssssh. Of course not, it's okay.
Re: Building Entry Function, help please! -
[HK]Ryder[AN] - 13.01.2013
OnPlayerUpdate runs 38000 times per second.
If you add alot of building checks your whole server will lagg.
I recommend that you create a 1 second timer for it.
Re: Building Entry Function, help please! -
JustinAn - 13.01.2013
Quote:
Originally Posted by [HK]Ryder[AN]
OnPlayerUpdate runs 38000 times per second.
If you add alot of building checks your whole server will lagg.
I recommend that you create a 1 second timer for it.
|
I don't think that will make a difference, 1 second. Not sure..