SA-MP Forums Archive
/duel command help - 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: /duel command help (/showthread.php?tid=517065)



/duel command help - AmirSlaYeR - 03.06.2014

hi .
How to Create /Duel <Playerid> and Player id for accept Type /acceptduel or /cancel duel .

/acceptduel = open a dialog for Duel requester and Select gun And Goto a location ?
/cancelduel = SendClientMessage to duel Requester ?!


HOw ?! plz Tell me faster


Re: /duel command help - Parallex - 03.06.2014

Using sscanf, and Variables.


Re: /duel command help - Johnson_Brooks - 03.06.2014

Im on my phone so i dont know if i had any mistakes in the following code:
pawn Код:
new IsDueled[MAX_PLAYERS];
CMD:duel(playerid,params[])
{
new targetID;
new string[128];
new pName[MAX_PLAYER_NAME];
new aName[MAX_PLAYER_NAME];
GetPlayerName(targetID,aName,sizeof(aName))
GetPlayerName(playerid,pName,sizeof(pName))
if(sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/duel [playerid]");
format(string,sizeof(string),"%s has challenged you to a duel,type /accept or /decline",pName);
SendClientMessage(targetID,COLOR_WHITE,string);
format(string,sizeof(string),"%s has challenged %s to a duel",pName,aName);
SendClientMessageToAll(COLOR_WHITE,string);
IsDueled[playerid] = 1;
SetPlayerPos(DUEL POS GOES HERE);
return 1;
}
CMD:accept(playerid,params[])
{
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName))
if(IsDueled[playerid] = 1)
{
SetPlayrPos(playerid,DUEL PLACE POS GOES HERE);
SendClientMessage(playerid,COLOR_WHITE,"You accepted the duel");
format(string,sizeof(string),"%s has accepted the duel",pName);
SendClientMessageToAll(COLOR_WHTIE,string);
}
else return SendClientMessage(playerid,COLOR_RED,"You have not been challenged to a duel");
return 1;
}
CMD:decline(playerid,params[])
{
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName))
if(IsDuel[playerid] = 1)
{
SendClientMessage(playerid,COLOR_WHITE,"You declined the the duel challenge.You're a chicken!.");
SetPlayerHealth(playerid,-50.0);
format(string,sizeof(string),"%s has declined the duel challenge",pName);
SendClientMessageToAll(COLOR_RED,string);
}
else return SendClientMessage(playerid,COLOR_RED,"You have not been challenged to a duel");
return 1;
}
Its a quick code i made , if you want to make this more advanced , do it your self.