How would I make this into multiple places. -
mkmk - 02.11.2014
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;
}
Re: How would I make this into multiple places. -
mkmk - 02.11.2014
Quote:
Originally Posted by ******
"or": ||
|
Pardon?
Re: How would I make this into multiple places. -
Gogorakis - 02.11.2014
Quote:
Originally Posted by ******
"or": ||
|
He means this:
Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, 627.3657, -571.5280, 17.8458 || BLA BLA BLA))
Re: How would I make this into multiple places. -
Abagail - 02.11.2014
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.
Re: How would I make this into multiple places. -
[HiC]TheKiller - 02.11.2014
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.
Re: How would I make this into multiple places. -
M0HAMMAD - 02.11.2014
I think this your mean :
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 4.0, 247.0330,65.7600,1003.6406) || IsPlayerInRangeOfPoint(playerid, 4.0, x,y,z))
Re: How would I make this into multiple places. -
mkmk - 02.11.2014
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))
?
Re: How would I make this into multiple places. -
Quickie - 02.11.2014
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;
}
Re: How would I make this into multiple places. -
mkmk - 03.11.2014
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?
Re: How would I make this into multiple places. -
Quickie - 03.11.2014
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
Re: How would I make this into multiple places. -
mkmk - 03.11.2014
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
![Cool](images/smilies/cool.gif)
: 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] };
Re: How would I make this into multiple places. -
Pottus - 03.11.2014
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.
Re: How would I make this into multiple places. -
Quickie - 03.11.2014
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 ^^^^^^^^^
};
Re: How would I make this into multiple places. -
mkmk - 03.11.2014
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
![Cool](images/smilies/cool.gif)
: error 020: invalid symbol name ""
Re: How would I make this into multiple places. -
Quickie - 03.11.2014
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;
}
Re: How would I make this into multiple places. -
mkmk - 03.11.2014
None of these work, are there any better ways to do this?
Re: How would I make this into multiple places. -
Runn3R - 03.11.2014
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