/duel command help
#1

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
Reply
#2

Using sscanf, and Variables.
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)