SA-MP Forums Archive
error 017: undefined symbol "randomEx" - 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: error 017: undefined symbol "randomEx" (/showthread.php?tid=424603)



error 017: undefined symbol "randomEx" - Squirrel - 23.03.2013

I am trying to make random drug system but it keeps failing

Код:
CMD:test(playerid, params[])
{
    new drugs = randomEx(1,10);
	new string[128];
	format(string, sizeof(string), "You received %d drugs", drugs);
	SendClientMessage(playerid, COLOR_YELLOW, string);
	PlayerInfo[playerid][pWeed] = drugs;
	return 1;
}
Код:
error 017: undefined symbol "randomEx"



Re: error 017: undefined symbol "randomEx" - Squirrel - 23.03.2013

Found the solution

stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;


Re: error 017: undefined symbol "randomEx" - DimaShift - 22.05.2017

Quote:
Originally Posted by Squirrel
Посмотреть сообщение
I am trying to make random drug system but it keeps failing

Код:
CMD:test(playerid, params[])
{
    new drugs = randomEx(1,10);
	new string[128];
	format(string, sizeof(string), "You received %d drugs", drugs);
	SendClientMessage(playerid, COLOR_YELLOW, string);
	PlayerInfo[playerid][pWeed] = drugs;
	return 1;
}
Код:
error 017: undefined symbol "randomEx"
#define randomEx(%1,%2) (random(%2-%1)+%1)


Re: error 017: undefined symbol "randomEx" - YouHack - 22.05.2017

PHP код:
#define randomEx(%1,%2) (random(%2)+%1) //if you don't want it to be 0 but it might exceed the max, so set max to 9. 
EDITED^


Re: error 017: undefined symbol "randomEx" - DTV - 22.05.2017

You realize the thread is years old right?


Re: error 017: undefined symbol "randomEx" - YouHack - 22.05.2017

Quote:
Originally Posted by DTV
Посмотреть сообщение
You realize the thread is years old right?
Just realized that ... but I didn't bump it