Makign a Loop ?
#1

i got a Fuel System and madea command /refuel
and it needs to loop throught all Pertol Stations but doesnt work
pawn Код:
new Float:FuelStationsPos[14][3] = {
{1940.9076,-1772.5399,13.6406},
{2922.3259,-1524.4681,11.0859},
{1004.6888,-936.9821,42.3281},
{-91.5198,-1169.5056,2.4287},
{-1603.2617,-2709.0325,49.5732},
{-1608.0457,-2716.0010,48.9453},
{-2244.5745,-2561.6260,31.9219},
{-1675.5986,413.8029,7.1797},
{-2411.5725,976.1963,45.4609},
{-1473.2977,1863.7169,32.6328},
{-1328.0779,2680.9631,50.0625},
{-1329.0669,2671.8274,50.0625},
{609.9968,1699.2572,6.9922},
{616.4281,1689.3497,6.9922}
};


//The cmd
for(new i; i < sizeof(FuelStationsPos); i++)
    {
        if(IsPlayerInRangeOfPoint(playerid,7.0,FuelStationsPos[i][0], FuelStationsPos[i][1], FuelStationsPos[i][2]))
    }
I want to see if the player IsPlayerInRangeOfPoint in any of thises FuelStationsPos positions ?
Reply
#2

This code looks good.
Reply
#3

Yes, the code looks fine but if you want you can change

new Float:FuelStationsPos[14][3] = {

to

new Float:FuelStationsPos[][3] = {

and it will still work fine.
Reply
#4

i know everything looks fine but whats could be the problem ?
Reply
#5

Quote:
Originally Posted by The-Warrior
Посмотреть сообщение
i know everything looks fine but whats could be the problem ?
What IS the problem?
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
What IS the problem?
if u type my comand /refuel and i am near those locations it will say that im not :X
Reply
#7

Show the /refuel command.
Reply
#8

try changing new i; to new i=0;
Reply
#9

pawn Код:
COMMAND:refuel(playerid)
{
for(new i; i < sizeof(FuelStationsPos); i++)
    {
    if(IsPlayerInRangeOfPoint(playerid,7.0,FuelStationsPos[i][0], FuelStationsPos[i][1], FuelStationsPos[i][2]))
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"Your Need To Be In A Vehicle!");
        //This is all the refulling function which work all fine
        }else return SendClientMessage(playerid,RED,"Your Not Near A Fuel Station!");
    }
return 1;
}
Reply
#10

pawn Код:
COMMAND:refuel(playerid)
{
    for(new i; i < sizeof(FuelStationsPos); i++)
    {
        if(IsPlayerInRangeOfPoint(playerid,7.0,FuelStationsPos[i][0], FuelStationsPos[i][1], FuelStationsPos[i][2]))
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"Your Need To Be In A Vehicle!");
            //This is all the refulling function which work all fine
            return 1;
        }
    }
    SendClientMessage(playerid,RED,"Your Not Near A Fuel Station!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)