• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Command convert zcmd
#2
PHP Code:
#include <zcmd>
#include <sscanf2> 

PHP Code:
CMD:duel(playeridparams[])
{
    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 
giveplayeridWeaponDuelMoneyDuel;
    if(
sscanf(params"idd"giveplayeridWeaponDuelMoneyDuel)) return SendClientMessage(playerid, -1"Usage: /duel [player id] [weapon id] [stake]");
    if(
WeaponDuel || 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(stringsizeof(string), "You have successfully invited player {9DDAF2}%s {FFFFFF} to a duel! Wait for an answer"pNick(giveplayerid));
        
SendClientMessage(playerid, -1string);
        
format(stringsizeof(string), "{ff0000}You Have Challenged %s To A 1v1 Duel!\nInfo Duel Weapon(id): %d Bet: $%d !"pNick(playerid), WeaponDuelMoneyDuel);
        
ShowPlayerDialog(giveplayeridDUEL_IDDIALOG_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
  Reply


Messages In This Thread
Command convert zcmd - by nbx2000 - 2021-03-13, 06:12 PM
RE: Command convert zcmd - by DandoRYx - 2021-03-13, 09:21 PM

Forum Jump: