SA-MP Forums Archive
Changing to another map - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Changing to another map (/showthread.php?tid=278450)

Pages: 1 2


Re: Changing to another map ! *NEED HELP ASAP* - Michael@Belgium - 26.08.2011

Quote:
Originally Posted by Pinguinn
View Post
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)
?? xD I know that "Arena 666" is a map from in-game lol, if we play there (or teleported to there) the map must change too


Re: Changing to another map ! *NEED HELP ASAP* - Pinguinn - 26.08.2011

Quote:
Originally Posted by Michael@Belgium
View Post
?? xD I know that "Arena 666" is a map from in-game lol, if we play there (or teleported to there) the map must change too
Does your 'Map' at server info change?


Re: Changing to another map ! *NEED HELP ASAP* - Michael@Belgium - 26.08.2011

Quote:
Originally Posted by Pinguinn
View Post
Does your 'Map' at server info change?
yes ...


Re: Changing to another map ! *NEED HELP ASAP* - Pinguinn - 26.08.2011

Quote:
Originally Posted by Michael@Belgium
View Post
yes ...
Do you spawn the vehicles before you put them in the vehicles?


Re: Changing to another map ! *NEED HELP ASAP* - gamer931215 - 27.08.2011

pawn Code:
new rand1=random(30);
PutPlayerInVehicle(i, CarMap1[rand1], 0);
You are here picking a random vehicle and putting the player in it, but it doesnt check if there already is a player in the vehicle does it ?

Because if you try calling PutPlayerInVehicle() and the seat is already occupied it will just ignore it and players will NOT be teleported in the vehicle.


Re: Changing to another map ! *NEED HELP ASAP* - Michael@Belgium - 28.08.2011

Quote:
Originally Posted by gamer931215
View Post
pawn Code:
new rand1=random(30);
PutPlayerInVehicle(i, CarMap1[rand1], 0);
You are here picking a random vehicle and putting the player in it, but it doesnt check if there already is a player in the vehicle does it ?

Because if you try calling PutPlayerInVehicle() and the seat is already occupied it will just ignore it and players will NOT be teleported in the vehicle.
OMG you're true ! xD So stupid .. but how to do it then ?


Re: Changing to another map ! *NEED HELP ASAP* - gamer931215 - 28.08.2011

Quote:
Originally Posted by Michael@Belgium
View Post
OMG you're true ! xD So stupid .. but how to do it then ?
Use a variable, like in this example:

pawn Code:
new bool:VehicleUsed[30];

//call this if you need a random id between 0/30
stock GetRandomVehicleID()
{
    for(new i = 0;i<30;i++)
    {
        if(!VehicleUsed[i])
        {
            VehicleUsed[i] = true;
            return i;
        }
    }
    return -1; //no vehicles left
}

//call this if youre changing your maps
stock ResetVehicles()
{
    for(new i = 0;i<30;i++)
    {
        VehicleUsed[i] = false;
    }
}
If your not always using 30 vehicles, then use a parameter to get the map like this:
pawn Code:
stock GetRandomVehicleID(map)
{
    switch(map)
    {
        case 0:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
    }
    return -1; //no vehicles left
}
or just use the parameter to set the limit for the loop


Re: Changing to another map ! *NEED HELP ASAP* - Michael@Belgium - 29.08.2011

Quote:
Originally Posted by gamer931215
View Post
Use a variable, like in this example:

pawn Code:
new bool:VehicleUsed[30];

//call this if you need a random id between 0/30
stock GetRandomVehicleID()
{
    for(new i = 0;i<30;i++)
    {
        if(!VehicleUsed[i])
        {
            VehicleUsed[i] = true;
            return i;
        }
    }
    return -1; //no vehicles left
}

//call this if youre changing your maps
stock ResetVehicles()
{
    for(new i = 0;i<30;i++)
    {
        VehicleUsed[i] = false;
    }
}
If your not always using 30 vehicles, then use a parameter to get the map like this:
pawn Code:
stock GetRandomVehicleID(map)
{
    switch(map)
    {
        case 0:
        {
            for(new i = 0;i<30;i++)
            {
                if(!VehicleUsed[i])
                {
                    VehicleUsed[i] = true;
                    return i;
                }
            }
        }
    }
    return -1; //no vehicles left
}
or just use the parameter to set the limit for the loop
So in stead off
pawn Code:
new rand1=random(30);
PutPlayerInVehicle(i, CarMap1[rand1], 0);
I have to use this:
pawn Code:
PutPlayerInVehicle(i,GetRandomVehicleID(1),0);//for map 1



Re: Changing to another map ! *NEED HELP ASAP* - gamer931215 - 29.08.2011

Quote:
Originally Posted by Michael@Belgium
View Post
So in stead off
pawn Code:
new rand1=random(30);
PutPlayerInVehicle(i, CarMap1[rand1], 0);
I have to use this:
pawn Code:
PutPlayerInVehicle(i,GetRandomVehicleID(1),0);//for map 1
Yes, it will not exactly get a random id/spot, but it will just go from 1-2-3-4-5 etc


Re: Changing to another map ! *NEED HELP ASAP* - Suraj - 15.09.2011

Quote:
Originally Posted by [MWR]Blood
View Post
Try first setting their position.
Agreed


Re: Changing to another map ! *NEED HELP ASAP* - Michael@Belgium - 30.09.2011

why i should chek that ? even i don't chek it .. it still don't work x)