sscanf parameter problem
#1

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;
}
I got problem with parameters. Basically I need it to work like I can enter 1 weapon or 2 or 3 so it wont ask me to put 3 weapons.

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.
Reply


Messages In This Thread
sscanf parameter problem - by Cypress - 11.07.2012, 08:30
Re: sscanf parameter problem - by MP2 - 11.07.2012, 08:34
Re: sscanf parameter problem - by Cypress - 11.07.2012, 15:39
Re: sscanf parameter problem - by MP2 - 11.07.2012, 15:41
Re: sscanf parameter problem - by Cypress - 11.07.2012, 15:46
Re: sscanf parameter problem - by MP2 - 11.07.2012, 15:49
Re: sscanf parameter problem - by Cypress - 11.07.2012, 15:57
Re: sscanf parameter problem - by Cypress - 11.07.2012, 17:09
Re: sscanf parameter problem - by Cypress - 21.07.2015, 12:05

Forum Jump:


Users browsing this thread: 1 Guest(s)