How would I make this into multiple places.
#1

How would I make these commands for multiple different locations?

pawn Код:
CMD:enter(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 627.3657, -571.5280, 17.8458))
    {
        SetPlayerPos(playerid, 247.0330,65.7600,1003.6406);
        SetPlayerInterior(playerid, 6);
        SetPlayerVirtualWorld(playerid, 5);
        SetCameraBehindPlayer(playerid);
    }
    return 1;
}
CMD:exit(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406))
    {
        SetPlayerPos(playerid, 627.3657, -571.5280, 17.8458);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
"or": ||
Pardon?
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
"or": ||
He means this:

Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, 627.3657, -571.5280, 17.8458 || BLA BLA BLA))
Reply
#4

He means that "||" is the SAMP "or" statement. It basically checks if the first variable accordingly, and if failed, or whatever it will check the second one.
Reply
#5

Take a look into multi-dimensional arrays so you can put all of the data into an array and then take a look at looping. There are plenty of scripts around though that are exactly what you want. Hit up the search button.
Reply
#6

I think this your mean :
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406) || IsPlayerInRangeOfPoint(playerid, 4.0, x,y,z))
Reply
#7

I don't really understand, so where do I put
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406) || IsPlayerInRangeOfPoint(playerid, 4.0, x,y,z))
?
Reply
#8

if youre making "multiple"
store them in n array so you can loop check to them
pawn Код:
new entrance[][]=
{
{x,y,z},
{x,y,z},
{x,y,z},
...
};
new exit[][]=
{
{x,y,z},
{x,y,z},
...
};
new entranceTele[][]=
{
{x,y,z,interior,virtualworld},
{x,y,z,interior,virtualworld},
....
};
new exitTele[][]=
{
{x,y,z,interior,virtualworld},
{x,y,z,interior,virtualworld},
...
};
CMD:enter(playerid, params[])
{
    for(new i;i!=sizeof(entrance);i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0,entrance[i][0],entrance[i][1],entrance[i][2]))
        {
            SetPlayerPos(playerid, entranceTele[i][0],entranceTele[i][1],entranceTele[i][2]);
            SetPlayerInterior(playerid, entranceTele[i][3]);
            SetPlayerVirtualWorld(playerid, entranceTele[i][4]);
            SetCameraBehindPlayer(playerid);
            break;
        }
    }
    return 1;
}
CMD:exit(playerid, params[])
{
    for(new i;i!=sizeof(entrance);i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0,exit[i][0],exit[i][1],exit[i][2]))
        {
            SetPlayerPos(playerid, exitTele[i][0],exitTele[i][1],exitTele[i][2]);
            SetPlayerInterior(playerid, exitTele[i][3]);
            SetPlayerVirtualWorld(playerid, exitTele[i][4]);
            SetCameraBehindPlayer(playerid);
            break;
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Quickie
Посмотреть сообщение
if youre making "multiple"
store them in n array so you can loop check to them
pawn Код:
new entrance[][]=
{
{x,y,z},
{x,y,z},
{x,y,z},
...
};
new exit[][]=
{
{x,y,z},
{x,y,z},
...
};
new entranceTele[][]=
{
{x,y,z,interior,virtualworld},
{x,y,z,interior,virtualworld},
....
};
new exitTele[][]=
{
{x,y,z,interior,virtualworld},
{x,y,z,interior,virtualworld},
...
};
CMD:enter(playerid, params[])
{
    for(new i;i!=sizeof(entrance);i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0,entrance[i][0],entrance[i][1],entrance[i][2]))
        {
            SetPlayerPos(playerid, entranceTele[i][0],entranceTele[i][1],entranceTele[i][2]);
            SetPlayerInterior(playerid, entranceTele[i][3]);
            SetPlayerVirtualWorld(playerid, entranceTele[i][4]);
            SetCameraBehindPlayer(playerid);
            break;
        }
    }
    return 1;
}
CMD:exit(playerid, params[])
{
    for(new i;i!=sizeof(entrance);i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0,exit[i][0],exit[i][1],exit[i][2]))
        {
            SetPlayerPos(playerid, exitTele[i][0],exitTele[i][1],exitTele[i][2]);
            SetPlayerInterior(playerid, exitTele[i][3]);
            SetPlayerVirtualWorld(playerid, exitTele[i][4]);
            SetCameraBehindPlayer(playerid);
            break;
        }
    }
    return 1;
}
And so I just put all of the extra stuff ontop of my cmds?
Reply
#10

