SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/07/2012, 11:01 PM   #11
lelemaster
Huge Clucker
 
lelemaster's Avatar
 
Join Date: Jul 2012
Posts: 264
Reputation: 17
Default Re : Re: Duel

Quote:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
Duel[clickp[playerid]] = playerid;
format(string,sizeof string,"Игрок %s(%i) вызывает Вас на дуэль\nВы согласны?",pName,playerid);
ShowPlayerDialog(clickp[playerid],AccDuel,DIALOG_STYLE_MSGBOX,"Вызов на дуэль:",string,"Принять","Отклонить");
This is okay ^^

Quote:
pawn Code:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    clickp[playerid] = clickedplayerid;
    ShowPlayerDialog(playerid,clickplmenu,DIALOG_STYLE_LIST,"Меню игрока","Посмотреть статистику\nВызвать на дуэль\nНаписать личное сообщение","OK","Закрыть");
    return 1;
}
This is okay ^^


Quote:
pawn Code:
new pName[MAX_PLAYER_NAME];
    if(clickp[playerid] == playerid) return SendError(playerid, "Вы не можете вызвать на дуэль самого себя!");
    GetPlayerName(playerid, pName, sizeof(pName));
    Duel[clickp[playerid]] = playerid;
    g_GotInvitedToDuel[clickp[playerid]] = playerid;
    g_HasInvitedToDuel[playerid] = 1;
    format(string,sizeof string,"Игрок %s(%i) вызывает Вас на дуэль\nВы согласны?",pName,playerid);
    ShowPlayerDialog(clickp[playerid],AccDuel,DIALOG_STYLE_MSGBOX,"Вызов на дуэль:",string,"Принять","Отклонить");
This will now work^^.
lelemaster is offline   Reply With Quote
Old 13/07/2012, 05:45 PM   #12
[HHT]DRON
Huge Clucker
 
Join Date: Aug 2011
Location: Russia,Samara163
Posts: 219
Reputation: 3
Default Re: Duel

Thanks =)
How to do if you are already engaged in a duel players, it was impossible to call until it is over?
[HHT]DRON is offline   Reply With Quote
Old 14/07/2012, 05:36 PM   #13
lelemaster
Huge Clucker
 
lelemaster's Avatar
 
Join Date: Jul 2012
Posts: 264
Reputation: 17
Default Re : Re: Duel

Quote:
Originally Posted by [HHT]DRON View Post
Thanks =)
How to do if you are already engaged in a duel players, it was impossible to call until it is over?
Are you meaning, if someone else want to do a duel with someone that is already in?

Just make:

pawn Code:
new IsInDuel[MAX_PLAYERS];

//Under on player connect

IsInDuel[playerid] = 0;

//

new pName[MAX_PLAYER_NAME];
    if(clickp[playerid] == playerid) return SendError(playerid, "Вы не можете вызвать на дуэль самого себя!");
    if(IsInDuel[clickp[playerid]] == 1) return SendError(playerid, "The player is already in a duel!");
    GetPlayerName(playerid, pName, sizeof(pName));
    Duel[clickp[playerid]] = playerid;
    g_GotInvitedToDuel[clickp[playerid]] = playerid;
    g_HasInvitedToDuel[playerid] = 1;
    format(string,sizeof string,"Игрок %s(%i) вызывает Вас на дуэль\nВы согласны?",pName,playerid);
    ShowPlayerDialog(clickp[playerid],AccDuel,DIALOG_STYLE_MSGBOX,"Вызов на дуэль:",string,"Принять","Отклонить");

//

if(dialogid == AccDuel)
    {
        if(response)
        {
            if(Duel[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"The player left the game, impossible to do a duel with him.");
            IsInDuel[playerid] = 1;
            IsInDuel[Duel[payerid]] = 1;
            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);
            //
            ResetPlayerWeapons(Duel[playerid]);
            GivePlayerWeapon(Duel[playerid],31,9999);
            GivePlayerWeapon(Duel[playerid],24,9999);
            GivePlayerWeapon(Duel[playerid],25,9999);
            SetPlayerHealth(Duel[playerid], 100);
            SetPlayerArmour(Duel[playerid], 100);
            SetPlayerPos(Duel[playerid],2060.2151,2385.5791,45.2265);
        }
        else
        {
            new string[128], pName[MAX_PLAYER_NAME], pSendername[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, sizeof(pName));
            GetPlayerName(Duel[playerid], pSendername, sizeof(pSendername));
            if(Duel[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"The player left the game, impossible to decline the duel.");
            format(string, sizeof(string), "You declined the duel of %s.", pSendername);
            SendClientMessage(playerid,-1,string);
            format(string, sizeof(string), "%s declined your duel invitation", pName);
            SendClientMessage(Duel[playerid],-1,string);
        }
    }

//Add at the place that the duel finish
IsInDuel[playerid] = 0;
lelemaster is offline   Reply With Quote
Old 15/07/2012, 10:52 AM   #14
[HHT]DRON
Huge Clucker
 
Join Date: Aug 2011
Location: Russia,Samara163
Posts: 219
Reputation: 3
Default Re: Duel

thank you! =)
[HHT]DRON is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Duel System DKN | /duel [playerid] ipsBruno Filterscripts 9 28/07/2012 06:37 PM
/duel [LTU]mindux9[TCS] Scripting Help 1 02/02/2012 12:50 PM
Need help with duel system [/duel] admantis Scripting Help 5 12/11/2011 09:10 AM
Help with duel Aram555 Help Archive 0 22/01/2010 05:58 PM
Duel Saving Screenshots and Videos 4 24/06/2009 05:28 PM


All times are GMT. The time now is 04:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.