ZCMD: Unkown Command
#4

why you are looping inside the size of the "hInfo" array while you should loop inside houses such MAX_HOUSES as an example.
And why you are returning the size of the array if he was really in range of it, instead of returning a "true" value?
pawn Код:
/* An example, let's put MAX_HOUSES 400 */
#define MAX_HOUSES 400

stock IsPlayerNearAnyHouse(playerid)
{
     for(new i = 0; i < MAX_HOUSES; i++)
     {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, hInfo[i][hPos][0], hInfo[i][hPos][1], hInfo[i][hPos][2]))
        {
                return 1; // returning one so it can work with "hid == 0" or "hid == 1"
                        // He's near the house already, we don't need to check if his name same as owner's name
            if(strcmp(GetNameEx(playerid), hInfo[i][hOwner], true) == 0)
            {
                printf("%i", i);
               
            }
        }
    }
    return 0;
P.S , if you want this function to work as if the player's name same as owner's name or not, move return 1; under strcmp statement
Reply


Messages In This Thread
ZCMD: Unkown Command - by Blademaster680 - 08.01.2015, 20:39
Re: ZCMD: Unkown Command - by DavidSparks - 08.01.2015, 20:45
Re: ZCMD: Unkown Command - by Blademaster680 - 08.01.2015, 20:48
Re: ZCMD: Unkown Command - by Sawalha - 08.01.2015, 20:48
Re: ZCMD: Unkown Command - by Blademaster680 - 08.01.2015, 20:51
Re: ZCMD: Unkown Command - by Jefff - 08.01.2015, 20:53
Re: ZCMD: Unkown Command - by Blademaster680 - 08.01.2015, 20:54
Re: ZCMD: Unkown Command - by ahmedkoki - 08.01.2015, 20:57
Re: ZCMD: Unkown Command - by Blademaster680 - 08.01.2015, 21:00
Re: ZCMD: Unkown Command - by Jefff - 08.01.2015, 21:08

Forum Jump:


Users browsing this thread: 2 Guest(s)