[HELP] Random Spawn
#7

But if you are using 2D arrays so you should use it like this:
pawn Код:
enum SpawnInfos
{
    Float:X_POS,
    Float:Y_POS,
    Float:Z_POS,
    Float:Z_ROT,
}

SpawnInfo[][SpawnInfos] = {
{0.0, 0.0, 0.0, 0.0,}, //For the zeros please add correct values to make the player spawn correctly later
{0.0, 0.0, 0.0, 0.0,},
{0.0, 0.0, 0.0, 0.0,},
{0.0, 0.0, 0.0, 0.0,},
//You can add here more if you want..
{0.0, 0.0, 0.0, 0.0,}//<-- Important! In the last 1D array you shouldn't add the comma there excepted you want to add more 1D arrays.
};

//Then later just do
public OnPlayerSpawn(playerid)
{
    //Add this stuff below after those another code you added before.
    new spawnid = random(...); //Add inside the 'random' the max amount of spawns (if you have 5 spawns so write '5' there)
    SetPlayerPos(playerid, SpawnInfo[spawnid][X_POS], SpawnInfo[spawnid][Y_POS], SpawnInfo[spawnid][Z_POS]);
    SetPlayerFacingAngle(playerid, SpawnInfo[spawnid][Z_ROT]);
    return 1;
}
Reply


Messages In This Thread
[HELP] Random Spawn - by System64 - 04.05.2011, 19:55
Re: [HELP] Random Spawn - by BigETI - 04.05.2011, 20:16
Re: [HELP] Random Spawn - by System64 - 04.05.2011, 20:46
Re: [HELP] Random Spawn - by BigETI - 04.05.2011, 21:12
Re: [HELP] Random Spawn - by TheGarfield - 04.05.2011, 21:51
Re: [HELP] Random Spawn - by park4bmx - 04.05.2011, 22:01
Re: [HELP] Random Spawn - by BigETI - 04.05.2011, 23:00
Re: [HELP] Random Spawn - by System64 - 05.05.2011, 06:48
Re: [HELP] Random Spawn - by BigETI - 05.05.2011, 11:32
Re: [HELP] Random Spawn - by System64 - 05.05.2011, 19:31

Forum Jump:


Users browsing this thread: 1 Guest(s)