SA-MP Forums Archive
Little stuck... - 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: Little stuck... (/showthread.php?tid=307562)



Problem adding cords later in script - MasterB - 31.12.2011

I forgot how to do this in pawno can i get some help please?

this is in the begin of the gm
pawn Код:
new Float:FuelPumps[][3];
and i wanna add locations X, Y, Z later to this variable
like:
pawn Код:
dcmd_fill(playerid, params[])
{
    #pragma unused params
    FuelPumps[] = {-1.000,3.000,24.00};  //random cords
    return 1;
}
what is the correct way to do it?


Re: Little stuck... - SuperViper - 31.12.2011

pawn Код:
new Float: FuelPumps[][3] = {
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0}
};



Re: Little stuck... - [ABK]Antonio - 31.12.2011

Like viper said
pawn Код:
new Float: FuelPumps[][3] = {
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0}
};
but...
pawn Код:
#define MAX_FUEL 2 //We will use this later
pawn Код:
new Float:FuelPumps[MAX_FUEL][3] = {
    {0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0}
}
pawn Код:
for(new i; i<= MAX_FUEL; i++)
{
    if(IsPlayerInRangeOfPoint (playerid, 5,FuelPumps[i][0], FuelPumps[i][1],FuelPumps[i][2]))
}
EDIT: woops...(IsPlayerInRangeOfPoint not IsPlayerInPointOfRange


Re: Little stuck... - SuperViper - 31.12.2011

MAX_FUEL isn't needed. Use sizeof(FuelPumps) for the loop.


Re: Little stuck... - [ABK]Antonio - 31.12.2011

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
MAX_FUEL isn't needed.
Then if you're creating a loop you'll just be using a number..like 2..It isn't really necessary, it's just a define that we can put max gas stations in instead of always typing the number using sizeof(FuelPump) = more typing anyway :P


Re: Little stuck... - MasterB - 31.12.2011

Thnx but i know that way but i wanna add cords to it later with like a command


Re: Little stuck... - MasterB - 31.12.2011

Can anyone help since im stuck at this point