[HELP] Lucky or not?
#1

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You're lucky.)
        GivePlayerMoney(playerid, 10000);
        return 1;
    }
}
How to make an unlucky too...
When he type "/test" the he get "Lucky" or "Unlucky"
like an random thingy...

i mean like an rob bank command =/
/robbank = You robbed $999999 from the bank, Enjoy!!!
or if unlucky
/robbank = You failed to rob the bank, please try again later
Reply
#2

This has a 50% chance of failing.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/test", cmdtext, true))
    {
        new lucky = random(1);
        if(lucky == 1)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You're lucky.")
            GivePlayerMoney(playerid, 10000);
            return 1;
        }
        SendClientMessage(playerid, 0xFF0000FF, "You're unlucky.")
        return 1;
    }
}
Reply
#3

Quote:
Originally Posted by Not available
Посмотреть сообщение
This has a 50% chance of failing.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/test", cmdtext, true))
    {
        new lucky = random(1);
        if(lucky == 1)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You're lucky.")
            GivePlayerMoney(playerid, 10000);
            return 1;
        }
        SendClientMessage(playerid, 0xFF0000FF, "You're unlucky.")
        return 1;
    }
}
Well acutally it has 100% chance of failing, this is correct:

pawn Код:
new lucky = random(2);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)