Making it Random
#1

Hi I have a command that starts a round in a random interior and i type -1 for random. so example /startround -1 and it will select a new map's id.

Well I want the game mode to start a random map's id when I type /startround -1. But instead it isnt working. This is what i did:

pawn Код:
new const Float:InteriorsB[10][] = {
{40},
{41},
{43},
{44},
{45},
{46},
{47},
{48},
{49},
{50}
};
Those are the ids of the maps that are interiors

pawn Код:
dcmd_startint(playerid,params[])
    {
        if(!IsPlayerAdmin(playerid) && Variables[playerid][Level] < aLvl[0]){return DenyPlayer(playerid);}
        if(Current != -1)return SendClientMessage(playerid,MainColors[2],"Please wait until the current round ends before starting another one.");
        if(CurrentPlayers[T_HOME] < 1 && CurrentPlayers[T_AWAY] < 1) return SendClientMessage(playerid,MainColors[2],"Not enough players.");
        if(WatchingBase == true) return SendClientMessage(playerid, MainColors[2], "Please wait until the current round ends before starting another one.");
        if(!strlen(params)) return SendClientMessage(playerid, MainColors[1], "Usage: /startbase [baseid]");
        if(CurrentPlayers[T_HOME] < 1 || CurrentPlayers[T_AWAY] < 1)return SendClientMessage(playerid, MainColors[2], "Not enough players.");
        if(strval(params) == -1)
        {
            new randint = random(sizeof(InteriorsB));
            if(!BaseExists[randint])return SendClientMessage(playerid, MainColors[2], "incorrect interior.");
            new string[128];
            format(string,sizeof(string),"*** The random %d map has now started!",randint);
            SendClientMessageToAll(COLOR_ROUND,string);
            PrepareRound();
            SetTimerEx("StartRound",5000,0,"ii",randint,0);
            return 1;
        }
        return 1;
    }
When I type the command the bases that start are also exteriors.
Reply
#2

Try see if this works, all you need to do is replace your array with this:

pawn Код:
new const
    Float: InteriorsB[] =
    {
        40,
        41,
        43,
        44,
        45,
        46,
        47,
        48,
        49,
        50
    }
;
Reply
#3

Doesn't work. Still starts exteriors.
Reply
#4

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Try see if this works, all you need to do is replace your array with this:

pawn Код:
new const
    Float: InteriorsB[] =
    {
        40,
        41,
        43,
        44,
        45,
        46,
        47,
        48,
        49,
        50
    }
;
its not a float?

@OP try replacing with InteriorsB[randint][0]
Reply
#5

The 40 - 50 are the map numbers. Like say I /startround 12

Then it starts the 12th map..

I dont know if they are floats..
Reply
#6

pawn Код:
new const Float:InteriorsB[10][] = {
{40},
{41},
{43},
{44},
{45},
{46},
{47},
{48},
{49},
{50}
};

dcmd_startint(playerid,params[])
    {
        if(!IsPlayerAdmin(playerid) && Variables[playerid][Level] < aLvl[0]){return DenyPlayer(playerid);}
        if(Current != -1)return SendClientMessage(playerid,MainColors[2],"Please wait until the current round ends before starting another one.");
        if(CurrentPlayers[T_HOME] < 1 && CurrentPlayers[T_AWAY] < 1) return SendClientMessage(playerid,MainColors[2],"Not enough players.");
        if(WatchingBase == true) return SendClientMessage(playerid, MainColors[2], "Please wait until the current round ends before starting another one.");
        if(!strlen(params)) return SendClientMessage(playerid, MainColors[1], "Usage: /startbase [baseid]");
        if(CurrentPlayers[T_HOME] < 1 || CurrentPlayers[T_AWAY] < 1)return SendClientMessage(playerid, MainColors[2], "Not enough players.");
        if(strval(params) == -1)
        {
            new randint = random(sizeof(InteriorsB));
            if(!BaseExists[InteriorsB[randint][0] ])return SendClientMessage(playerid, MainColors[2], "incorrect interior.");
            new string[128];
            format(string,sizeof(string),"*** The random %d map has now started!",InteriorsB[randint][0] );
            SendClientMessageToAll(COLOR_ROUND,string);
            PrepareRound();
            SetTimerEx("StartRound",5000,0,"ii",InteriorsB[randint][0] ,0);
            return 1;
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)