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



houses. - MarioCremades - 24.11.2012

Hi, I have the system modified Sandra properties ladmin my system, the problem is that to buy a property takes money from everyone, and when it is given at home five minutes, gives all, meaning that when buying a home purchased for all players not able to get Right eh Any solution? ..


Re: houses. - DaRk_RaiN - 24.11.2012

You must have used foreach or something like this
PHP код:
for(new 0MAX_PLAYERSi++) 
That will take money from all the players.
Show me the part of code that takes money from the player i can't tell..


Respuesta: houses. - MarioCremades - 24.11.2012

it is this feature?...
Код:
forward PropertyPayout();
public PropertyPayout()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerProps[i] > 0)
{
GivePlayerMoney(i, EarningsForPlayer[i]);
			}
		}
	}
}
just as I said, is that when buying a buy for all ..
Here's the system admin who has: http://www.solidfiles.com/d/1fd0dcd1ea/


Respuesta: houses. - Jordan98 - 24.11.2012

This put it up at all:
Код:
forward PropertyPayout();
This put it in OnGamemodeInit:
Код:
SetTimer("PropertyPayout", 60000, 1);
This put it down at all:
Код:
public PropertyPayout()
{
new str[64];
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerProps[i] > 0)
{
GivePlayerMoney(i, EarningsForPlayer[i]);
format(str, 64, "You won $%d of its properties!", EarningsForPlayer[i]);
SendClientMessage(i, 0xFFFF00AA, str);
}
}
}
}