GameTextForPlayer Issue.
#1

pawn Code:
new playerid = MAX_PLAYERS;
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 321.1703,308.9879,999.1484) && Faction[playerid] == 1)
    GameTextForPlayer(playerid, "~b~Police Health ~n~~w~ /health", 3000, 5);
This doesnt work the way it should, this is posted under OnGameModeInit.

If I post it under

CMD:health

it only displays when the command is executed, where do I place the GTFP so that it displays when the person is in the range of that point?
Reply
#2

Do a new callback and place it there.
Set a timer to call that callback.
Reply
#3

pawn Code:
new timer;

public OnGameModeInit() {
    timer = SetTimer("CheckPlayer", 2000, true); // your timer, checks every 2 seconds
}

public OnGameModeExit() {
    KillTimer(timer);
}

forward CheckPlayer();
public CheckPlayer() {
    // For loop, you can also use "foreach" for this (include by Y_Less)
    for(new i=0;i<MAX_PLAYERS;i++) {
        if(IsPlayerInRangeOfPoint(i, 5.0, 321.1703,308.9879,999.1484) && Faction[i] == 1))
            GameTextForPlayer(i, "~b~Police Health ~n~~w~ /health", 3000, 5);
    }
}
Reply
#4

Thanks! + rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)