SA-MP Forums Archive
With getting playercash - 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: With getting playercash (/showthread.php?tid=508518)



With getting playercash - AroseKhanNiazi - 22.04.2014

How can i do that to get the random amount of cash from all and give it to other the cash from players total cash and the max limit 3M (3000000)


Re: With getting playercash - Dignity - 22.04.2014

pawn Код:
new pmoney, randcash;

pmoney = GetPlayerMoney(playerid);
randcash = random(pmoney);

GivePlayerMoney(input, randcash); // please replace "input" with an appropiate ID other than playerid.



Re: With getting playercash - CroM256 - 22.04.2014

Random amount of cash? Something like this?
Код:
stock randomEx(min, max)
{
    new rand = random(max-min)+min;
    return rand;
}


Use: 
for(new i=0; i<MAX_PLAYERS; i++)
{
new amount = randomEx(0, 3000000);
GivePlayerMoney(i, -amount);
GivePlayerMoney(playerwhowillgetmoney, 2*amount); // 2* is because he already lost 'amount' like everybody else, so he needs twice...
}
I hope i understood you and helped you BTW code randomEx is not mine!


Re: With getting playercash - AroseKhanNiazi - 22.04.2014

Код:
if(GameHour == 23 && GameMinute == 59)
	{
    	for(new i = 0; i < GetMaxPlayers(); i++)
		{
			for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
			{
				if(IsPlayerConnected(i) && spawned[playerid] == 1)
				{
					pInfo[i][pDaysAlive] ++;
					if(pInfo[i][pDaysAlive] == 365)
					{
						pInfo[playerid][pBirthdays] ++;
						new pmoney, randcash;
						pmoney = GetPlayerMoney(i);
						randcash = random(pmoney);
						GivePlayerMoney(playerid, randcash);
						SCM(playerid,COLOR_RED,"BIRTHDAY TEST");
					}
				}
			}
		}
	}
it's not taking money from others


Re: With getting playercash - Dignity - 22.04.2014

Change "input" with a valid specifier.

pawn Код:
GivePlayerMoney(input, -randcash);



Re: With getting playercash - AroseKhanNiazi - 22.04.2014

is every other thing fine ??