21.08.2018, 19:53
PHP код:
[22:46:40] sscanf warning: Strings without a length are deprecated, please add a destination size.
[22:46:40] sscanf warning: Strings without a length are deprecated, please add a destination size.
[22:46:51] sscanf warning: Strings without a length are deprecated, please add a destination size.
[22:46:51] sscanf warning: Strings without a length are deprecated, please add a destination size.
[22:46:51] sscanf warning: String buffer overflow.
PHP код:
CMD:duel(playerid, params[])
{
new invitedid, Weapon1[50], Weapon2[50], iString[180];
if(sscanf(params, "iss", invitedid, Weapon1, Weapon2)) return SendClientMessage(playerid,-1, "{ff8080}Syntax: /duel (nickname) (weapon 1) (weapon 2)");
if(!IsPlayerConnected(invitedid)) return 1;
if(Player[invitedid][challengerid] == playerid) return SendClientMessage(playerid,-1, "{ff8080}(duel) You are already awaiting a duel"); //duelspamfix
if(invitedid == playerid) return 1;
if(Player[invitedid][InDuel] == true) return SendClientMessage(playerid,-1, "{ff8080}(duel) That player is already dueling someone.");
if(Player[playerid][InDuel] == true) return SendClientMessage(playerid,-1, "{ff8080}(duel) You are already dueling someone.");
new WeaponID1 = GetWeaponID(Weapon1);
if(WeaponID1 < 1 || WeaponID1 > 46 || WeaponID1 == 19 || WeaponID1 == 20 || WeaponID1 == 21) return SendClientMessage(playerid,-1, "Invalid Weapon Name.");
if(WeaponID1 == 40 || WeaponID1 == 43 || WeaponID1 == 44 || WeaponID1 == 45) return SendClientMessage(playerid,-1, "That weapon is not allowed in duels.");
new WeaponID2 = GetWeaponID(Weapon2);
if(WeaponID2 < 1 || WeaponID2 > 46 || WeaponID2 == 19 || WeaponID2 == 20 || WeaponID2 == 21) return SendClientMessage(playerid,-1, "Invalid Weapon Name.");
if(WeaponID2 == 40 || WeaponID2 == 43 || WeaponID2 == 44 || WeaponID2 == 45) return SendClientMessage(playerid,-1, "That weapon is not allowed in duels.");
Player[invitedid][challengerid] = playerid;
Player[invitedid][duelweap1] = WeaponID1;
Player[invitedid][duelweap2] = WeaponID2;
format(iString, sizeof(iString), "{ff8080}(duel) Your duel request was sent to %s with '%s' and '%s'", PlayerName[invitedid], WeaponNames[WeaponID1], WeaponNames[WeaponID2]);
SendClientMessage(playerid, -1, iString);
format(iString, sizeof(iString), "{ff8080}(duel) %s wants a duel with you - weapons: '%s' and '%s'", PlayerName[playerid], WeaponNames[WeaponID1], WeaponNames[WeaponID2]);
SendClientMessage(invitedid, -1, iString);
SendClientMessage(invitedid, -1, "{ff8080}(duel) Use /accept to stat the duel, or /decline (costs: 10 exp - reward 20 exp!)");
PlayerPlaySound(invitedid,1137,0.0,0.0,0.0);
return 1;
}