Код:
CMD:duel(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /duel [playerid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(EventOn) return SendClientMessage(playerid, COLOR_GREY, "There's a event happening, you cant duel now.");
if(DuelOn) return SendClientMessage(playerid, COLOR_GREY, "There is already an duel happening.");
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
format(string, sizeof(string), "AdmWarn: %s has started an duel with %s.", RPN(playerid), RPN(playerb));
SendAdminMessage(COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_BLUE, "You are duelling..");
SendClientMessage(playerb, COLOR_BLUE, "You are duelling..");
GetPlayerPos(playerid, eX, eY, eZ);
GetPlayerHealth(playerid, eHP);
GetPlayerArmour(playerid, eARMOR);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerInfo[playerid][pWeapon][i], PlayerInfo[playerid][pWeaponAmmo][i]);
}
GunsBeingRemoved[playerid] = 1;
DuelOn = 1;
Duel[playerid] = 1;
Duel[playerb] = 1;
ResetPlayerWeapons(playerid);
/* break */
PlayerInfo[playerb][pInt] = GetPlayerInterior(playerb);
PlayerInfo[playerb][pVW] = GetPlayerVirtualWorld(playerb);
GetPlayerPos(playerb, eX, eY, eZ);
GetPlayerHealth(playerb, eHP);
GetPlayerArmour(playerb, eARMOR);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerb, i, PlayerInfo[playerb][pWeapon][i], PlayerInfo[playerb][pWeaponAmmo][i]);
}
GunsBeingRemoved[playerb] = 1;
ResetPlayerWeapons(playerb);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
GiveDodWeapon(playerid, 24, 200);
GiveDodWeapon(playerb, 24, 200);
TogglePlayerControllable(playerb, 0);
TogglePlayerControllable(playerid, 0);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerb, 100);
SetPlayerArmour(playerb, 100);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerb);
SetPlayerPos(playerb, -257.6650,-862.7711,1188.3394);
SetPlayerPos(playerid, -276.1044,-846.8372,1188.3394);
SetPlayerVirtualWorld(playerid, 50);
SetPlayerVirtualWorld(playerb, 50);
SetPlayerInterior(playerb, 3);
SetPlayerInterior(playerid, 3);
return 1;
}