04.12.2011, 11:14
I am making something and when players connect they spawn ( the first time ) in some places with a tuning vehicle.
After the death ( second or more spawn ), people spawn normal.
It worked fine with the one place, but when I add them to choose a random Spawn,
I spawned at the coordinates from the AddPlayerClass.
Here is the code:
And the variables for the two Random Spawns
After the death ( second or more spawn ), people spawn normal.
It worked fine with the one place, but when I add them to choose a random Spawn,
I spawned at the coordinates from the AddPlayerClass.
Here is the code:
pawn Код:
public OnPlayerSpawn(playerid)
{
new
cVehicle,
VRandom = random(sizeof(RandomVSpawns));
SetPlayerPos(playerid, RandomVSpawns[VRandom][0], RandomVSpawns[VRandom][1], RandomVSpawns[VRandom][2]);
SetPlayerFacingAngle(playerid, RandomVSpawns[VRandom][3]);
SetPlayerInterior(playerid, 0);
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
cVehicle = CreateVehicle(562, x, y, z, angle, 6, 6, 60);
PutPlayerInVehicle(playerid, cVehicle, 0);
AddVehicleComponent(cVehicle, 1000);
AddVehicleComponent(cVehicle, 1037);
AddVehicleComponent(cVehicle, 1038);
AddVehicleComponent(cVehicle, 1039);
AddVehicleComponent(cVehicle, 1097);
AddVehicleComponent(cVehicle, 1148);
AddVehicleComponent(cVehicle, 1171);
if(On_foot[playerid]) {
new
Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
SetPlayerInterior(playerid, 0);
On_foot[playerid] = false;
}
return 1;
}
pawn Код:
// Second and more Spawn
new
Float:RandomSpawns[][] = {
{365.3526, 2537.0442, 16.6648, 181.8541},
{2186.1257, 1678.1261, 11.0973, 88.9221},
{-1343.6301, -248.0083, 14.1484, 315.3063},
{2048.1475, -2449.0293, 17.2250, 90.1532},
{-2763.3979, 375.4521, 5.6744, 269.9205}
};
// First Spawn
new
Float:RandomVSpawns[][] = {
{-2566.9312, 597.1349, 14.1841, 180.8479},
{2318.7849, 1944.7203, 4.9721, 177.4776},
{1945.7863, 1990.5835, 7.2540, 301.0600}
};