Command doesn't read the parameters correctly [+REP] -
Amit1998 - 28.02.2016
Hi guys,
I'm trying to make a command work, but it seems like the parameters are not synced when using the command or whatsoever.
Basically, when using the command /startlottery, an admin is required to enter the following parameters by order: Minimum, Maximum, WinningTicket, Fee, Prize. If one of these or more wasn't typed in, it should print out to the admin on chat the following string:
[Minimum] [Maximum] [WinningTicket] [EntryFee] [Prize], SS:
However, when the commend is used properly(when all parameters were inputted correctly), the command fail to operate(It doesn't actually work and start a lottery), it re-prints the same syntax msg, SS:
![](http://i.imgur.com/NgmvCQw.png)
:
Here's the script of the Stack and the Command of the lottery creation, I hope you'll notice what's wrong in the script that makes it happen:
http://pastebin.com/wTYrLJdS
P.S Here's the SCP stack:
PHP код:
stock SCP(_id, _param[], _command[] = "")
{
format(iStr, sizeof(iStr), "{6a696a}[Command]: /%s {9c9a9c}%s", _command, _param);
return SendMessageToPlayer(_id, COLOR_LIGHTGREY, iStr, 128);
}
I'll +REP the helpers, THANKS! <:
Re: Command doesn't read the parameters correctly [+REP] -
xEF - 04.03.2016
On the stock you added param[], but it means 1 parametre, and not more than one.
Your command has more params, and the stock can handle just one.
As i understood the command doesnt work while tipying params, so that's all to say for me.
If i didn't understand or you think something else just reply.
Regards.
Re: Command doesn't read the parameters correctly [+REP] -
MicroKyrr - 04.03.2016
Re: Command doesn't read the parameters correctly [+REP] -
Virtual1ty - 04.03.2016
This feels about right to me:
PHP код:
COMMAND:startlottery(playerid, params[])
{
if(GetAdminLevel(playerid) < 10)
return SendClientError(playerid, CANT_USE_CMD);
new
range_min,
range_max,
lot_number,
lot_fee,
lot_prize[64 + 1];
if(sscanf(params, "dddds[65]", range_min, range_max, lot_number, lot_fee, lot_prize)) return SCP(playerid, "[Minimum] [Maximum] [WinningTicket] [Fee] [Prize(64 characters)]");
if(range_min > range_max)
return SendClientError(playerid, "Minimum range can't be higher than maximum range!");
if(range_min > lot_number || lot_number > range_max)
return SendClientError(playerid, "Lottery number can't be higher or lower than minimum or maximum range.");
if(!StartLottery(range_min, range_max, lot_number, lot_fee, lot_prize))
return SendClientError(playerid, "There is already an ongoing lottery!");
return 1;
}
If you still have the same problem, I honestly don't know what you're doing wrong.
Re: Command doesn't read the parameters correctly [+REP] -
Amit1998 - 04.03.2016
forgot to mention I've already fixed it by my own, ty anyways :*