26.01.2011, 13:52
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(duel,4,cmdtext);
return 0;
}
dcmd_duel(playerid, params[])
{
new id,w1,w2,string[128];
new Index;
new tmp[256], tmp2[256], tmp3[256];
tmp = strtok(params, Index);
tmp2 = strtok(params, Index);
tmp3 = strtok(params, Index);
id = strval(tmp);
w1 = strval(tmp2);
w2 = strval(tmp3);
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(tmp2) || !strlen(tmp3))
return SendClientMessage(playerid,0xF41917AA,"»»[DUEL]«« : Use /duel [id] [wep1] [wep2]");
if(!strlen(tmp))
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;
}