Random number.
#1

It's ok to create a random item between 1276,1550,1210 and 1247?

Код:
new RandomT = random(4);
	switch(RandomT)
	{
		case 0:
		{
		    return 1276;
		}
		case 1:
		{
		    return 1550;
		}
		case 2:
		{
		    return 1210;
		}
		case 3:
		{
		    return 2710;
		}
		case 4:
		{
		    return 1247;
		}
	}
	ObiectTreasure = CreatePickup(RandomT, 21, gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]);
Reply
#2

You could do like this:
PHP код:

static const randobj[] =
{
    
12761550121012701247
};
ObiectTreasure CreateObject(random(sizeof(randobj)), //rest code 
Reply
#3

Quote:
Originally Posted by Lokii
Посмотреть сообщение
You could do like this:
PHP код:

[CODE]static const randobj[] =
{
    
12761550121012701247
}; //<< ------- HERE IS 15062 
ObiectTreasure CreateObject(random(sizeof(randobj)), // <<--- HERE IS 15064
[/CODE
Код:
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15064) : warning 202: number of arguments does not match definition
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15064) : warning 202: number of arguments does not match definition
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15064) : warning 202: number of arguments does not match definition
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15064) : warning 202: number of arguments does not match definition
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15064) : error 001: expected token: ",", but found ";"
C:\Program Files (x86)\Server_Samp\Gamemode-uri\Pear\gamemodes\Pear.pwn(15062) : warning 203: symbol is never used: "RandomT"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Not work
Reply
#4

PHP код:
ObiectTreasure CreatePickup(random(sizeof(randobj)), 21gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]); 
Reply
#5

Quote:
Originally Posted by Lokii
Посмотреть сообщение
PHP код:
ObiectTreasure CreatePickup(random(sizeof(randobj)), 21gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]); 
symbol is never used "RandomT"

Код:
static const RandomT[] =
	{
    	1276, 1550, 1210, 1270, 1247
	};

	ObiectTreasure = CreatePickup(random(sizeof(RandomT)), 21, gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]);
Reply
#6

ohh sorry my bad

PHP код:
ObiectTreasure CreatePickup(RandomT[random(sizeof(RandomT))], 21gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]); 
Reply
#7

Quote:
Originally Posted by Lokii
Посмотреть сообщение
ohh sorry my bad

PHP код:
ObiectTreasure CreatePickup(RandomT[random(sizeof(RandomT))], 21gRandomPositions[rand][0], gRandomPositions[rand][1], gRandomPositions[rand][2]); 
Thanks! +1
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)