Array index out of bonus
#7

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
pawn Код:
public IsPlayerInTurf(playerid, turfid)
{
    if(!IsPlayerConnected(playerid))
        return 0;
    if(turfid == -1 || turfid >= 37)
        return 0;
   
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY])
        return 1;
}
All i did was added check if turfid is greater or equal to 37 (that is if is out of bounds)
I wold recommend you to change these 37 with macro like MAX_TURFS or something similar
Thanks, is working now!
Reply


Messages In This Thread
Array index out of bonus - by None1337 - 11.12.2017, 12:17
Re: Array index out of bonus - by Kane - 11.12.2017, 12:22
Re: Array index out of bonus - by None1337 - 11.12.2017, 12:29
Re: Array index out of bonus - by Kane - 11.12.2017, 12:31
Re: Array index out of bonus - by None1337 - 11.12.2017, 12:40
Re: Array index out of bonus - by DRIFT_HUNTER - 11.12.2017, 12:40
Re: Array index out of bonus - by None1337 - 11.12.2017, 12:47

Forum Jump:


Users browsing this thread: 1 Guest(s)