PDA

View Full Version : Random Spawn


Panten
28/11/2016, 06:54 PM
I have problem,i choose this cord,but when i join in-game it spawn players in different area not in anyone of these one?



new Float:RandomSpawn[][] = {
{1024.5215,-1335.2686,13.5441,1.6310},
{490.4999,-1511.4652,20.5050,95.9661},
{1815.0850,-1876.9589,13.5781,273.1859},
{2020.7937,-1271.2987,23.9844,4.2513},
{2724.2773,-2042.3345,13.5507,90.5602}


};

iamjems
28/11/2016, 06:58 PM
new Float:RandomSpawn[5][4] = {
{1024.5215,-1335.2686,13.5441,1.6310},
{490.4999,-1511.4652,20.5050,95.9661},
{1815.0850,-1876.9589,13.5781,273.1859},
{2020.7937,-1271.2987,23.9844,4.2513},
{2724.2773,-2042.3345,13.5507,90.5602}
};

public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}


Float:RandomSpawn[5][4]

[5] = amount of spawn positions you have
[4] = amount of floats in the variable, in this case: X, Y, Z and ANGLE

Also, are you using the grand larceny script? If yes, remove this from OnPlayerSpawn:


if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_LosSantos));
SetPlayerPos(playerid,
gRandomSpawns_LosSantos[randSpawn][0],
gRandomSpawns_LosSantos[randSpawn][1],
gRandomSpawns_LosSantos[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_LosSan tos[randSpawn][3]);
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_SanFierro));
SetPlayerPos(playerid,
gRandomSpawns_SanFierro[randSpawn][0],
gRandomSpawns_SanFierro[randSpawn][1],
gRandomSpawns_SanFierro[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_SanFie rro[randSpawn][3]);
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
SetPlayerPos(playerid,
gRandomSpawns_LasVenturas[randSpawn][0],
gRandomSpawns_LasVenturas[randSpawn][1],
gRandomSpawns_LasVenturas[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_LasVen turas[randSpawn][3]);
}

Panten
28/11/2016, 07:10 PM
Thank you but it's not working i will try with my mode i took one but it's shitty anyway thank you.

iamjems
28/11/2016, 07:12 PM
Thank you but it's not working i will try with my mode i took one but it's shitty anyway thank you.

Can you post your OnPlayerSpawn?

Panten
28/11/2016, 07:14 PM
I deleted mode which i found,now i will start from zero!