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



Random Object - Cameltoe - 31.08.2010

pawn Код:
new Objects[][3] = {
    {1},
    {2},
    {3}
};

new RandObject = random(sizeof(Objects));
CreateObject(Objects[RandObject], player[playerid][x], player[playerid][y], player[playerid][z], 0, 0, 0, 300);
But this gives me Argument match error, ive tried to use strval but no help there.. Could anyone tell me why this occurs?


Re: Random Object - willsuckformoney - 31.08.2010

well i know what it is i think.

1. new Objects - maybe need Float:Objects ??
2. no objectmodel in there D:
3. no real positions


Re: Random Object - Cameltoe - 31.08.2010

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
well i know what it is i think.

1. new Objects - maybe need Float:Objects ??
2. no objectmodel in there D:
3. no real positions
1. Why should it be float? Modelid is an int.
2. It's the same what model number i put in there.. it should compile what so ever.
3. Read the structure.. it weren't supposed to have real positions in it either.


Re: Random Object - Cameltoe - 31.08.2010

Bump - The message you have entered is too short. Please lengthen your message to at least 8 characters.


Re: Random Object - Mauzen - 31.08.2010

new Objects[][3] = {
{1},............../\
{2},..............|
{3}
};

You have a 3 here, that means you also have to give 3 values in each {}.
Just remove it, you do not need a 2D array for this.

new Objects[] = {
1,
2,
3
};


Re: Random Object - Cameltoe - 31.08.2010

Line 11: error 008: must be a constant expression; assumed zero

Lines:

new Objects[] = { // 10
{1}, // 11
{2}, // 12
{3} // 13
};


Re: Random Object - Mike Garber - 31.08.2010

new Objects[3] = {


Re: Random Object - Cameltoe - 31.08.2010

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
new Objects[3] = {
Tried that already =/


Re: Random Object - Mauzen - 31.08.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
new Objects[][3] = {
(...)

new Objects[] = {
1,
2,
3
};
remove the brackets {} for the single entries like in my post


Re: Random Object - Cameltoe - 31.08.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
remove the brackets {} for the single entries like in my post
Nice !! thanks a lot