Changing to another map
#1

hi all, i really need to fix this problem ... i can't fix it by my own :-/
You may know im making a derby server but ofcourse if the round ends, so the roundtimer = 0, then must EVERYONE go (random) to another map ...

This is what i currently have:

CLICK ME


I TRIED THESE TOO :
pawn Code:
forward NewMap();
public NewMap()
{
    foreach(Player,i) { //so everyone must do this ...
        DontSpectating(i);
        SetPlayerColor(i,COLOR_GREEN);
        CreateNewVehicles();//ignore
        SetPVarInt(i,"Missiles",0);
        PlayerJustConnected[i] = 0;
        new OtherSpawn = random(12);//i have 12 different maps, so 12 randoms
        switch (OtherSpawn)//switch statement...
        {
            case 0://map 1
            {
                print("Went to map 1");
                new rand1=random(30);
                PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
                   //@ above: this i have untill "case 11:". Also a print, new rand1,rand2,...; Putplayerinvehicle ... etc.
        }
        TextDrawShowForAll(Textdraw6);//idk if that must be here ...
    }
    return 1;
}
And like gamer said: doesn't work too:
pawn Code:
forward NewMap();
public NewMap()
{
    new OtherSpawn = random(12);
    ResetVehicles();
    foreach(Player,i) {
        DontSpectating(i);
        SetPlayerColor(i,COLOR_GREEN);
        CreateNewVehicles();
        SetPVarInt(i,"Missiles",0);
        PlayerJustConnected[i] = 0;
        switch (OtherSpawn)
        {
            case 0:
            {
                print("Went to map 1");
                PutPlayerInVehicle(i, CarMap1[GetRandomVehicleID(0)], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
            case 1:
            {
                print("Went to map 2");
                PutPlayerInVehicle(i, CarMap2[GetRandomVehicleID(1)], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Destruction Farm");
                TextDrawSetString(Textdraw6,"~g~ Destruction Farm ~w~ by ~y~ Michael@Belgium");
            }
            case 2:
            {
                print("Went to map 3");
                PutPlayerInVehicle(i, CarMap3[GetRandomVehicleID(2)], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Don't fall in the water !");
                TextDrawSetString(Textdraw6,"~g~ Don't Fall In The Water ~w~ by ~y~ Michael@Belgium");
            }
            case 3:
            {
                print("Went to map 4");
                PutPlayerInVehicle(i, CarMap4[GetRandomVehicleID(3)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Bus derby");
                TextDrawSetString(Textdraw6,"~g~ Bus Derby ~w~ by ~y~ [AS]Samuel[CR]");
            }
            case 4:
            {
                print("Went to map 5");
                PutPlayerInVehicle(i, CarMap5[GetRandomVehicleID(4)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname The Dead Place");
                TextDrawSetString(Textdraw6,"~g~ The Dead Place ~w~ by ~y~ Remce");
            }
            case 5:
            {
                print("Went to map 6");
                PutPlayerInVehicle(i, CarMap6[GetRandomVehicleID(5)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Your Worst Nightmare !");
                TextDrawSetString(Textdraw6,"~g~ Your Worst Nightmare ~w~ by ~y~ Remce");
            }
            case 6:
            {
                print("Went to map 7");
                PutPlayerInVehicle(i,CarMap7[GetRandomVehicleID(6)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname The Disaster");
                TextDrawSetString(Textdraw6,"~g~ The Disaster ~w~ by ~y~ [AS]Samuel[CR]");
            }
            case 7:
            {
                print("Went to map 8");
                PutPlayerInVehicle(i,CarMap8[GetRandomVehicleID(7)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Up In The Air");
                TextDrawSetString(Textdraw6,"~g~ Up In The Air ~w~ by ~y~ Michael@Belgium");
            }
            case 8:
            {
                print("Went to map 9");
                PutPlayerInVehicle(i,CarMap9[GetRandomVehicleID(8)],0);
                SendClientMessage(i,COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname A Trip To Future Egypt");
                TextDrawSetString(Textdraw6,"~g~ A Trip To Future Egypt ~w~ by ~y~ Justsomeguy");
            }
            case 9:
            {
                print("Went to map 10");
                PutPlayerInVehicle(i,CarMap10[GetRandomVehicleID(9)],0);
                SendRconCommand("mapname Sumo");
                TextDrawSetString(Textdraw6,"~g~ Sumo ~w~ by ~y~ [BP]Tony");
            }
            case 10:
            {
                print("Went to map 12");
                PutPlayerInVehicle(i,CarMap12[GetRandomVehicleID(11)],0);
                SendRconCommand("mapname 0.3c Derby");
                TextDrawSetString(Textdraw6,"~g~ 0.3c Derby ~w~ by ~y~ [RsM]XpLoD");
            }
            case 11:
            {
                print("Went to map 11");
                PutPlayerInVehicle(i,CarMap11[GetRandomVehicleID(10)],0);
                SendRconCommand("mapname Unknown");
                TextDrawSetString(Textdraw6,"~g~ Unknown ~w~ by ~y~ Lisa_love");
             }
        }
        TextDrawShowForAll(Textdraw6);
    }
    return 1;
}

stock GetRandomVehicleID(map)
{
    switch(map)
    {
        case 0:
        {
            for(new i = 0;i<29;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
       
        case 1:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }

        case 2:
        {
            for(new i = 0;i<28;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 3:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 4:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 5:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 6:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 7:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 8:
        {
            for(new i = 0;i<29;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 9:
        {
            for(new i = 0;i<29;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 10:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
        case 11:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
    }
    return -1; //no vehicles left
}
And here another thing that doesn't work too:
pawn Code:
forward NewMap();
public NewMap()
{
    new OtherSpawn = random(12);
    ResetVehicles();
    foreach(Player,i) {
        DontSpectating(i);
        SetPlayerColor(i,COLOR_GREEN);
        CreateNewVehicles();
        SetPVarInt(i,"Missiles",0);
        PlayerJustConnected[i] = 0;
        switch (OtherSpawn)
        {
            case 0:
            {
                print("Went to map 1");
                RandomVehicle(1);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
//...
}
//---------------------------------------------------------
stock RandomVehicle(map)
{
    foreach(Player,i)
    {
        new b,bool:c1[sizeof(CarMap1)];
        new bool:c2[sizeof(CarMap2)];
        new bool:c3[sizeof(CarMap3)];
        new bool:c4[sizeof(CarMap4)];
        new bool:c5[sizeof(CarMap5)];
        new bool:c6[sizeof(CarMap6)];
        new bool:c7[sizeof(CarMap7)];
        new bool:c8[sizeof(CarMap8)];
        new bool:c9[sizeof(CarMap9)];
        new bool:c10[sizeof(CarMap10)];
        new bool:c11[sizeof(CarMap11)];
        new bool:c12[sizeof(CarMap12)];
        switch(map)
        {
            case 1:
            {
                for(new z;z<sizeof(CarMap1);z++)
                {
                    b = random(sizeof(CarMap1));
                    if(c1[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c1[b]++;
                    break;
                }
            }
            case 2:
            {
                for(new z;z<sizeof(CarMap2);z++)
                {
                    b = random(sizeof(CarMap2));
                    if(c2[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c2[b]++;
                    break;
                }
            }
            case 3:
            {
                for(new z;z<sizeof(CarMap3);z++)
                {
                    b = random(sizeof(CarMap3));
                    if(c3[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c3[b]++;
                    break;
                }
            }
            case 4:
            {
                for(new z;z<sizeof(CarMap4);z++)
                {
                    b = random(sizeof(CarMap4));
                    if(c4[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c4[b]++;
                    break;
                }
            }
            case 5:
            {
                for(new z;z<sizeof(CarMap5);z++)
                {
                    b = random(sizeof(CarMap5));
                    if(c5[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c5[b]++;
                    break;
                }
            }
            case 6:
            {
                for(new z;z<sizeof(CarMap6);z++)
                {
                    b = random(sizeof(CarMap6));
                    if(c6[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c6[b]++;
                    break;
                }
            }
            case 7:
            {
                for(new z;z<sizeof(CarMap7);z++)
                {
                    b = random(sizeof(CarMap7));
                    if(c7[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c7[b]++;
                    break;
                }
            }
            case 8:
            {
                for(new z;z<sizeof(CarMap8);z++)
                {
                    b = random(sizeof(CarMap8));
                    if(c8[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c8[b]++;
                    break;
                }
            }
            case 9:
            {
                for(new z;z<sizeof(CarMap9);z++)
                {
                    b = random(sizeof(CarMap9));
                    if(c9[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c9[b]++;
                    break;
                }
            }
            case 10:
            {
                for(new z;z<sizeof(CarMap10);z++)
                {
                    b = random(sizeof(CarMap10));
                    if(c10[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c10[b]++;
                    break;
                }
            }
            case 11:
            {
                for(new z;z<sizeof(CarMap11);z++)
                {
                    b = random(sizeof(CarMap11));
                    if(c11[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c11[b]++;
                    break;
                }
            }
            case 12:
            {
                for(new z;z<sizeof(CarMap12);z++)
                {
                    b = random(sizeof(CarMap12));
                    if(c12[b])
                    {
                        z--;
                        continue;
                    }
                    PutPlayerInVehicle(i,b,0);
                    c12[b]++;
                    break;
                }
            }
        }
    }
}
The problem:
-> Ok everything is fine untill when everyone must change to another map..

=> SOME PLAYERS DON'T SPAWN/TELEPORTS TO ANOTHER/THE SAME MAP !

PLZ help me asap, and who helped me i'll give reps
Reply
#2

pawn Code:
CarMap1[rand1]
What's the rand1 for?
Reply
#3

Quote:
Originally Posted by Delux13
View Post
pawn Code:
CarMap1[rand1]
What's the rand1 for?
Put the player in a random vehicle in map 1 (
pawn Code:
new CarMap1[29]
)
Reply
#4

You said they teleport to another or the same map.
When they do, are they in the vehicle they are supposed to be put in?
Reply
#5

Do you want them to spawn on the same map or every player on a different map?
Reply
#6

Quote:
Originally Posted by Delux13
View Post
You said they teleport to another or the same map.
When they do, are they in the vehicle they are supposed to be put in?
Quote:
Originally Posted by Lenny the Cup
View Post
Do you want them to spawn on the same map or every player on a different map?
Well ... all to the same map + they must putted in a vehicle when they go to another map
Reply
#7

Try first setting their position.
Reply
#8

They are given different maps because you randomize the mapnumber for each player.
Reply
#9

Quote:
Originally Posted by Delux13
View Post
Try first setting their position.
of what? xp the cars ? x)

Quote:
Originally Posted by Lenny the Cup
View Post
They are given different maps because you randomize the mapnumber for each player.
huh ? :S how mean.. how should i do that then ?
Reply
#10

pawn Code:
forward NewMap();
public NewMap()
{
    new OtherSpawn = random(12);//i have 12 different maps, so 12 randoms
    foreach(Player,i) { //so everyone must do this ...
        DontSpectating(i);
        SetPlayerColor(i,COLOR_GREEN);
        CreateNewVehicles();//ignore
        SetPVarInt(i,"Missiles",0);
        PlayerJustConnected[i] = 0;
        switch (OtherSpawn)//switch statement...
        {
            case 0://map 1
            {
                print("Went to map 1");
                new rand1=random(30);
                PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
                   //@ above: this i have untill "case 11:". Also a print, new rand1,rand2,...; Putplayerinvehicle ... etc.
        }
        TextDrawShowForAll(Textdraw6);//idk if that must be here ...
    }
    return 1;
}
Reply
#11

Quote:
Originally Posted by wups
View Post
pawn Code:
forward NewMap();
public NewMap()
{
    new OtherSpawn = random(12);//i have 12 different maps, so 12 randoms
    foreach(Player,i) { //so everyone must do this ...
        DontSpectating(i);
        SetPlayerColor(i,COLOR_GREEN);
        CreateNewVehicles();//ignore
        SetPVarInt(i,"Missiles",0);
        PlayerJustConnected[i] = 0;
        switch (OtherSpawn)//switch statement...
        {
            case 0://map 1
            {
                print("Went to map 1");
                new rand1=random(30);
                PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
                   //@ above: this i have untill "case 11:". Also a print, new rand1,rand2,...; Putplayerinvehicle ... etc.
        }
        TextDrawShowForAll(Textdraw6);//idk if that must be here ...
    }
    return 1;
}
nope :-/ don't work
Reply
#12

plz help me further
Reply
#13

Plz x( (asap)
Reply
#14

What is ACTUALLY your problem now? It didn't become clear to me, sorry.
Reply
#15

The players don't spawn/teleport to another (random) map :-/
Reply
#16

I'd like to see the CreateNewVehicle stocks
Reply
#17

Quote:
Originally Posted by Jochemd
View Post
I'd like to see the CreateNewVehicle stocks
pawn Code:
stock CreateNewVehicles()
{
    LoopEx(i,0,sizeof(CarMap1)) SetVehicleToRespawn(CarMap1[i]);
    //for each map ...
        LoopEx(i,0,sizeof(CarMap2)) SetVehicleToRespawn(CarMap2[i]);
         //etc ...
}
Reply
#18

pawn Code:
switch (OtherSpawn)//switch statement...
        {
            case 0://map 1
            {
                print("Went to map 1");
                new rand1=random(30);
                PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
                   //@ above: this i have untill "case 11:". Also a print, new rand1,rand2,...; Putplayerinvehicle ... etc.
        }
^ Does that respond? Or it's just simply not loading?
Reply
#19

Quote:
Originally Posted by Lorenc_
View Post
pawn Code:
switch (OtherSpawn)//switch statement...
        {
            case 0://map 1
            {
                print("Went to map 1");
                new rand1=random(30);
                PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
                TextDrawSetString(Textdraw6,"~g~ Arena 666 ~w~ by ~y~ Michael@Belgium");
            }
                   //@ above: this i have untill "case 11:". Also a print, new rand1,rand2,...; Putplayerinvehicle ... etc.
        }
^ Does that respond? Or it's just simply not loading?
Well i see in the console "Went to map x" but in-game i just don't go there ... and if i spawn it's ALWAYS in the first map and not others ..
Reply
#20

Uhm....

Code:
/rcon mapname [name] - change the map name text (example: /rcon mapname San Andreas).
I don't think it changes the actual map
Instead this might work?

Code:
/rcon changemode [mode] - This command will change the current gamemode to the given one (example: if you want to play sftdm: /rcon changemode sftdm)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)