SA-MP Forums Archive
How to make this kind of function? - 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: How to make this kind of function? (/showthread.php?tid=142897)



How to make this kind of function? - 0ne - 20.04.2010

I got
Код:
new rand_proc = {
	{random(4)+30},
	{random(12)+30}
	};
could anyone tell me how to do this function to make the first line give from 4 to 30 points and second from 12 to 30points without any errors? because i get some errors and i don't know really how to form this one..


Re: How to make this kind of function? - 0ne - 21.04.2010

'Nyone?..


Re: How to make this kind of function? - boelie - 21.04.2010

I don understand, but what should the function do ?


Re: How to make this kind of function? - 0ne - 21.04.2010

Umh ok, look right now i got a function like this:
Код:
new random_points[][3] = {
	{5,13,30}
and i want a function like :

Код:
new rand_proc = {
	{random(4)+30},
the point of this is that the random_points gives only 5,13,30 points and i want to make that it would give 4,5,6,7,8,9,10,11... and so on to 30, understand?


Re: How to make this kind of function? - Calgon - 21.04.2010

Quote:
Originally Posted by 0ne
Umh ok, look right now i got a function like this:
Код:
new random_points[][3] = {
	{5,13,30}
and i want a function like :

Код:
new rand_proc = {
	{random(4)+30},
the point of this is that the random_points gives only 5,13,30 points and i want to make that it would give 4,5,6,7,8,9,10,11... and so on to 30, understand?
pawn Код:
stock GiveRandomPoints( playerid, maxpoints )
{
    return SetPlayerScore( playerid, GetPlayerScore( playerid )+random( maxpoints ) );
}
You might use a variable to hold the points/score, but I've simplified it for you. There's no need whatsoever for an enum. This could will work.


Re: How to make this kind of function? - 0ne - 21.04.2010

No it wont work, you don't understand, uhhh...

Код:
new random_points[][3] = {
	{5,13,30},
	{12,24,15},
	{24,30,35},
	{35,40,44},
	{44,47,53},
	{53,57,64},
	{64,80,84},
	{84,95,103},
	{103,124,154},
	{154,189,220},
	{220,250,320}
	};
The whole function of random points is like that, and the functioni m using is like this:
Код:
playerDB[killerid][EXP] += random_points[playerDB[killerid][Level]][rand];
it gives those points for the specific leve, so thats why i need a command like that with random..



Re: How to make this kind of function? - 0ne - 21.04.2010

GUYS?!


Re: How to make this kind of function? - FUNExtreme - 21.04.2010

pawn Код:
random(26)+4
will do from 4 to 30
pawn Код:
random(18)+12
will go from 12 to 30


Re: How to make this kind of function? - 0ne - 21.04.2010

I know that

I am asking for a command!

Код:
new rand_proc = {
	{random(26)+4}
I want that above command to get no errors, and i don't know how to do it that is ALL i am asking lol!


Re: How to make this kind of function? - ¤Adas¤ - 21.04.2010

This will not work. You have to randomize it everytime it gives score to player. Using a variable is not a good choice.