SA-MP Forums Archive
Random - 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: Random (/showthread.php?tid=247151)



Random - Unknown123 - 08.04.2011

I just want to change the TextDraw string to random... Cargo or Passengers
but i will get erros... because the

pawn Код:
case 0: "Passengers"
Any ideas on how i can do it? :i

pawn Код:
COMMAND:job(playerid, params[])
{
    new string[128];
    new rand1 = random(4);
    switch(rand1)
    {
        case 0: "Passengers"
        case 1: "Cargo"
        case 3: "Passengers"
        case 4: "Cargo"
    }
    TextDrawShowForPlayer(playerid, TruckerInfo[playerid]);
    format(string, sizeof(string), "Transport need to transport %s", rand1);
    TextDrawSetString(TruckerInfo[playerid] ,string);
    return 1;
}



Re: Random - [L3th4l] - 08.04.2011

pawn Код:
COMMAND:job(playerid, params[])
{
    new
        iStr[60],
        iRandMsg[15];

    switch(random(4))
    {
        case 0: iRandMsg = "Passengers";
        case 1: iRandMsg = "Cargo";
        case 2: iRandMsg = "Passengers";
        case 3: iRandMsg = "Cargo";
    }

    TextDrawShowForPlayer(playerid, TruckerInfo[playerid]);
    format(iStr, sizeof(iStr), "Transport need to transport %s", iRandMsg);
    TextDrawSetString(TruckerInfo[playerid], iStr);
    return 1;
}