Strange thing.
#1

pawn Код:
CMD:signcheck(playerid, params[])
{
  if(!strlen(params[11]))
  {
    SendClientMessage(playerid, 0xFF0000AA, "{FFFFFF}Use: /signcheck [checknumber]");
    return 1;
  }
  new number = strval(params[11]);
  if(number == CheckNumber[playerid])
  {
    SendClientMessage(playerid, 0x00FF00AA, "{FFFFFF}You received your money!");
    GivePlayerMoney(playerid, -111);
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000AA, "{FF3300}Wrong checknumber!");
  }
  return 1;
}
When I have the number, it comes up with this:

Use: /signcheck [checknumber]

Instead of the actual thing, any ideas?
Reply
#2

why do you use params[11] ?
Delete the "11"
Reply
#3

zcmd or ycmd don't work the way that strtok and strcmp do in OnPlayerCommandText. The command is removed from 'params', so 'params' only contains what was typed after the command. Also, you need to do an isnull check, not an strlen check.

pawn Код:
CMD:signcheck(playerid, params[]) {
    if(isnull(params))
        return SendClientMessage(playerid, 0xFF0000AA, "{FFFFFF}Use: /signcheck [checknumber]");

    new
        iNumber = strval(params);

    if(iNumber == CheckNumber[playerid]) {
        SendClientMessage(playerid, 0x00FF00AA, "{FFFFFF}You received your money!");
        GivePlayerMoney(playerid, -111);
    }
    else return SendClientMessage(playerid, 0xFF0000AA, "{FF3300}Wrong checknumber!");
   
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)