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



Money drop? - killdahobo99 - 19.07.2009

how do i make it so, if you have 1M or over, you start dropping 10k at a time so like every 5 secounds you drop 10k and a message pops up saying "Please store your money in the bank"

But if a player is in a vehicle, then his money is safe and wont drop


Re: Money drop? - Weirdosport - 19.07.2009

When you say drop do you just mean disappear?


Re: Money drop? - killdahobo99 - 19.07.2009

Quote:
Originally Posted by Weirdosport
When you say drop do you just mean disappear?
Yeah so it just dissapears


Re: Money drop? - killdahobo99 - 19.07.2009

I know its possible can someone who knows please tell me how to do it


Re: Money drop? - killdahobo99 - 19.07.2009

Anyone please reply sorry for double post


Re: Money drop? - Annihalation - 19.07.2009

you'd need to make a timer and every time the timer goes off (timer would be set to 5000 for 5 seconds) you would GivePlayerMoney as -10000

but I dont understand why you would want them to randomly lose 10k dollars every 5 seconds...


Re: Money drop? - killdahobo99 - 19.07.2009

Quote:
Originally Posted by Annihalation
you'd need to make a timer and every time the timer goes off (timer would be set to 5000 for 5 seconds) you would GivePlayerMoney as -10000

but I dont understand why you would want them to randomly lose 10k dollars every 5 seconds...
I want them to lose 10k everytime they have 1 million or over. I don't want them to be able to carry that much on them, so a Message displays to them, "You have dropped 10k Please deposit your money"


Re: Money drop? - Jefff - 19.07.2009

Maybe something like this?

Код:
//Top
new bool:Set[200];
new Timer[200];

///OnGameModeInit
SetTimer("CheckCash", 2000, true);

//somewhere
forward CheckCash();
public CheckCash()
{
	for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && GetPlayerMoney(i) >= 1000000)
	{
		if(!Set[i])
		{
			Set[i] = true;
			Timer[i] = SetTimerEx("GetCash", 5000, 1, "d", i);
		}
	}
	return 1;
}

forward GetCash(playerid);
public GetCash(playerid)
{
	if(!GetPlayerMoney(playerid)) // if moneys == 0, timer stop
	{
		KillTimer(Timer[playerid]);
		Timer[playerid] = 0;
		Set[playerid] = false;
		return 1;
	}
	//if(GetPlayerMoney(playerid) < 1000000) Set[playerid] = false;
	GivePlayerMoney(playerid, -10000);
	SendClientMessage(playerid, 0xFFFF00AA, "SERVER: You have dropped 10k Please deposit your money");
	return 1;
}



Re: Money drop? - killdahobo99 - 19.07.2009

Quote:
Originally Posted by Jefff
Maybe something like this?

Код:
//Top
new bool:Set[200];
new Timer[200];

///OnGameModeInit
SetTimer("CheckCash", 2000, true);

//somewhere
forward CheckCash();
public CheckCash()
{
	for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && GetPlayerMoney(i) >= 1000000)
	{
		if(!Set[i])
		{
			Set[i] = true;
			Timer[i] = SetTimerEx("GetCash", 5000, 1, "d", i);
		}
	}
	return 1;
}

forward GetCash(playerid);
public GetCash(playerid)
{
	if(!GetPlayerMoney(playerid)) // if moneys == 0, timer stop
	{
		KillTimer(Timer[playerid]);
		Timer[playerid] = 0;
		Set[playerid] = false;
		return 1;
	}
	//if(GetPlayerMoney(playerid) < 1000000) Set[playerid] = false;
	GivePlayerMoney(playerid, -10000);
	SendClientMessage(playerid, 0xFFFF00AA, "SERVER: You have dropped 10k Please deposit your money");
	return 1;
}
That only dropped money once...then after that it didnt drop it again. How do i fix this


Re: Money drop? - Jefff - 19.07.2009

edited version UP :P
SetTimerEx("GetCash", 5000, 0,"d", i);
to
SetTimerEx("GetCash", 5000, 1, "d", i);