I need Duel system
#9

Here is a example for just one arena

pawn Код:
new DualStarted;
new DualJoin;
new Dualers[2];

public OnGameModeInit()
{
    Dualers[0] = -1;
    Dualers[1] = -1;
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/dual", cmdtext, true))
    {
        if(DualStarted == 1) return SendClientMessage(playerid, 0xFF0000AA, "There is already a dual running!");
        if(DualJoin == 0)
        {
                    SendClientMessageToAll(0x1229FAFF, "The Dual arena has been started!");
                    SetPlayerPos(playerid, /*XPOS*/, /*YPOS*/, /*ZPOS*/);
                    GivePlayerWeapon(playerid, /*WeaponID*/, /*Amo*/);
                    Dualers[0] = playerid;
                    DualJoin = 1;
                    return 1;
        }
        if(DualJoin == 1)
        {
                    SendClientMessageToAll(0x1229FAFF, "The Dual has been started!");
                    SetPlayerPos(playerid, /*XPOS*/, /*YPOS*/, /*ZPOS*/);
                    GivePlayerWeapon(playerid, /*WeaponID*/, /*Amo*/);
                    DualStarted = 1;
                    Dualers[1] = playerid;
        }
        return 1;
    }
    return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new str[70];
    if(playerid == Dualers[0])
    {
        DualStarted = 0;
        SpawnPlayer(Dualers[1]);
        new Pname[24];
        GetPlayerName(Dualers[1], Pname, sizeof(Pname));
        format(str, sizeof(str), "%s has won the dual!", Pname);
        SendClientMessageToAll(0x1229FAFF, str);
        Dualers[0] = -1;
        Dualers[1] = -1;
    }
    if(playerid == Dualers[1])
    {
        DualStarted = 0;
        SpawnPlayer(Dualers[0]);
        new Pname[24];
        GetPlayerName(Dualers[0], Pname, sizeof(Pname));
        format(str, sizeof(str), "%s has won the dual!", Pname);
        SendClientMessageToAll(0x1229FAFF, str);
        Dualers[0] = -1;
        Dualers[1] = -1;
    }
    return 1;
}
Reply


Messages In This Thread
Can be deleted - by liinor - 24.06.2011, 11:31
Re: I need Duel system - by Stigg - 24.06.2011, 11:53
Can be deleted - by liinor - 24.06.2011, 13:26
Re: I need Duel system - by Jay. - 24.06.2011, 13:32
Re: I need Duel system - by Sascha - 24.06.2011, 13:36
Re: I need Duel system - by liinor - 24.06.2011, 13:46
Re: I need Duel system - by liinor - 24.06.2011, 15:42
Can be deleted - by liinor - 25.06.2011, 14:17
Re: I need Duel system - by [HiC]TheKiller - 25.06.2011, 14:42
Can be deleted - by liinor - 12.10.2011, 16:43

Forum Jump:


Users browsing this thread: 1 Guest(s)