Where should I put IsPlayerInRangeOfPoint?
#1

Well, I'm making an automatic gate for my gamemode. But I don't know where should I put IsPlayerInRangeOfPoint.
pawn Code:
if(IsPlayerInRangeOfPoint(playerid,3,-839.4182,1398.3528,13.6094))
    {
        SendClientMessage(playerid,red,"Opening gate, please wait...");
        MoveObject(trgate[0],-835.0771, 1397.9591, 13.4000,2,0.0000, 15.0000, 207.1798);
        gate[playerid] = SetTimerEx("gate1",5000,false,"i",playerid);
        return 1;
    }
I've tried to put it under OnPlayerSpawn, but it doesn't work. If I put it under OnPlayerUpdate, it will spam me with this message "Opening gate, please wait...".
Reply
#2

try here public
Code:
OnGameModeInit()
Reply
#3

SendClientMessage(playerid
I will get an error.
Reply
#4

The only way to do it is OnPlayerUpdate, try removing the message.

EDIT: The reason it will spam you is because OnPlayerUpdate is updated every 2 seconds.
Reply
#5

Well... Look at this video

[ame]http://www.youtube.com/watch?v=Bfc3rPQtBsc[/ame]
Reply
#6

add unde gamemode int:

Code:
new trgate1;
trgate1 = CreateDynamicObject(...);

f(IsPlayerInRangeOfPoint(playerid,3,-839.4182,1398.3528,13.6094))
    {
        SendClientMessage(playerid,red,"Opening gate, please wait...");
        MoveObject(trgate1,-835.0771, 1397.9591, 13.4000,1000);
        gate[playerid] = SetTimerEx("gate1",5000,false,"i",playerid);
        return 1;
    }

// timer
forward gate1();
public gate1()
{
     SendClientMessage(playerid,red,"gate closing...");
     MoveObject(trgate1,yourcordinats,speed);
}
Reply
#7

I will get an errors.
Reply
#8

lol jsut try not just say "i will get erors". it the tested way.
Reply
#9

Quote:
Originally Posted by Jarok
View Post
The only way to do it is OnPlayerUpdate, try removing the message.

EDIT: The reason it will spam you is because OnPlayerUpdate is updated every 2 seconds.
Uhhm wrong?

It's called every 1/16 of a second, AKA 16 times a second.
Reply
#10

Quote:
Originally Posted by milanosie
View Post
Uhhm wrong?

It's called every 1/16 of a second, AKA 16 times a second.
It's called when a player updates, this can vary. And yes, if you want to make it automatic OnPlayerUpdate would be a good guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)