Command doesn't read the parameters correctly [+REP]
#1

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! <:
Reply
#2

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

PHP код:
_params
Reply
#4

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

forgot to mention I've already fixed it by my own, ty anyways :*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)