Map changing system
#1

Hi.

I am scripting my own server (from scratch) and the mode will be TDM. So basically I want to have a map change system like CSS SA-MP and SWAT4 SA-MP servers (tbh I'm not trying to copy them, my idea is maybe "greater" than them, not showing off). And this is it, I don't know how to. I just don't want to add objects in one whole script, or does it has to be like that or paste in another FS then script some stuffs? Please help me out.

Again, I'm not trying to copy the servers, I'm making one for my own.

Regards,
Huxley.
Reply
#2

I made this a long time ago:
pawn Код:
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define COLOR_RED 0xFF0000FF

new MapNames[][4] =
{
    {55,66,77},
    {1,1,1}
};

new Map[][] =
{
    "Map1",
    "Map2"
};

new CurrentMap = 0;
new Votes[50];
new CanVote[MAX_PLAYERS];
new bool:ActiveVote;

stock GetHighestNumberEx(num[], size = sizeof(num))
{
    new highesty = 0;
    for (new i = 0; i < size; i++)
    {
        if (num[i] > highesty) highesty = num[i];
    }
    return highesty;
}

forward endvote();
public endvote()
{
    ActiveVote = false;
    new high = GetHighestNumberEx(Votes);
    printf("%d",high);
    for (new i = 0; i<sizeof(Votes);i++)
    {
        if (Votes[i] == high)
        {
        CurrentMap = i;
        new msg[50];
        format(msg,sizeof(msg),"The Map %s Has been Nominated.",Map[i]);
        SendClientMessageToAll(COLOR_RED,msg);
        break;
        }
    }
   
    return 1;
}
forward BeginVote();
public BeginVote()
{
    SendClientMessageToAll(COLOR_RED,"Voting Ends in 15 seconds. Cast your Votes");
    SetTimer("endvote",15000,0);
    ActiveVote = true;
    new info[150];
    for (new i = 0;i<sizeof(MapNames);i++)
    {
        if (i == 0) format(info,sizeof(info),"%s\n",Map[i]);
        if (i == sizeof(MapNames)-1) format(info,sizeof(info),"%s%s",info,Map[i]);
        if (i != sizeof(MapNames) && i != 0) format(info,sizeof(info),"%s\n",info,Map[i]);
    }
    for (new i = 0;i<MAX_PLAYERS; i++)
    {
        CanVote[i] = 1;
        ShowPlayerDialog(i,500,DIALOG_STYLE_LIST,"Vote for Map",info,"Vote","Vote");
    }
    return 1;
}


stock GetHighestNumber(...)
{
    new args = numargs();
    new highestyet = 0;
    for (new i = 0; i<args; i++)
    {
        if (getarg(i,0) > highestyet) highestyet = getarg(i,0);
    }
    return highestyet;
}

public OnPlayerConnect(playerid)
{
    if (ActiveVote == true) CanVote[playerid] = 0;
    return 1;
}

forward Spawn(playerid);
public Spawn(playerid)
{
    SetPlayerPos(playerid,MapNames[CurrentMap][1],MapNames[CurrentMap][2],MapNames[CurrentMap][3]);
    new msg[50];
    format(msg,sizeof(msg),"You have Spawned In Map: %s(%d,%d,%d)",Map[CurrentMap],MapNames[CurrentMap][0],MapNames[CurrentMap][1],MapNames[CurrentMap][2]);
    SendClientMessage(playerid,COLOR_RED,msg);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetTimerEx("Spawn",500,0,"%d",playerid);
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 500)
    {
        Votes[listitem] ++;
    }
    return 1;
}
EDITED
Reply
#3

u have to make GM for each mission, and settimer for it to over. Example :
pawn Код:
new GameTimer;
GameTimer = SetTimer("GameTime",1000,1);//mission time here
pawn Код:
public GameTimer(playerid)
{
    SendRconCommand("changemode GM NAME HERE");
    GameTextForAll("~y~Changing Game ~n~ ~w~Please Wait....",5000,1);
    KillTimer(GameTimer);
    for(new i;i<15;++i)
    {
        SendClientMessageToAll(purple," ");
    }
}
hope that helps
Reply
#4

Hmm, can it change FS instead GM?
Reply
#5

Yeah it can.
Reply
#6

Well then, thanks for the help guys. <3 y'all (no homo).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)