13.09.2018, 13:49
PHP код:
new Float:g_SpawnGroves[][4] = {//we will make a variable containt of spawn locations as we select X, Y, Z, Angle
{2495.9788, -1709.5435, 1014.7422, 359.6140}, // X, Y, Z, Angle
{2495.9788, -1709.5435, 1014.7422, 359.6140},
{2495.9788, -1709.5435, 1014.7422, 359.6140},
{X, Y, Z, ANGLE}
};
new rpos = random(sizeof(g_SpawnGroves));//we will make a new varaible in which we will make the spawn location random so we can able to get the player position in SetPlayerPos
SetPlayerPos(playerid, g_SpawnGroves[rpos][0], g_SpawnGroves[rpos][1], g_SpawnGroves[rpos][2]); //Here we will set the position as X, Y, Z (0, 1, 2) [we are using 0, 1, 2 becuz we have (XYZ ANGLE = 4 positions] [0 = X] [1=Y] [2=Z] [3=Angle] so placed it see the code
SetPlayerFacingAngle(playerid, g_SpawnGroves[rpos][3]); // we will put the angle from another function cuz their is not function to set the angle in SetPlayerPos well you can make it ezly if you want to learn that then you can reply here.
SetPlayerInterior(playerid, 3); //As same as Angle we dont have function of interior in SetPlayerPos so we will use the SetPlayerInterior to set the player spawn interior well here the function i m talking about below.
PHP код:
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:Angle, interiorid)
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, Angle);
SetPlayerInterior(playerid, interiorid);
}
//SetPlayerPosEx(playerid, X, Y, Z, Angle, interiorid);
[its simple then above isn't it :D]