Bet command
#1

Hi there, im working on my bet command.
This is what I got so far:

pawn Код:
if(strcmp("/bet", cmdtext, true) == 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bet [amount] [color (red or black)]");
    return 1;
    }
    new rand = random(2);
    new amount;
    amount = strval(tmp);
    if(rand >= 0)
    if(strcmp(tmp, "red", true) == 0)
    {
    GivePlayerMoney(playerid, amount);
    format(string, sizeof(string), "RED WINS: You win %d dollars !",amount);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
    }
    else if(strcmp(tmp, "black", true) == 0)
    {
    GivePlayerMoney(playerid, -amount);
    format(string, sizeof(string), "BLACK WINS: You lose %d dollars !",amount);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
    }
    if(rand >=1)
    if(strcmp(tmp, "black", true) == 0)
    {
    GivePlayerMoney(playerid, amount);
    format(string, sizeof(string), "BLACK WINS: You win %d dollars !",amount);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
    }
    else if(strcmp(tmp, "red", true) == 0)
    {
    GivePlayerMoney(playerid, -amount);
    format(string, sizeof(string), "RED WINS: You lose %d dollars !",amount);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
    }
}
It compiles fine, but the problem is, when I type for example /bet 1000 red ingame, it gives me UNKNOWN command, anyone out there who knows the solution?

thx in advance
Reply


Messages In This Thread
Bet command - by Viktor_Burns - 07.07.2009, 14:33
Re: Bet command - by yom - 07.07.2009, 15:30
Re: Bet command - by Viktor_Burns - 07.07.2009, 15:44
Re: Bet command - by refshal - 07.07.2009, 15:45
Re: Bet command - by Viktor_Burns - 07.07.2009, 17:40
Re: Bet command - by refshal - 07.07.2009, 17:53
Re: Bet command - by Viktor_Burns - 07.07.2009, 18:06
Re: Bet command - by yom - 07.07.2009, 18:15
Re: Bet command - by Viktor_Burns - 07.07.2009, 18:49
Re: Bet command - by Jefff - 07.07.2009, 20:12

Forum Jump:


Users browsing this thread: 2 Guest(s)