26.01.2017, 11:50
Like this
All we is doing ,in both cases, is randomising indices of array with reference to last spawned place.
NOTE: It might not work for a per player purpose for that you need to make a per player array of current and last.So its better to do like this
Choice is yours....
PHP код:
static last,current;
while( last == current)
{
current = random(sizeof(TruckerSpawn));
}
SetPlayerPos(playerid, TruckerSpawn[current][SpawnX], TruckerSpawn[current][SpawnY], TruckerSpawn[current][SpawnZ]);
SetPlayerFacingAngle(playerid, TruckerSpawn[current][SpawnAngle]);
SetCameraBehindPlayer(playerid);
last = current;
NOTE: It might not work for a per player purpose for that you need to make a per player array of current and last.So its better to do like this
PHP код:
static last[MAX_PLAYERS],current[MAX_PLAYERS];
while( last[playerid] == current[playerid])
{
current[playerid] = random(sizeof(TruckerSpawn));
}
SetPlayerPos(playerid, TruckerSpawn[current[playerid]][SpawnX], TruckerSpawn[current[playerid]][SpawnY], TruckerSpawn[current[playerid]][SpawnZ]);
SetPlayerFacingAngle(playerid, TruckerSpawn[current[playerid]][SpawnAngle]);
SetCameraBehindPlayer(playerid);
last[playerid] = current[playerid];

