2021-03-13, 06:12 PM
I have tried to change to zcmd and there is no command, they help me to convert it to zcmd only
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256], cmd[256], tmp[256], giveplayerid, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/duel", true) == 0)
{
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.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "duel [player id] [weapon id] [stake]");
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Usage: / duel [player id] [weapon id] [stake]");
WeaponDuel = strval(tmp);
if(WeaponDuel < 0 || WeaponDuel > 42) return SendClientMessage(playerid, -1, "You entered the wrong weapon id. Use id from 0 to 42");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Usage: / duel [player id] [weapon id] [stake]");
MoneyDuel = strval(tmp);
if(MoneyDuel < 100 || MoneyDuel > 1000) 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..");
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;
}
return 0;
}