How to make it choose random maps
#1

How do i make it choose a random map and then use the spawns of that map and that map only, i already got the spawns. Heres the code.

Код:
new Float:RandomSpawnsSM[][] =
{
	{1720.8464,-2519.2314,13.5469,143.6411},
	{1688.2020,-2518.4209,13.5469,25.9484},
	{1710.1774,-2539.6440,13.5469,173.5298},
	{1692.2665,-2537.6885,13.5469,81.9631},
	{1714.5834,-2557.5886,13.5469,14.5232},
	{1710.6547,-2537.2891,18.9415,115.4901},
	{1695.3268,-2537.4883,20.4143,197.0300},
	{1686.3291,-2560.5654,13.5469,97.3401}
};
new Float:RandomSpawnsPL[][] =
{
{245.1710,1407.2894,10.7075,16.8243},
{245.6700,1385.9261,10.7075,187.1108},
{246.1979,1360.8672,10.7075,214.6844},
{217.6911,1353.6136,10.5859,197.0896},
{207.4104,1373.8285,10.5859,189.3767},
{187.7590,1372.6526,23.7344,341.6324},
{156.0283,1385.8398,10.5859,12.6527},
{120.9474,1426.9980,10.6166,65.3657},
{132.0676,1472.6024,10.6073,263.2984},
{215.3625,1467.9290,23.7344,0.1661},
{251.0705,1472.9600,10.5859,270.55181},
{241.5951,1434.8999,10.7075,195.3511}
};
Reply
#2

Not sure if you can that in the same gamemode, but what i'v done on my server is making a number of gamemodes,each gamemode has the same commands etc, just different map, then every 10 mins get the script to auto change the gamemode, causing a different map to display.

You could do this

Quote:

//top of the script
forward GMswitch();

//under ongamemodein/flitersciptin
SetTimer("GMswitch",TIME,true); //Change TIME to the amount of time you want.

//at the bottom of your script
public GMswitch()
{
SendRconCommand("changemode GAMEMODENAME"); // change GAMEMODENAME to the name of your new gamemode/map
return 1;
}
Reply
#3

sounds like hes trying to make it pick weather or not to spawn between 2 maps then choose the random spawn

pawn Код:
switch(random(2))
{
        case 0:
        {
                ...//firstmap
        }
        case 1:
        {
                ...//secondmap
        }
}
hope that helps
Reply
#4

It made me spawn between these 2 maps. I want it to choose one map then they keep spawning at the same map till someone changes it.

Код:
new Random = random(sizeof(RandomSpawnsSM));
	new Random1 = random(sizeof(RandomSpawnsPL));
    
    switch(random(2))
{
        case 0:
        {
        
		SetPlayerPos(playerid, RandomSpawnsPL[Random1][0], RandomSpawnsPL[Random1][1], RandomSpawnsPL[Random1][2]);
		SetPlayerFacingAngle(playerid, RandomSpawnsPL[Random1][3]);
        }
        case 1:
        {
        SetPlayerPos(playerid, RandomSpawnsSM[Random][0], RandomSpawnsSM[Random][1], RandomSpawnsSM[Random][2]);
		SetPlayerFacingAngle(playerid, RandomSpawnsSM[Random][3]);
Reply
#5

Bumb is it possible to do something like this
Quote:

If blahblahblah == 1
{
SetPlayerPos(playerid, RandomSpawnsPL[Random1][0], RandomSpawnsPL[Random1][1], RandomSpawnsPL[Random1][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsPL[Random1][3]);
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)