How to make an array with positions? it is possible? -
R3SpaWn0 - 03.08.2018
Hi, i want to use (IsPlayerInRangeOfPoint, blab.a.. but i have at least 22 positions saved, how can i do to simplify this?
an enum? an array? someone know?
its like
new positionatms[] = 916.3805,-1096.2444,24.2969, 916.3805,-1096.2444,24.2969, 916.3805,-1096.2444,24.2969 ,916.3805,-1096.2444,24.2969
to make If, IsPlayerInRangeOfPoint(positionatms)
it is possible?
sorry for my bad english, but i want to learn pawno, i love programming but i'm noob
Re: How to make an array with positions? it is possible? -
Exhibit - 03.08.2018
like this
PHP код:
new Float:LVPDSpawns[][] =
{
{245.9241,185.5854,1008.1719,1.0521},
{208.8285,142.2157,1003.0300,267.5369},
{189.2401,157.9697,1003.0234,272.3232},
{189.5161,179.4495,1003.0234,268.6416},
{228.9634,183.4291,1003.0313,180.8240},
{299.9990,191.0758,1007.1719,90.1313}
};
Re: How to make an array with positions? it is possible? -
R3SpaWn0 - 03.08.2018
Quote:
Originally Posted by Exhibit
like this
PHP код:
new Float:LVPDSpawns[][] =
{
{245.9241,185.5854,1008.1719,1.0521},
{208.8285,142.2157,1003.0300,267.5369},
{189.2401,157.9697,1003.0234,272.3232},
{189.5161,179.4495,1003.0234,268.6416},
{228.9634,183.4291,1003.0313,180.8240},
{299.9990,191.0758,1007.1719,90.1313}
};
|
Thank you ! <3
Re: How to make an array with positions? it is possible? -
R3SpaWn0 - 03.08.2018
Quote:
Originally Posted by ******
Check the wiki and the included modes - how to do this is literally one of the first things ever documented in SA-MP.
|
I dont find..
Can you help me how to call it? or send me links?
i have this: (i will add more)
PHP код:
new Float:PositionsSite[][] =
{
{916.3109,-1095.9436,24.2969},
{910.6329,-1096.0295,24.2969}
};
And the error comes here becouse i dont know how to call that :S
PHP код:
if(!IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite)) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You are not in the site positions !");
Error..
Код:
error 035: argument type mismatch (argument 3)
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Re: How to make an array with positions? it is possible? -
GospodinX - 03.08.2018
Try this:
Код:
if(!IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite[0][0],PositionsSite[0][1],PositionsSite[0][2])) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You are not in the site positions !");
This is just for first coordinates..I don't know what you want to make so...
Quote:
( {916.3109,-1095.9436,24.2969}, )
|
Re: How to make an array with positions? it is possible? -
R3SpaWn0 - 03.08.2018
Quote:
Originally Posted by GospodinX
Try this:
Код:
if(!IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite[0][0],PositionsSite[0][1],PositionsSite[0][2])) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You are not in the site positions !");
This is just for first coordinates..I don't know what you want to make so...
|
But that is only for the position 0 no? its not for bouth positions..
anyways i think i made it with a for loop, i go test it on the server and i come here to edit to say if its good
Re: How to make an array with positions? it is possible? -
coool - 03.08.2018
Quote:
Originally Posted by R3SpaWn0
sorry for my bad english, but i want to learn pawno, i love programming but i'm noob
|
pawno is a text editor
pawn is the language
Re: How to make an array with positions? it is possible? -
GospodinX - 03.08.2018
If you make loop,and if player is not on near by it coordinates he will get two times message "You are not in the site positions!
So it's better make on this way:
Код:
for(new i= 0; i < sizeof( PositionsSite ); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite[i][0],PositionsSite[i][1],PositionsSite[i][2])) {
///Player is near by an positionssite(i)
}
}
Re: How to make an array with positions? it is possible? -
R3SpaWn0 - 03.08.2018
Quote:
Originally Posted by GospodinX
If you make loop,and if player is not on near by it coordinates he will get two times message "You are not in the site positions!
So it's better make on this way:
Код:
for(new i= 0; i < sizeof( PositionsSite ); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite[i][0],PositionsSite[i][1],PositionsSite[i][2])) {
///Player is near by an positionssite(i)
}
}
|
You mean to make this?
PHP код:
if(!IsPlayerInRangeOfPoint(playerid, 3.0, PositionsSite[0][0],PositionsSite[0][1],PositionsSite[0][2])) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You are not in the site positions !");
But this only detect the position 0 in array right? not the 2 positions, to detect 2 positions i need a loop?! thanks
Re: How to make an array with positions? it is possible? -
DBZdabIt3Bro7 - 03.08.2018
https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays
that's all you need to read to understand arrays.