How to make an array with positions? it is possible?
#1

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
Reply
#2

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}
}; 
Reply
#3

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
Reply
#4

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(playerid3.0PositionsSite)) return SendClientMessage(playeridCOLOR_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
Reply
#5

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}, )

Reply
#6

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
Reply
#7

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
Reply
#8

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)
}
}
Reply
#9

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(playerid3.0PositionsSite[0][0],PositionsSite[0][1],PositionsSite[0][2])) return SendClientMessage(playeridCOLOR_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
Reply
#10

https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays

that's all you need to read to understand arrays.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)