Timer problem or stock problem?
#1

I'm creating a function when a admin enters the zone he or she will get the message "Welcome Administrator %s to Admin House" if he or she aren't admin he or she will get killed by the Zone Checker Timer

Код:
Note: I'm using TheYoungCouple's Admin House Map
but when player enters nor admin enters nothing happens just nothing + there is a problem look at screenshot below:



This is what happening when i'm not near in the zone



The bug is gone when i'm near to the zone



This is all i want to do

pawn Код:
/* Top of the script */

new AZone;
new ZoneChecker;

forward OnPlayerInZone(playerid);

/* OnGameModeInit */

ZoneChecker = SetTimer("OnPlayerInZone", 1000, true);

/* public OnPlayerInZone */

public OnPlayerInZone(playerid)
{
    new string[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(IsPlayerInArea(playerid, -1191.2799, -910.5327, -1000.2667, -1067.6785))
    {
        if(PlayerInfo[playerid][pAdmin] > 1)
        {
            format(string, sizeof(string), "Welcome Administrator "white"%s "yellow"to Admin House!", pname);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Sorry, You must be Administrator to enter Admin House");
            SetPlayerHealth(playerid, 0);
        }
    }
    return 1;
}

/* Stock */

stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy) //i found this somewhere around the forum
{
    new
        Float:x,
        Float:y,
        Float:z;

    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return true;
    return false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)