Code:
[quote='The_Zodiac link' pid='7834' dateline='1208911845']
change it for:
[code]forward TaxUpdater(playerid);
and
public TaxUpdater(playerid)
There is no need to declare a function with the parameters included.
First, indent you code corectly D:
Code:
public TaxUpdater(playerid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
SetTimerEx("TaxUpdater", 180000, 1,"i",i);
// u closed the for() loop where u defined 'i' !!! }
if(GetPlayerMoney(i) > 3000000)
{
GivePlayerMoney(i,-100000);
SendClientMessage(i, COLOR_GREEN,"You payed 100000 tax.");
}
}
}
But, that code will cause a huge CPU load
This is better:
Code:
top:
forward TaxUpdater();
Ongameinit:
SetTimerEx("TaxUpdater", 180000, 1,"i",i);
function:
public TaxUpdater(playerid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) == 1)
{
if(GetPlayerMoney(i) > 3000000)
{
GivePlayerMoney(i,-100000);
SendClientMessage(i, COLOR_GREEN,"You payed 100000 tax.");
}
}
}
}
just a tip: you can check if a timer is running by simple adding a 'debug message', just a simple SendClientMessageToAll(white, "Time activated"); to the function it should trigger.
-oost