31.01.2012, 14:35
Hello, is there any scripting function for random text or how to make a function that randomly selects one of these texts:
Streetrace1
Streetrace2
Streetrace3
Streetrace1
Streetrace2
Streetrace3
new randmsg = random(3)
switch(randmsg)
{
case 0: SendClientMessage(playerid, color, "Streetrace1");
case 1: SendClientMessage(playerid, color, "Streetrace2");
case 2: SendClientMessage(playerid, color, "Streetrace3");
}
// At The Top
new
RandomText[ ][ ] =
{
"Streetrace1",
"Streetrace2",
"Streetrace3"
}
// There you want to get it random
new
rand = random( sizeof( RandomText ) );
SendClientMessage( playerid, -1, RandomText[ rand ] );
forward SendMSG();//--
forward close();--//-- at top
new RandomMSG[][] =//--
{
"Streetrace1",
"Streetrace2",
"Streetrace3"
};//--
public SendMSG()
{
new randMSG = random(sizeof(RandomMSG));
SendClientMessageToAll(0x8739C6FF, RandomMSG[randMSG]);
return 1;
}
// past there were you wont
new srrm, rchoosen; new Float: srx1, Float: sry1, Float: srz1, Float: srx2, Float: sry2, Float: srz2; new RandomRace[][] = { "Streetrace1", "Streetrace2" }; new Float:Streetrace1[4][3] = { {2066.7275,852.1683,6.2950}, {2067.2214,977.6674,10.1318}, {2068.9685,1090.7994,10.2382}, {2069.7595,1187.7134,10.2384} }; new Float:Streetrace2[4][3] = { {2046.0261,1275.2041,10.2410}, {2046.0046,1184.4506,10.2371}, {2045.7842,1061.9788,10.2382}, {2045.3105,943.6448,9.4538} }; forward StartStreetrace(); public StartStreetrace() { srrm = random(sizeof(RandomRace)); rchoosen = RandomRace[srrm]; // line 8425 srx1 = rchoosen[0][0]; // line 8426 sry1 = rchoosen[0][1]; srz1 = rchoosen[0][2]; GameTextForAll("~w~Mission ~n~~b~Streetrace", 5000, 1); Streetraceactive = 1; for(new i = 0; i <= MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { SetPlayerRaceCheckpoint(i, 0, srx1, sry1, srz1, srx2, sry2, srz2, 8.0); } } return 1; }
construction.pwn(8425) : error 006: must be assigned to an array construction.pwn(8426) : error 028: invalid subscript (not an array or too many subscripts): "rchoosen" construction.pwn(8426) : warning 215: expression has no effect construction.pwn(8426) : error 001: expected token: ";", but found "]" construction.pwn(8426) : error 029: invalid expression, assumed zero construction.pwn(8426) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
srrm = random(sizeof(RandomRace));
new srrm = random(sizeof(RandomRace));
rchoosen = RandomRace[srrm]; // line 8425
srx1 = rchoosen[0][0]; // line 8426
sry1 = rchoosen[0][1];
srz1 = rchoosen[0][2];
RandomRace[srrm][0], RandomRace[srrm][1], RandomRace[srrm][2]