07.02.2010, 17:18
i some timers in my gm for my jobs that gives the players money but when i get 50 players on my server and alot of them are using the jobs and when every one uses jobs i get msgs from server ffs to optimise my gm using to much cpu whats the best way to put theese timers in my gm this is how they are in now or can i use one timer for all jobs?
new TaxiCash;
new FireCash;
new MedicCash;
new PoliceCash;
new ServiceCash;
forward TaxiCash();
forward FireCash();
forward MedicCash();
forward PoliceCash();
forward ServiceCash();
public OnGameModeInit()
{
fireCash = SetTimer("FireCash", 60000, 1);
medicCash = SetTimer("MedicCash", 60000, 1);
taxiCash = SetTimer("TaxiCash", 60000, 1);
policeCash = SetTimer("PoliceCash", 60000, 1);
serviseCash = SetTimer("ServiceCash", 60000, 1);
SetTimer("ServerPoints", 1000, true);
SetTimer("NewsUpdate", 500000, true);
public OnGameModeExit()
{
KillTimer(fireCash);
KillTimer(medicCash);
KillTimer(taxiCash);
KillTimer(policeCash);
KillTimer(serviseCash);
return 1;
}
public TaxiCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_TAXI)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
public PoliceCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_POLICE)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
public ServiseCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_SERVISE)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
you get the idea
new TaxiCash;
new FireCash;
new MedicCash;
new PoliceCash;
new ServiceCash;
forward TaxiCash();
forward FireCash();
forward MedicCash();
forward PoliceCash();
forward ServiceCash();
public OnGameModeInit()
{
fireCash = SetTimer("FireCash", 60000, 1);
medicCash = SetTimer("MedicCash", 60000, 1);
taxiCash = SetTimer("TaxiCash", 60000, 1);
policeCash = SetTimer("PoliceCash", 60000, 1);
serviseCash = SetTimer("ServiceCash", 60000, 1);
SetTimer("ServerPoints", 1000, true);
SetTimer("NewsUpdate", 500000, true);
public OnGameModeExit()
{
KillTimer(fireCash);
KillTimer(medicCash);
KillTimer(taxiCash);
KillTimer(policeCash);
KillTimer(serviseCash);
return 1;
}
public TaxiCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_TAXI)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
public PoliceCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_POLICE)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
public ServiseCash()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_SERVISE)
{
GivePlayerMoney(i, 1000);
SendClientMessage(i, 0xFFFF00AA, "[JOB]: Your earning: 1000$");
}
}
}
you get the idea