Building Entry Function, help please!
#1

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.
Reply
#2

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.
Reply
#3

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?
Reply
#4

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.
Reply
#5

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.
Reply
#6

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)