IsPlayerInArea help
#9

Quote:
Originally Posted by [BFT]eagles22
Посмотреть сообщение
I understand now how that would work, but i don't know whats wrong. I set that up and i still don't receive any message when a enter that area.
I'll make.

pawn Код:
#undef MAX_PLAYERS

#define MAX_SLOTS 500 //Max players of your server
#define MAX_PLAYERS MAX_SLOTS //If you wanna use MAX_PLAYERS instead of MAX_SLOTS...
#define CB:%0(%1) forward %0(%1); public %0(%1) //Now you don't need to forward for every custom callback. Juse use CB:Callbackname(params)

new bool:IsPInBankArea[MAX_PLAYERS] = false;

public OnFilterScriptInit() //Use OnGameModeInit if it's an gamemode
{
    SetTimer("CheckPlayerArea", 1000, true);
    return 1;
}

public OnPlayerConnect(playerid)
{
    IsPInBankArea[playerid] = false;
    return 1;
}

CB:CheckPlayerArea()
{
    for(new i = 0; i < MAX_SLOTS; i++){
        if(IsPlayerInArea(i, 1717.8574, 1725.7787, -1650.3363, -1659.9257)){
            if(!IsPInBankArea[i]){
                IsPInBankArea[i] = true;
                SendClientMessage(i, COLOR_GREEN, "Welcome to the bank!");
            }
        }
   
        if(!IsPlayerInArea(i, 1717.8574, 1725.7787, -1650.3363, -1659.9257)){
            if(IsPInBankArea[i]){
                IsPInBankArea[i] = false;
                SendClientMessage(i, COLOR_GREEN, "You left the bank");
            }
        }
    }
    return 1;
}

stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
By the way, do you have the good co-ordinations?
Because it can also be MinX,MinY,MaxX,MaxY instead of MinX,MaxX,MinY,MaxY

- Kevin
Reply


Messages In This Thread
IsPlayerInArea help - by [BFT]eagles22 - 07.01.2011, 02:18
Re: IsPlayerInArea help - by Alex_Valde - 07.01.2011, 02:22
Re: IsPlayerInArea help - by [BFT]eagles22 - 07.01.2011, 02:26
Re: IsPlayerInArea help - by admantis - 07.01.2011, 02:35
Re: IsPlayerInArea help - by [WF]Demon - 07.01.2011, 02:37
Re: IsPlayerInArea help - by [BFT]eagles22 - 07.01.2011, 04:05
Re: IsPlayerInArea help - by Kwarde - 07.01.2011, 04:42
Re: IsPlayerInArea help - by [BFT]eagles22 - 08.01.2011, 15:29
Re: IsPlayerInArea help - by Kwarde - 08.01.2011, 16:42
Re: IsPlayerInArea help - by [BFT]eagles22 - 08.01.2011, 17:43

Forum Jump:


Users browsing this thread: 1 Guest(s)