With getting playercash
#1

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)
Reply
#2

pawn Код:
new pmoney, randcash;

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

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

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!
Reply
#4

Код:
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
Reply
#5

Change "input" with a valid specifier.

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

is every other thing fine ??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)