23.12.2013, 14:40
The code I posted was just an example. I could use random messages, unmuting/unjailing, updating hour's playing... etc. Something like this
Is it a good way?
pawn Code:
public OneSecTimer()
{
foreach(...)
{
if(Player[i][IsLogged] == 1)
{
Player[i][updatept]++;
if(Player[i][updatept] == 3600) //1 hour
{
pInfo[i][PT]++;
Player[i][updatept] = 0;
SendClientMessage(i,-1,""hinfo" You have received 1 PlayTime score.");
}
//....
if(pInfo[i][Muted] == 1 && pInfo[i][MuteTime] > 0)
{
pInfo[i][MuteTime]--;
if(pInfo[i][MuteTime] == 0)
{
pInfo[i][Muted] = 0;
pInfo[i][MuteTime] = 0;
SendClientMessage(i,-1,""hinfo" You have been unmuted!");
}
}
if(pInfo[i][Jailed] == 1 && pInfo[i][JailTime] > 0 && Player[i][Spawned] == 1)
{
pInfo[i][JailTime]--;
if(pInfo[i][JailTime] == 0)
{
pInfo[i][Jailed] = 0;
pInfo[i][JailTime] = 0;
SetPlayerHealth(i,0);
SendClientMessage(i,-1,""hinfo" You have been unjailed!");
}
}
//random messages
Player[i][MSGTimer]++;
if(Player[i][MSGTimer] == 7)
{
PlayerTextDrawSetString(i, RandTD[i], RandMSG[rand]); //updating textdraw/sending messages(sendclientmessage) every 7 seconds
Player[i][MSGTimer] = 0;
}
//from my old script