pawn Код:
Put this on top of your script
new duelinvite[playerid] = 999;
new duelid[playerid] = 999;
new duelweaponid[playerid] = 999;
new duelweaponammo[playerid] = 0;
under OnPlayerConnect
duelweaponid[playerid] = 999;
duelweaponammo = 0;
duelid[playerid] = 999;
duelinvite[playerid] = 999;
CMD:duel(playerid, params[])
{
new targetid;
new weaponid;
new ammo;
new string[300];
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is Not Connected!");
if(sscanf(params, "uii", targetid, weaponid, ammo)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /duel [playerid] [weaponid] [amount]");
format(string, sizeof(string), "[DUEL]: %s Want a Duel With You. Type /accept, To Start The Duel.", GetName(playerid));
SendClientMessage(targetid, COLOR_LIGHTRED, string);
duelinvite[playerid] = 1;
duelid[playerid] = targetid;
duelweaponid[playerid] = weaponid;
duelweaponammo[playerid] = ammo;
return 1;
}
CMD:accept(playerid, params[])
{
if(duelinvited[playerid] < 999)
{
if(IsPlayerConnected(duelinvite[playerid]))
{
SetPlayerPos(playerid, -1401.9368,1266.0421,1039.8672);
SetPlayerPos(duelid[playerid], -1397.5286,1225.9540,1039.8741);
ResetPlayerWeapons(duelid[playerid]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, duelweaponid, duelweaponammo);
GivePlayerWeapon(duelid[playerid], duelweaponid, duelweaponammo);
GameTextForPlayer(duelid[playerid], "~b~GO GO GO!",3000,3);
GameTextForPlayer(playerid, "~b~GO GO GO!",3000,3);
duelinvite[playerid] = 999;
duelid[playerid] = 999;
duelweaponid[playerid] = 999
duelweaponammo[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " The player invited you a duel has disconnected!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nobody Offered you a duel");
}
return 1;
}