PHP Code:
#include <zcmd>
#include <sscanf2>
PHP Code:
CMD:duel(playerid, params[])
{
if(PlayerInDuel[playerid] == 1) return SendClientMessage(playerid, -1, "You are already in a duel");
if(DuelPlaceVisit) return SendClientMessage(playerid, -1, "Wait until the duel becomes free.");
new giveplayerid, WeaponDuel, MoneyDuel;
if(sscanf(params, "idd", giveplayerid, WeaponDuel, MoneyDuel)) return SendClientMessage(playerid, -1, "Usage: /duel [player id] [weapon id] [stake]");
if(WeaponDuel < 0 || WeaponDuel > 42) return SendClientMessage(playerid, -1, "You entered the wrong weapon id. Use id from 0 to 42");
if(MoneyDuel < 100 || MoneyDuel > 100000) return SendClientMessage(playerid, -1, "You entered the wrong bet amount. Use an amount from $ 1 to $ 100,000");
if(MoneyDuel > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "You are missing a bet. Specify a different amount");
if(MoneyDuel > GetPlayerMoney(giveplayerid)) return SendClientMessage(playerid, -1, "Your opponent is missing a bet. Specify a different amount!");
if(IsPlayerConnected(giveplayerid))
{
if(playerid == giveplayerid) return SendClientMessage(playerid, -1, "You cannot apply this action to yourself.");
if(PlayerInDuel[giveplayerid] == 1) return SendClientMessage(playerid, -1, "This player is already in a duel..");
new string[256];
GetDuelCreate[giveplayerid] = playerid;
format(string, sizeof(string), "You have successfully invited player {9DDAF2}%s {FFFFFF} to a duel! Wait for an answer", pNick(giveplayerid));
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{ff0000}You Have Challenged %s To A 1v1 Duel!\nInfo Duel Weapon(id): %d Bet: $%d !", pNick(playerid), WeaponDuel, MoneyDuel);
ShowPlayerDialog(giveplayerid, DUEL_ID, DIALOG_STYLE_MSGBOX, "{ff0000}[xEF]DUEL", string, "Accept", "Decline");
}
else
{
SendClientMessage(playerid, -1, "The player with the ID you specified was not found");
}
return 1;
}
This should work.
Although I would use I-ZCMD: https://github.com/YashasSamaga/I-ZCMD