How to check for a certain random choice
#1

Hello,

As my topic title says: how to check for a certain random choice? I shall give an example:

pawn Код:
new EngineRandom[][] =
{
    {"* Engine started.", 1 },
    {"* Engine start failed.", 0 }
};
For example, I want to check if the engine is failed. How can I request that with if(engineresult == blabla) { ??

I'm sure one of you know!

Regards, Jochem
Reply
#2

pawn Код:
new rand = random(sizeof(EngineRandom));
//do something with it, e.g. EngineRandom[rand]
if(rand == 0)
// do stuff
Reply
#3

pawn Код:
new EngineRandom[2][30] =
{
    { 1 ,"* Engine started."},
    { 0,"* Engine start failed." }
};
make for example
pawn Код:
new rand = random(sizeof(EngineRandom));

SendCientMessage(playerid,COLOR_YOURS,EngineRandom[rand][1]);
EngineOn[vehicleid] = EngineRandom[rand][0];
Reply
#4

pawn Код:
switch(random(2))
{
    case 0: // Engine started
    case 1: // Engine start failed
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)