SA-MP Forums Archive
Command doesn't read the parameters correctly [+REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command doesn't read the parameters correctly [+REP] (/showthread.php?tid=601937)



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:
:

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(iStrsizeof(iStr), "{6a696a}[Command]: /%s {9c9a9c}%s"_command_param);
    return 
SendMessageToPlayer(_idCOLOR_LIGHTGREYiStr128);

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

PHP код:
_params



Re: Command doesn't read the parameters correctly [+REP] - Virtual1ty - 04.03.2016

This feels about right to me:
PHP код:
COMMAND:startlottery(playeridparams[])
{
    if(
GetAdminLevel(playerid) < 10)
        return 
SendClientError(playeridCANT_USE_CMD);
    new
        
range_min,
        
range_max,
        
lot_number,
        
lot_fee,
        
lot_prize[64 1];
    if(
sscanf(params"dddds[65]"range_minrange_maxlot_numberlot_feelot_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_minrange_maxlot_numberlot_feelot_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 :*