new PayCheck[MAX_PLAYERS];
forward GivePlayerCheck(playerid);
public OnPlayerConnect(playerid)
{
PayCheck[playerid]=SetTimerEx("GivePlayerCheck",600000,true,"i",playerid);//repeats every 10 minutes
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(PayCheck[playerid]);
return 1;
}
public GivePlayerCheck(playerid)
{
GivePlayerMoney(playerid,5000);
return 1;
}
Obviusly you cannot use timers,but it's not your fault,you're a beginner,therefor,here it goes:
pawn Код:
|
OnGamemodeInit()
{
SetTimer("MinuteUpdate", 60000, true);
}
public MinuteUpdate()
{
new hour,minute,second;
gettime(hour,minute,second);
if(hour != hourding)
{
hourding = hour;
new string[128];
foreach(Player, q)
{
new tax;
new salary = 500;
SendClientMessage(q, COLOR_WHITE, "_________________________San Andreas Bank Statement_________________________");
if(PlayerInfo[q][Vehicle1] != 0) tax = tax + 50;
if(PlayerInfo[q][Vehicle2] != 0) tax = tax + 55;
if(PlayerInfo[q][Vehicle3] != 0) tax = tax + 45;
if(PlayerInfo[q][House] != 0) tax = tax + 120;
if(PlayerInfo[q][Job] != 0) salary = salary + 200;
if(PlayerInfo[q][Faction] != 0) salary = salary + (PlayerInfo[q][FactionRank] * 300);
format(string, sizeof(string), "Tax: $%d" ,tax);
scm(q, white, string);
format(string, sizeof(string), "Salary: $%d", salary);
scm(q, white, string);
PlayerInfo[q][Bank] = PlayerInfo[q][Bank] - tax;
PlayerInfo[q][Bank] = PlayerInfo[q][Bank] + salary;
PlayAudioStreamForPlayer(q, "http://milania91.ninetyone.axc.nl/sounds/MissionComplete.mp3");
SetPlayerScore(q, GetPlayerScore(q) + 1);
}
}
SetWorldTime(hour);
}