How to change maps
#1

alright guys, now so im starting my new gamemode, i wanna know how can i change the mapname and a map after a couple of minutes, example after 30 mins, can anyone help here? it is gunna be a My own map, im gunna be mapping it in MTA
Reply
#2

pawn Код:
new CurrentMap = 0;

public OnGameModeInit()
{
    SetTimer("MapChanger", 300000, true)
    return 1;
}

forward MapChanger();
public MapChanger()
{
    switch(CurrentMap)
    {
        case 0: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        case 1: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        case 2: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        case 3: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        case 4: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        case 5: CurrentMap ++, KillEveryone(), SendRconCommand("mapname MAP_NAME");
        default: CurrentMap = 0, KillEveryone(), SendRconCommand("mapname MAP_NAME");
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(CurrentMap == 1)
    {
        //SetPlayerPos: Map 1 spawn
    }
    else if(CurrentMap == 2)
    {
        //SetPlayerPos: Map 1 spawn
    }
    else if(CurrentMap == 3)
    {
        //SetPlayerPos: Map 1 spawn
    }
    else if(CurrentMap == 4)
    {
        //SetPlayerPos: Map 1 spawn
    }
    else if(CurrentMap == 5)
    {
        //SetPlayerPos: Map 1 spawn
    }
    return 1;
}

stock KillEveryone()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerHealth(i, 0.0);
    }
}
Reply
#3

And you can modify the mapname by using this:
pawn Код:
SendRconCommand("mapname YourMapName");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)