SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/08/2011, 12:21 PM   #1
Michael@Belgium
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 1,770
Reputation: 1001
Exclamation Changing to another map

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
__________________

Need host-tab ? Contact me on discord^

sO aCtIvE
You last visited: 11/01/2018 at 11:21 PM
You last visited: 09/10/2018 at 08:30 PM

Last edited by Michael@Belgium; 22/09/2011 at 02:22 PM.
Michael@Belgium is offline   Reply With Quote
Old 22/08/2011, 12:27 PM   #2
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,272
Reputation: 105
Default Re: Changing to another map ! *NEED HELP ASAP*

pawn Code:
CarMap1[rand1]
What's the rand1 for?
__________________
[MWR]Blood is offline   Reply With Quote
Old 22/08/2011, 12:29 PM   #3
Michael@Belgium
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 1,770
Reputation: 1001
Default Re: Changing to another map ! *NEED HELP ASAP*

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]
)
__________________

Need host-tab ? Contact me on discord^

sO aCtIvE
You last visited: 11/01/2018 at 11:21 PM
You last visited: 09/10/2018 at 08:30 PM
Michael@Belgium is offline   Reply With Quote
Old 22/08/2011, 12:36 PM   #4
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,272
Reputation: 105
Default Re: Changing to another map ! *NEED HELP ASAP*

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?
__________________
[MWR]Blood is offline   Reply With Quote
Old 22/08/2011, 12:46 PM   #5
Lenny the Cup
Huge Clucker
 
Join Date: Jan 2008
Posts: 212
Reputation: 17
Default Re: Changing to another map ! *NEED HELP ASAP*

Do you want them to spawn on the same map or every player on a different map?
__________________
Lenny / Lenny Carlson @ LS-RP.com
My pastebin - All my released scripts
pawn Code:
-,-----,
/----/ |                                           ,---,   ,----,
|    | |      ,------, ,----,  ,----, ,----,  ,---/---/ \ /---/ |
|    | |     /-----/ |/----/ \/---/ |/----/ \/--- \   \  /   / /
|    | |     |  ,__|/ |     \|    | ||     \|    | \   \/   / /
|    | |____ |  ---,/||      \    | ||      \    | |\      / /
|    |____/ ||  ,__|/ |   ^\      | ||   ^\      | | |    | |
|         | ||  ---,/||   | \     | /|   | \     | | |    | |
|_________|/ |_____|/ |___,/ \____,/ |___,/ \____,/  |____,/
Lenny the Cup is offline   Reply With Quote
Old 22/08/2011, 01:57 PM   #6
Michael@Belgium
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 1,770
Reputation: 1001
Default Re: Changing to another map ! *NEED HELP ASAP*

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
__________________

Need host-tab ? Contact me on discord^

sO aCtIvE
You last visited: 11/01/2018 at 11:21 PM
You last visited: 09/10/2018 at 08:30 PM
Michael@Belgium is offline   Reply With Quote
Old 22/08/2011, 02:13 PM   #7
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,272
Reputation: 105
Default Re: Changing to another map ! *NEED HELP ASAP*

Try first setting their position.
__________________
[MWR]Blood is offline   Reply With Quote
Old 22/08/2011, 03:09 PM   #8
Lenny the Cup
Huge Clucker
 
Join Date: Jan 2008
Posts: 212
Reputation: 17
Default Re: Changing to another map ! *NEED HELP ASAP*

They are given different maps because you randomize the mapnumber for each player.
__________________
Lenny / Lenny Carlson @ LS-RP.com
My pastebin - All my released scripts
pawn Code:
-,-----,
/----/ |                                           ,---,   ,----,
|    | |      ,------, ,----,  ,----, ,----,  ,---/---/ \ /---/ |
|    | |     /-----/ |/----/ \/---/ |/----/ \/--- \   \  /   / /
|    | |     |  ,__|/ |     \|    | ||     \|    | \   \/   / /
|    | |____ |  ---,/||      \    | ||      \    | |\      / /
|    |____/ ||  ,__|/ |   ^\      | ||   ^\      | | |    | |
|         | ||  ---,/||   | \     | /|   | \     | | |    | |
|_________|/ |_____|/ |___,/ \____,/ |___,/ \____,/  |____,/
Lenny the Cup is offline   Reply With Quote
Old 22/08/2011, 04:23 PM   #9
Michael@Belgium
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 1,770
Reputation: 1001
Default Re: Changing to another map ! *NEED HELP ASAP*

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 ?
__________________

Need host-tab ? Contact me on discord^

sO aCtIvE
You last visited: 11/01/2018 at 11:21 PM
You last visited: 09/10/2018 at 08:30 PM
Michael@Belgium is offline   Reply With Quote
Old 22/08/2011, 04:27 PM   #10
wups
High-roller
 
wups's Avatar
 
Join Date: Apr 2010
Posts: 1,216
Reputation: 141
Default Re: Changing to another map ! *NEED HELP ASAP*

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;
}
wups is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Map Changing.. vassilis Scripting Help 3 17/01/2012 01:55 PM
Map Changing vassilis Scripting Help 0 22/11/2011 05:28 PM
Map Changing :D vassilis Scripting Help 7 15/11/2011 12:22 PM
Changing RieTzz Help Archive 0 06/01/2010 01:53 PM
GM changing jamesb93 Help Archive 5 15/11/2009 03:22 PM


All times are GMT. The time now is 11:00 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.