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


Messages In This Thread
Making it Random - by (_AcE_) - 27.12.2011, 05:08
Re: Making it Random - by Lorenc_ - 27.12.2011, 05:11
Re: Making it Random - by (_AcE_) - 27.12.2011, 05:15
Re: Making it Random - by jamesbond007 - 27.12.2011, 05:18
Re: Making it Random - by (_AcE_) - 27.12.2011, 05:42
Re: Making it Random - by jamesbond007 - 27.12.2011, 07:15

Forum Jump:


Users browsing this thread: 1 Guest(s)