simple cmd to dcmd, help
#7

Quote:
Originally Posted by Mean
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(duel,4,cmdtext);
    return 0;
}

dcmd_duel(playerid, params[])
{
    new id,tmp[3][80],w1,w2,string[128];
    new Index;
    tmp[0] = strtok(params, Index);
    tmp[1] = strtok(params, Index);
    tmp[2] = strtok(params, Index);
       
    id = strval(tmp[0]);
    w1 = strval(tmp[1]);
    w2 = strval(tmp[2]);
       
    if(InvitedDuel[playerid] == true)
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : Have you invited someone, wait Expire Invitation");

    if(UsingArena == true)
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : At the time the Arena is Being Used");

    if(!IsValidWeapon(w1) || !IsValidWeapon(w2))
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : Use Valids Weapons IDs");
           
    if(!strlen(tmp[1]) || !strlen(tmp[2]))
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : Use /duel [id] [wep1] [wep2]");
           
    if(!strlen(tmp[0]))
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : You must enter the ID of the player following the Way (/duel [playerid])");

    if(id == playerid)
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : You can not invite the Self");

    if(InvitedDuel[id] == true)
        return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : Currently the player is in a Duel, wait..");
           
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "»»[DUEL]«« : %s This inviting you to a \n Duel Runing (Press Accept to Accept Duel)",name);
    ShowPlayerDialog(id,DIALOG_DUEL,DIALOG_STYLE_MSGBOX,"»»[DUEL]«« :",string,"Accept", "No");
    GameTextForPlayer(id,"~r~DUE~w~LO !", 2500, 3);
    IdDuel[id] = playerid;
    wep1[id] = w1;
    wep2[id] = w2;
    SetTimerEx("ExpireDuel",15000,false,"ii",id,playerid);
    return true;
}
EDIT: Better use ZCMD for better speeds
Using DCMD or ZCMD woudn't make any sence when you're still using strtok.
Reply


Messages In This Thread
simple cmd to dcmd, help - by jaksimaksi - 26.01.2011, 11:32
Re: simple cmd to dcmd, help - by Mean - 26.01.2011, 12:16
Re: simple cmd to dcmd, help - by jaksimaksi - 26.01.2011, 12:23
Re: simple cmd to dcmd, help - by jaksimaksi - 26.01.2011, 13:15
Re: simple cmd to dcmd, help - by Mean - 26.01.2011, 13:52
Re: simple cmd to dcmd, help - by jaksimaksi - 26.01.2011, 14:38
Re: simple cmd to dcmd, help - by DVDK - 26.01.2011, 14:58

Forum Jump:


Users browsing this thread: 2 Guest(s)