SA-MP Forums Archive
Problem with random massage - 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)
+--- Thread: Problem with random massage (/showthread.php?tid=311360)



Problem with random massage - N0FeaR - 16.01.2012

Here the problem i get

Код:
C:\Users\Robin\Desktop\New folder\pawno\include\/CRP/Publics/RandomMessages.pwn(4) : error 028: invalid subscript (not an array or too many subscripts): "RandomMessages"
C:\Users\Robin\Desktop\New folder\pawno\include\/CRP/Publics/RandomMessages.pwn(4) : error 072: "sizeof" operator is invalid on "function" symbols
C:\Users\Robin\Desktop\New folder\pawno\include\/CRP/Publics/RandomMessages.pwn(4) : error 029: invalid expression, assumed zero
C:\Users\Robin\Desktop\New folder\pawno\include\/CRP/Publics/RandomMessages.pwn(4) : fatal error 107: too many error messages on one line
this are line 4
Код:
SendClientMessageToAll(COLOR_GROVE, RandomMessages[random(sizeof(RandomMessages))]);



Re: Problem with random massage - henry jiggy - 16.01.2012

new RandomInt = Random(sizeof(RandomMessages));
SendClientMessageToAll(COLOR_GROVE, RandomMessages[Random]);

try this.


Re: Problem with random massage - [ABK]Antonio - 16.01.2012

pawn Код:
new RandMessages[][] = {
    "WHAT",
    "WE",
    "WANT"
};
new RandTimer;
forward RandomMessages();
under gamemodeinit
pawn Код:
RandTimer = SetTimer("RandomMessages", 300000, true);
pawn Код:
public RandomMessages()
{
    new Rand = random(sizeof(RandMessages));
    SendClientMessageToAll(MYCOLOR, RandMessages[Rand]);
}