SA-MP Forums Archive
Array of locations, tried different things. Not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array of locations, tried different things. Not working (/showthread.php?tid=494943)



Array of locations, tried different things. Not working - LiamM - 15.02.2014

Alright, I've tried all sorts of solutions and can't find one that works.. I've tried so many that I can't even remember half of the things I tried... It's displaying the * You are not at a gas station to refuel.

Despite being at the correct coordinates and in range of those coordinates.

Any suggestions guys? Maybe I've done something wrong that I haven't noticed.

pawn Код:
//Gas Station Coordinates
new Float:GasStations[][] =
{
{-2410.0339, 976.2402, 45.4246},
{-2686.1143, 15.3380, 7.2126}
}

for(new i; i < sizeof(GasStations); i++)
{
        if(!IsPlayerInRangeOfPoint(playerid, 10.0, GasStations[i][0], GasStations[i][1], GasStations[i][2]))
        {
            SCM(playerid, COLOR_SNOW, "* You are not at a gas station to refuel.");
            return 1;
         } 
}



Re: Array of locations, tried different things. Not working - terrow - 15.02.2014

Try

pawn Код:
for(new i; i < sizeof(GasStations); i++)
{
        if(IsPlayerInRangeOfPoint(playerid, 10.0, GasStations[i][0], GasStations[i][1], GasStations[i][2]))
        {
// Your Code here
            return 1;
         }
         else
         // You code here  
}
Or you can try :
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10.0, GasStations[i][0], GasStations[i][1], GasStations[i][2]))
                  return SCM( bla bla );
I hope this will be works !
If not reply !


Re: Array of locations, tried different things. Not working - ColeMiner - 15.02.2014

Do you know what "return" does?