SA-MP Forums Archive
help - 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: help (/showthread.php?tid=659563)



help - BFire - 07.10.2018

hello
I need command that selects a random player from the server and gives him a random amount of money


Re: help - SyS - 07.10.2018

Use Iter_Random function from y_iterate to get random player ids.
Use Random function to get random integer value that can be used as random amount of money
Use GivePlayerMoney to give money to that player


Re: help - Dennis12 - 07.10.2018

De obicei nu ofer cod pe tava oamenilor, astept sa vad ce au facut ei, abea dupa le ofer ceva.
Data viitoare incearca sa faci tu ceva, dupa sa vi si sa ceri.

Poftim urmatorul cod( ai nevoie de y_iterate pentru a merge ):
Apropo sa updatezi in functie de procesorul de comenzi pe care il folosesti, comanda este facuta pe YCMD.

Код:
YCMD:randomgive(playerid, params[], help)
{
	new
		randomPlayer = Iter_Random(Player),
		randomSum    = 1000 + random(9555);

	GivePlayerMoney(randomPlayer, randomSum);
	return 1;
}
The randomPlayer variable selects a random player from the server.
Variabila randomSum ofera o suma random de bani jucatorului. 1000$ ii primeste clar, si o suma random din 9555$.