SA-MP Forums Archive
50% variable - 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: 50% variable (/showthread.php?tid=248331)



50% variable - Seven_of_Nine - 13.04.2011

Hey all

How do I make a variable 50% percent to be true(or 1)?

Thx


Re: 50% variable - iJumbo - 13.04.2011

um? can you explain more please?


Re: 50% variable - Seven_of_Nine - 13.04.2011

pawn Код:
if(var1 == 1) {
SendClientMessage(playerid,red,"TROLL");
} else {
SendClientMessage(playerid,red,"NOT TROLL");
}
So I want var1 to be randomly 1 or 0 :]


Re: 50% variable - Kyle - 13.04.2011

Код:
new VaribleHere = -1;

OnGamemodeInit

new rand = random(100);

if(rand <= 50) { VaribleHere = 1; } // True
else { VaribleHere = 0 } //False



Re: 50% variable - Alby Fire - 13.04.2011

Explained like this has no sense, but...
pawn Код:
#define TRUE 2
#define MIDDLE 1
#define FALSE 0
new
    variable;
Set variable to '2' if you want it to true, set it to '1' if you want it to 50% and set it to '0' if you want it false...


Re: 50% variable - sciman001 - 13.04.2011

pawn Код:
switch(random(2))
    {
        case 0: SendClientMessage(playerid,red,"TROLL");
        case 1: SendClientMessage(playerid,red,"NOT TROLL");
    }
something like that?