Im Making a Minigame
#1

Hey guys.. im trying to make a minigame..

i have started with this

Код:
if (strcmp("/mini", cmdtext, true, 10)==0)
	{
		SendClientMessageToAll(0xFFE600FF,"Minigame is Starting in 20 seconds /enroll to enroll for it");
		SetTimer("mini",20000,0);
		return 1;
	}
	return 0;
i would call a public function with the name pirate()

now i want to script other people joining this and minigame starting within the 20 seconds and once that happens what i want to do inside is.. randomly assign players to teams who join this and also at the same time teams should be balance.. and one team spawns at one place.. and the other at other place..

anyone can explain how to ?
Reply
#2

Don't you have more code?
Reply
#3

Try something like this:

On top:

pawn Код:
//D-day
new bool:WarStarted;
new WarJoin[MAX_PLAYERS];
pawn Код:
forward Dday(playerid);
pawn Код:
#define MAX_TEAMS 2

//D-day battle 2 teams.
#define TEAM_ATTACKER 0
#define TEAM_DEFENDER 1
pawn Код:
forward winorlosetime();
And anywhere in script:
pawn Код:
CMD:startwar(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
    if(WarStarted) return SendClientMessage(playerid, 0xFF0000FF, "Someone has already started an D-day.");
    WarStarted = true;
    new Name[MAX_PLAYER_NAME], Ddaymsg[128];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(Ddaymsg, sizeof(Ddaymsg), "%s Wants to Start D-day, Please type /joinwar to join.", Name, playerid);
    SendClientMessageToAll(0x00FF00FF, Ddaymsg);
    WarJoin[playerid] = 1;
    return 1;
}

CMD:joinwar(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
    if(!WarStarted) return SendClientMessage(playerid, 0xFF0000FF, "Noone has started an D-day, Please type /startwar to start one if its already not going on.");
    if(WarJoin[playerid]) return SendClientMessage(playerid, 0xFF0000FF, "You already joined the Dday, Please type /disjoin to Disjoin.");
    if(WarStarted)
    {
       WarJoin[playerid] = 1;
       SendClientMessage(playerid, 0x00FF00FF, "You have joined the D-day, You will teleported in 20 seconds.");
    }
    new Name[MAX_PLAYER_NAME], Ddaymsg[128];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(Ddaymsg, sizeof(Ddaymsg), "Some Players has joined the D-day, It will start in Max: 20 secs.", Name, playerid);
    SendClientMessageToAll(0x00FF00FF, Ddaymsg);
    format(Ddaymsg, sizeof(Ddaymsg), "%s has joined the D-day, Type /Joinwar if you want to join too.", Name, playerid);
    SendClientMessageToAll(0x00FF00FF, Ddaymsg);
    SetTimer("Dday", 20000, 0);
    SetTimer("Winorlosetime", 20000, 0);
    return 1;
}

CMD:disjoin(playerid, params[])
{
 //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
    if(!WarStarted) return SendClientMessage(playerid, 0xFF0000FF, "Noone has started an D-day or its going on currently, You can't type /Disjoin.");
    if(WarJoin[playerid])
    {
       WarJoin[playerid] = 0;
       SendClientMessage(playerid, 0xFF00FFAA, "You won't participate anymore.");
    }
    return 1;
}

public winorlosetime()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    if(WarJoin[i])
    {
      SpawnPlayer(i);
      ResetPlayerWeapons(i);
      SendClientMessage(i, 0x00FF00FF, "Well done guys, We was having a good war between 2 teams.");
      GivePlayerMoney(i, 60000);
      SetPlayerVirtualWorld(i, 0);
    }
    return 1;
}
public Dday(playerid)
{
    new count = 0;
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            if(WarJoin[i] == 1) count++;
        }
    }
    {
        for(new i=0; i<GetMaxPlayers(); i++)
        {
            if(IsPlayerConnected(i))
            {
                if(WarJoin[i] == 1)
                {
                    if(count == 0)
                    {
                        SetPlayerTeam(i, 0);
                        SetPlayerColor(i, 0xFF0000FF); // Red
                        SetPlayerVirtualWorld(i, 3);
                        ResetPlayerWeapons(i);
                        GivePlayerWeapon(i, 32, 200);
                        GivePlayerWeapon(i, 26, 200);
                        GameTextForPlayer(i,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
                        SetPlayerPos(i, -143.5201,2462.7905,16.5642);
                        count = 1;
                    }
                    else if(count == 1)
                    {
                        SetPlayerTeam(i, 1);
                        SetPlayerColor(i, 0x00FF00FF); // Green
                        SetPlayerVirtualWorld(i, 3);
                        ResetPlayerWeapons(i);
                        GivePlayerWeapon(i, 32, 200);
                        GivePlayerWeapon(i, 26, 200);
                        GameTextForPlayer(i,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
                        SetPlayerPos(i, -39.8148,2367.1724,23.9401);
                        count = 0;
                    }
                    WarJoin[i] = 0;
                }
            }
        }
    }
    WarStarted = false;
    return 1;
}

You must try something like that.
Reply
#4

Perfect thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)