case0:ShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{C0C0C0}Note: You can enter partially their names.","Select","Back");
case1:ShowPlayerDialog(playerid,DIALOG_DUEL_HEALTH,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Health","{FFFFFF}Enter the amount of health you will begin with:\n\n{C0C0C0}Note: The default health is 100.0.","Select","Back");
case2:ShowPlayerDialog(playerid,DIALOG_DUEL_ARMOUR,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Armour","{FFFFFF}Enter the amount of armour you will begin with:\n\n{C0C0C0}Note: The default armour is 100.0.","Select","Back");
case6:ShowPlayerDialog(playerid,DIALOG_DUEL_WAGER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Set A Wager","{FFFFFF}Please enter the wager for this duel:","Select","Back");
case7:
{
newtargetid=duelInfo[playerid][duelPlayer];
if(!IsPlayerConnected(targetid)){
SendError(playerid,"You haven't selected anyone to duel!");
ShowPlayerHelpDialog(targetid,10000,"%s wants to duel!~n~~n~~y~Location: ~w~%s~n~~y~Weapon: ~w~%s and %s~n~~y~Wager: ~w~%s",ReturnPlayerName(playerid),LocationInfo[duelInfo[playerid][duelLocation]][locationName],ReturnWeaponName(duelInfo[playerid][duelWeapon][0]),ReturnWeaponName(duelInfo[playerid][duelWeapon][1]),number_format(duelInfo[playerid][duelBet]));
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have sent a duel invitation to %s for "COL_GOLD"%s"COL_WHITE".",ReturnPlayerName(targetid),number_format(duelInfo[playerid][duelBet]));
SendClientMessageFormatted(targetid,-1,""COL_DUEL"[DUEL]{FFFFFF} You are invited to duel %s for "COL_GOLD"%s"COL_WHITE", use \"/duel accept %d\".",ReturnPlayerName(playerid),number_format(duelInfo[playerid][duelBet]),playerid);
}
}
return1;
}
elseif(dialogid==DIALOG_DUEL_PLAYER)
{
if(!response)
returnShowPlayerDuelMenu(playerid);
newtargetid;
if(sscanf(inputtext,"u",targetid))
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{C0C0C0}Note: You can enter partially their names.","Select","Back");
if(targetid==playerid)
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}You can't invite yourself to duel!","Select","Back");
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}Player is not connected!","Select","Back");
if(IsPlayerDueling(playerid))
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}You are already in a duel!","Select","Back");
if(IsPlayerDueling(targetid))
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}This player is already in a duel!","Select","Back");
if(GetPlayerWantedLevel(targetid))
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}You can't duel this person right now, they are wanted","Select","Back");
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}The player you wish to duel is not near you.","Select","Back");
if(IsPlayerJailed(targetid))
returnShowPlayerDialog(playerid,DIALOG_DUEL_PLAYER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Select a player","{FFFFFF}Please type the name of the player you wish to duel:\n\n{FF0000}You can't duel this person right now, they are currently in jail.","Select","Back");
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have selected {C0C0C0}%s {FFFFFF}as your opponent.",ReturnPlayerName(targetid));
duelInfo[playerid][duelPlayer]=targetid;
ShowPlayerDuelMenu(playerid);
return1;
}
elseif(dialogid==DIALOG_DUEL_LOCATION)
{
if(!response)
returnShowPlayerDuelMenu(playerid);
if(duelInfo[playerid][duelLocation]==listitem)
{
SendError(playerid,"You have already selected this location!");
returnShowPlayerDuelMenu(playerid);
}
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed the duel location to {C0C0C0}%s{FFFFFF}.",LocationInfo[listitem][locationName]);
SendError(playerid,"You have already selected this weapon!");
returnShowPlayerDuelMenu(playerid);
}
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed Primary Weapon to {C0C0C0}%s{FFFFFF}.",ReturnWeaponName(weaponList[listitem]));
SendError(playerid,"You have already selected this weapon!");
returnShowPlayerDuelMenu(playerid);
}
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed Secondary Weapon to {C0C0C0}%s{FFFFFF}.",ReturnWeaponName(weaponList[listitem]));
returnShowPlayerDialog(playerid,DIALOG_DUEL_HEALTH,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Health","{FFFFFF}Enter the amount of health you will begin with:\n\n{C0C0C0}Note: The default health is 100.0.","Select","Back");
if(!(1.0<=health<=100.0))
returnShowPlayerDialog(playerid,DIALOG_DUEL_HEALTH,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Health","{FFFFFF}Enter the amount of health you will begin with:\n\n{FF0000}The amount you have entered is a invalid amount, 1 to 100 only!","Select","Back");
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed Health to {C0C0C0}%0.2f%%{FFFFFF}.",health);
duelInfo[playerid][duelHealth]=health;
ShowPlayerDuelMenu(playerid);
return1;
}
elseif(dialogid==DIALOG_DUEL_ARMOUR)
{
if(!response)
returnShowPlayerDuelMenu(playerid);
newFloat:armour;
if(sscanf(inputtext,"f",armour))
returnShowPlayerDialog(playerid,DIALOG_DUEL_ARMOUR,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Armour","{FFFFFF}Enter the amount of armour you will begin with:\n\n{C0C0C0}Note: The default armour is 100.0.","Select","Back");
if(!(0.0<=armour<=100.0))
returnShowPlayerDialog(playerid,DIALOG_DUEL_ARMOUR,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Armour","{FFFFFF}Enter the amount of armour you will begin with:\n\n{FF0000}The amount you have entered is a invalid amount, 0 to 100 only!","Select","Back");
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed Armour to {C0C0C0}%0.2f%%{FFFFFF}.",armour);
returnSendError(playerid,"You cannot use this at the moment.");
if(!response)
returnShowPlayerDuelMenu(playerid);
newamount;
if(sscanf(inputtext,"d",amount))
returnShowPlayerDialog(playerid,DIALOG_DUEL_WAGER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Set A Wager","{FFFFFF}Please enter the wager for this duel:","Select","Back");
if(!(0<=amount<10000000))
returnShowPlayerDialog(playerid,DIALOG_DUEL_WAGER,DIALOG_STYLE_INPUT,"{FFFFFF}Duel Settings - Set A Wager","{FFFFFF}Please enter the wager for this duel:\n\n{FF0000}Wagers must be between $0 and $10,000,000.","Select","Back");
duelInfo[playerid][duelBet]=amount;
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have changed the wager to %s.",number_format(duelInfo[playerid][duelBet]));
returnSendError(playerid,"You must be within 25.0 meters of your opponent!");
newwaged_amount=duelInfo[targetid][duelBet];
if(duelInfo[targetid][duelBet]!=0)
{
if(GetPlayerCash(targetid)<waged_amount)
{
SendClientMessageFormatted(targetid,-1,""COL_DUEL"[DUEL]{FFFFFF} %s has accepted but you don't have money to wage (%s).",ReturnPlayerName(playerid),number_format(waged_amount));
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have accepted %s's duel invitation but they don't have money.",ReturnPlayerName(targetid));
return1;
}
elseif(GetPlayerCash(playerid)<waged_amount)
{
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} %s requires you to wage %s.",ReturnPlayerName(targetid),number_format(waged_amount));
SendClientMessageFormatted(targetid,-1,""COL_DUEL"[DUEL]{FFFFFF} %s has accepted the duel invitation but they don't have money to wage.",ReturnPlayerName(playerid));
return1;
}
else
{
GivePlayerCash(playerid,-waged_amount);
GivePlayerCash(targetid,-waged_amount);
}
}
SendClientMessageFormatted(targetid,-1,""COL_DUEL"[DUEL]{FFFFFF} %s has accepted your duel invitation.",ReturnPlayerName(playerid));
SendClientMessageFormatted(playerid,-1,""COL_DUEL"[DUEL]{FFFFFF} You have accepted %s's duel invitation.",ReturnPlayerName(targetid));
newwinning_prize=floatround(float(amount_waged)*1.95);// We take 2.5% of the total pot
GivePlayerCash(winnerid,winning_prize);
SendClientMessageToAllFormatted(-1,""COL_DUEL"[DUEL]{FFFFFF} %s(%d) has won the duel against %s(%d) for %s!",ReturnPlayerName(winnerid),winnerid,ReturnPlayerName(playerid),playerid,number_format(winning_prize));
}else{
SendClientMessageToAllFormatted(-1,""COL_DUEL"[DUEL]{FFFFFF} %s(%d) has won the duel against %s(%d)!",ReturnPlayerName(winnerid),winnerid,ReturnPlayerName(playerid),playerid);