SA-MP Forums Archive
Help me fix a duel =) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me fix a duel =) (/showthread.php?tid=364730)



Help me fix a duel =) - [HHT]DRON - 31.07.2012

How to do if one player goes to the duel, then bring back to the second spawn?

Если игрок вышел с дуэли
pawn Код:
if(playerid == g_DuelingID1 || playerid == g_DuelingID2)
        {
        g_DuelInProgress = 0;
        }
Confirmation of the duel
pawn Код:
if(dialogid == AccDuel)
        {
        if(response)
        {
        new pName[MAX_PLAYER_NAME], pSendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        GetPlayerName(Duel[playerid], pSendername, sizeof(pSendername));
        format(string, sizeof(string), "Началась дуэль между игроками %s и %s.",pSendername,pName);
        SendClientMessageToAll(-1, string);
        InitializeDuel(playerid);
        InitializeDuelEx(Duel[playerid]);
        g_IsPlayerDueling[playerid] = 1;
        g_IsPlayerDueling[Duel[playerid]] = 1;
        g_DuelingID1 = playerid;
        g_DuelingID2 = Duel[playerid];
        g_DuelInProgress = 1;
        }
        else
        {
        new pName[MAX_PLAYER_NAME], pSendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        GetPlayerName(Duel[playerid], pSendername, sizeof(pSendername));
        format(string, sizeof(string), "Вы отклонили приглашение на дуэль от игрока %s.", pSendername);
        SendClientMessage(playerid,-1,string);
        format(string, sizeof(string), "Игрок %s отклонил Ваше приглашение.", pName);
        SendClientMessage(Duel[playerid],-1,string);
        g_HasInvitedToDuel[playerid] = 0;
        }
        }



Re : Help me fix a duel =) - vernz - 31.07.2012

Please if you want us to help you, use [ pawn ] [ /pawn ] without space between "[" and pawn


Re: Help me fix a duel =) - RelaxCafe - 31.07.2012

OK, your lucky day..
Код:
 
new duelpos=0;
new Float:Duels[][]={
{-228.4663,-143.5901,80.8907,23.3188}, // duel position 1
{-229.1362,-144.519,80.8851,23.3188}
};
Everytime, a new duel starts make "duelpos = 0;"
When a player joins use this:
SetPlayerPos(playerid,Duels[duelpos][0],Duels[duelpos][1],Duels[duelpos][2]);
SetPlayerFacingAngle(playerid, Duels[duelpos][3]);
 ++duelpos;//this will make it ready for the second player and so on..
to add more positions use as follows.

new Floatuels[][]={
{-228.4663,-143.5901,80.8907,23.3188}, // duel position 1
{-229.1362,-144.519,80.8851,23.3188},
{-229.1362,-144.519,80.8851,23.3188},
{-229.1362,-144.519,80.8851,23.3188},
{-229.1362,-144.519,80.8851,23.3188}// the last one must not have the comman "," .
};


Re: Help me fix a duel =) - [HHT]DRON - 01.08.2012

I was so =)
pawn Код:
forward InitializeDuel(playerid);
public InitializeDuel(playerid)
{
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,31,9999);
    GivePlayerWeapon(playerid,24,9999);
    GivePlayerWeapon(playerid,25,9999);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    SetPlayerPos(playerid,2105.8318,2428.2993,45.2188);
    return 1;
}

forward InitializeDuelEx(playerid);
public InitializeDuelEx(playerid)
{
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,31,9999);
    GivePlayerWeapon(playerid,24,9999);
    GivePlayerWeapon(playerid,25,9999);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    SetPlayerPos(playerid,2060.2151,2385.5791,45.2265);
    return 1;
}