Quote:
Originally Posted by mkmk
Посмотреть сообщение
And so I just put all of the extra stuff ontop of my cmds?
Yes
on top of your scripts where your global variables located
Reply
#11

Welp. I put these ontop of my script.

pawn Код:
new entrance[][]=
{
{25.884498,-185.868988,1003.546875},

...
};
new exit[][]=
{
{7,2250.2444,52.6333,26.6671},
...
};
new entranceTele[][]=
{
{25.884498,-185.868988,1003.546875,10,14},
....
};
new exitTele[][]=
{
{7,2250.2444,52.6333,26.6671,0,0},
...
};
Got these errors.

(20 : error 010: invalid function or declaration
(207) : error 001: expected token: ";", but found "."
(199) : error 020: invalid symbol name ""

Here are the following error lines
pawn Код:
[LINE 199] new exit[][]=
[LINE 207] ....
[LINE 208] };
Reply
#12

I wouldn't do it any of the ways discussed here there is a much better method using a dynamic type system with dynamic areas.
Reply
#13

pawn Код:
new entrance[][]=
{
{25.884498,-185.868988,1003.546875}// put a comma "," if you want to add another point
//{x,y,z}// remove the ... //additional point and ^^^^^^^^^
};
new exit[][]=
{
{7,2250.2444,52.6333,26.6671}// put a comma "," if you want to add another point
//{x,y,z} // remove the ... //additional point and ^^^^^^^^^
};
new entranceTele[][]=
{
{25.884498,-185.868988,1003.546875,10,14}// put a comma "," if you want to add another point
//{x,y,z,interior,world}// remove the ... //additional point and ^^^^^^^^^
};
new exitTele[][]=
{
{7,2250.2444,52.6333,26.6671,0,0}// put a comma "," if you want to add another point
//{x,y,z,interior,world} // remove the ... //additional point and ^^^^^^^^^
};
Reply
#14

Quote:
Originally Posted by Quickie
Посмотреть сообщение
pawn Код:
new entrance[][]=
{
{25.884498,-185.868988,1003.546875}// put a comma "," if you want to add another point
//{x,y,z}// remove the ... //additional point and ^^^^^^^^^
};
new exit[][]=
{
{7,2250.2444,52.6333,26.6671}// put a comma "," if you want to add another point
//{x,y,z} // remove the ... //additional point and ^^^^^^^^^
};
new entranceTele[][]=
{
{25.884498,-185.868988,1003.546875,10,14}// put a comma "," if you want to add another point
//{x,y,z,interior,world}// remove the ... //additional point and ^^^^^^^^^
};
new exitTele[][]=
{
{7,2250.2444,52.6333,26.6671,0,0}// put a comma "," if you want to add another point
//{x,y,z,interior,world} // remove the ... //additional point and ^^^^^^^^^
};
(19 : error 020: invalid symbol name ""
pawn Код:
new exit[][]=
Reply
#15

pawn Код:
new exitinterior[][]= // you may change this global var to other names you like but change the rest of the code that uses this globalvar
{
{x,y,z},
};
CMD:exit(playerid, params[])
{
    for(new i;i!=sizeof(entrance);i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0,exitinterior[i][0],exitinterior[i][1],exitinterior[i][2]))
        {
            SetPlayerPos(playerid, exitTele[i][0],exitTele[i][1],exitTele[i][2]);
            SetPlayerInterior(playerid, exitTele[i][3]);
            SetPlayerVirtualWorld(playerid, exitTele[i][4]);
            SetCameraBehindPlayer(playerid);
            break;
        }
    }
    return 1;
}
Reply
#16

None of these work, are there any better ways to do this?
Reply
#17

Quote:
Originally Posted by mkmk
Посмотреть сообщение
How would I make these commands for multiple different locations?

pawn Код:
CMD:enter(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 627.3657, -571.5280, 17.8458) || IsPlayerInRangeOfPoint(playerid, 2.0, 627.3657, -571.5280, 17.8458))
    {
        SetPlayerPos(playerid, 247.0330,65.7600,1003.6406);
        SetPlayerInterior(playerid, 6);
        SetPlayerVirtualWorld(playerid, 5);
        SetCameraBehindPlayer(playerid);
    }
    return 1;
}
CMD:exit(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406) || IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406))
    {
        SetPlayerPos(playerid, 627.3657, -571.5280, 17.8458);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
    }
    return 1;
}
.... or just spam the if's but i don't know why are you doing this tho lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)