[HELP] Lucky or not? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Lucky or not? (
/showthread.php?tid=215232)
[HELP] Lucky or not? - Larsey123IsMe - 23.01.2011
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
Re: [HELP] Lucky or not? -
Not available - 23.01.2011
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;
}
}
Re: [HELP] Lucky or not? -
iMonk3y - 23.01.2011
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: