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


Messages In This Thread
Changing to another map - by Michael@Belgium - 22.08.2011, 11:21
Re: Changing to another map ! *NEED HELP ASAP* - by [MWR]Blood - 22.08.2011, 11:27
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 22.08.2011, 11:29
Re: Changing to another map ! *NEED HELP ASAP* - by [MWR]Blood - 22.08.2011, 11:36
Re: Changing to another map ! *NEED HELP ASAP* - by Lenny the Cup - 22.08.2011, 11:46
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 22.08.2011, 12:57
Re: Changing to another map ! *NEED HELP ASAP* - by [MWR]Blood - 22.08.2011, 13:13
Re: Changing to another map ! *NEED HELP ASAP* - by Lenny the Cup - 22.08.2011, 14:09
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 22.08.2011, 15:23
Re: Changing to another map ! *NEED HELP ASAP* - by wups - 22.08.2011, 15:27
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 22.08.2011, 15:58
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 22.08.2011, 18:38
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 23.08.2011, 14:00
Re: Changing to another map ! *NEED HELP ASAP* - by Jochemd - 26.08.2011, 10:33
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 26.08.2011, 10:43
Re: Changing to another map ! *NEED HELP ASAP* - by Jochemd - 26.08.2011, 11:13
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 26.08.2011, 11:39
Re: Changing to another map ! *NEED HELP ASAP* - by Lorenc_ - 26.08.2011, 11:41
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 26.08.2011, 11:45
Re: Changing to another map ! *NEED HELP ASAP* - by Pinguinn - 26.08.2011, 11:51
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 26.08.2011, 12:06
Re: Changing to another map ! *NEED HELP ASAP* - by Pinguinn - 26.08.2011, 12:31
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 26.08.2011, 13:18
Re: Changing to another map ! *NEED HELP ASAP* - by Pinguinn - 26.08.2011, 14:02
Re: Changing to another map ! *NEED HELP ASAP* - by gamer931215 - 27.08.2011, 19:16
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 28.08.2011, 22:23
Re: Changing to another map ! *NEED HELP ASAP* - by gamer931215 - 28.08.2011, 22:38
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 29.08.2011, 11:04
Re: Changing to another map ! *NEED HELP ASAP* - by gamer931215 - 29.08.2011, 11:11
Re: Changing to another map ! *NEED HELP ASAP* - by Suraj - 15.09.2011, 01:54
Re: Changing to another map ! *NEED HELP ASAP* - by Michael@Belgium - 30.09.2011, 15:57

Forum Jump:


Users browsing this thread: 5 Guest(s)