11.07.2012, 08:30
pawn Код:
CMD:duel(playerid, params[])
{
if(!strval(params)) return SendClientMessage(playerid, -1, "USAGE: /duel <id> <bet> <weap1> <weap2> <weap3>");
new third[60];
sscanf(params[5], "s[60]", third);
new Player, Bet, gWeap1[85], gWeap2[85], gWeap3[85], slot[3], Float:HealthP, Float:HealthG, string[128];
sscanf(third, "uis[85]s[85]s[85]", Player, Bet, gWeap1, gWeap2, gWeap3);
if(Player == playerid) return SendClientMessage(playerid, -1, "You cannot duel with yourself.");
if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player not found.");
GetPlayerHealth(playerid, HealthP);
GetPlayerHealth(Player, HealthG);
if(HealthP < 100) return SendClientMessage(playerid, -1, "You need full health to fight a duel.");
if(HealthG < 100) return SendClientMessage(playerid, -1, "You can only duel players with full health.");
if(IsPlayerInAnyInterior(playerid)) return SendClientMessage(playerid, -1, "You must leave this interior first.");
if(IsPlayerInAnyInterior(Player)) return SendClientMessage(playerid, -1, "Player is inside an interior.");
if(!pData[Player][P_SPAWNED]) return SendClientMessage(playerid, -1, "Player has not spawned yet.");
if(pData[playerid][P_ONLINE] < 3600)return SendClientMessage(playerid, -1, "New users can't fight duels.");
if(pData[Player][P_ONLINE] < 3600) return SendClientMessage(playerid, -1, "New users can't fight duels.");
if(pData[playerid][P_INVITED]) return SendClientMessage(playerid, -1, "You are already invited to a duel. Type /yes to accept the request.");
if(pData[Player][P_INVITED]) return SendClientMessage(playerid, -1, "This player already received a duel request from another player.");
if(pData[playerid][P_IN_DUEL]) return SendClientMessage(playerid, -1, "You are already in a duel.");
if(pData[Player][P_IN_DUEL]) return SendClientMessage(playerid, -1,"This player is already fighting a duel.");
if(Bet < 1 || Bet > 5000) return SendClientMessage(playerid, -1, "Invalid bet amount (min $1 / max $5000).");
if(GetPlayerMoney(playerid) < Bet) return SendClientMessage(playerid, -1, "You don't have that amount of money to bet.");
if(GetPlayerMoney(Player) < Bet) return SendClientMessage(playerid, -1, "This player has not enough money to bet.");
return 1;
}
It's messy and doesnt work, when I type /duel it sends me the right message, when I type /duel 1 it says invalid money amount etc. It should still give me the return or the usage but it doesnt work properly.