[Unsolved] Get Random Coordinates from File
#5

Well. In my server I have an array with different coordinates on.

Define this.

gRandomPlayerSpawns[NUMBER OF COORDS][3]

COORD = x,y,z

pawn Code:
new Float:gRandomPlayerSpawns[5][3] = {
{COORD ONE},
{COORD TWO},
{COORD THREE},
{COORD FOUR},
{COORD FIVE}
};
So you can change the name of the array, with round names.

RoundOnePlayerSpawns[number][3]

pawn Code:
public SetPlayerSpawn(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerRound == 1)
        {
            rand = random(sizeof(RoundOnePlayerSpawns));
            SetPlayerPos(playerid, RoundOnePlayerSpawns[rand][0], RoundOnePlayerSpawns[rand][1], RoundOnePlayerSpawns[rand][2]); //Leave these numbers the
                                                                //same, only change the name eg. "RoundOnePlayerSpawns"
        }
    }
    return 1;
}
You can add extra cases such as if(PlayerRound == 2) and etc.

Good luck.
Reply


Messages In This Thread
[Unsolved] Get Random Coordinates from File - by member - 28.02.2009, 18:30
Re: Get Random Coordinates from File - by member - 01.03.2009, 17:42
Re: Get Random Coordinates from File - by pspleo - 01.03.2009, 17:51
Re: Get Random Coordinates from File - by member - 01.03.2009, 18:03
Re: Get Random Coordinates from File - by GunnerZ - 01.03.2009, 18:40
Re: Get Random Coordinates from File - by member - 01.03.2009, 18:59
Re: Get Random Coordinates from File - by GunnerZ - 01.03.2009, 19:07
Re: Get Random Coordinates from File - by member - 01.03.2009, 19:18

Forum Jump:


Users browsing this thread: 1 Guest(s)