Код:
task ServerHeartbeatba[1000]() {
static string[128];
foreach(new i: Player)
{
if(playerTabbed[i] == 0) {
switch(PlayerInfo[i][pLevel]) {
case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
default: PlayerInfo[i][pPayCheck] += 11;
}
if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
PayDay(i);
}
}
if (DangDieuTra[i] != 0)
{
if (DieuTraLimit[i] > 1)
{
DieuTraLimit[i]--;
if (IsPlayerInRangeOfPoint(i, 2.0, GetPVarFloat(i, "pDieuTraX"), GetPVarFloat(i, "pDieuTraY"), GetPVarFloat(i, "pDieuTraZ")))
{
DieuTraCountDown[i]--;
if (DieuTraCountDown[i] > 0)
{
format(string, sizeof(string), "Thoi gian con lai~n~~y~%d", DieuTraCountDown[i]);
GameTextForPlayer(i, string, 900, 6);
}
else if (DieuTraCountDown[i] == 0) //thanh cong
{
new killer = GetKillerID[DieuTraVictim[i]];
if (killer == INVALID_PLAYER_ID)
{
SendClientMessage(i, COLOR_WHITE, "Thu pham khong ton tai (da thoat)");
DieuTraVictim[i] = INVALID_PLAYER_ID;
DangDieuTra[i] = 0;
DieuTraCountDown[i] = 0;
DieuTraLimit[i] = 0;
}
else
{
format(string, sizeof(string), "Hung thu co so CMND la %d", killer);
SendClientMessage(i, COLOR_LIGHTBLUE, "***** Dieu tra thanh cong *****");
SendClientMessage(i, COLOR_LIGHTGREEN, string);
SendClientMessage(killer, COLOR_LIGHTRED, "Canh sat da tim ra ban la thu pham trong vu giet nguoi");
SetPlayerWantedLevel(killer, GetPlayerWantedLevel(killer) + 1);
PlayerInfo[killer][pCrimes]++;
AddCrime(i, killer, "Giet nguoi");
PlayerInfo[killer][pWantedLevel]++;
format(string, sizeof(string), "** DISPATCH: Nhan vien %s da tim ra %s la thu pham cua 1 vu giet nguoi", GetPlayerNameEx(i), GetPlayerNameEx(killer));
foreach (new p: Player)
{
if (IsACop(p))
{
SendClientMessage(p, COLOR_DBLUE, string);
SendClientMessage(p, COLOR_LIGHTBLUE, "Hay kiem tra danh sach truy na.");
}
}
DangDieuTra[i] = 0;
DieuTraVictim[i] = INVALID_PLAYER_ID;
DangDieuTra[i] = 0;
DieuTraCountDown[i] = 0;
DieuTraLimit[i] = 0;
}
}
}
}
else if (DieuTraLimit[i] == 1 && DangDieuTra[i] == 1)
{
SendClientMessage(i, COLOR_GREY, "Ban da that bai trong viec tim kiem thu pham");
DangDieuTra[i] = 0;
}
}
/*if (GetPVarInt(i, "MailTime") > 0)
SetPVarInt(i, "MailTime", GetPVarInt(i, "MailTime") - 1);
else
DeletePVar(i, "MailTime");*/
if(PlayerInfo[i][pJudgeJailType] != 0 && PlayerInfo[i][pJudgeJailTime] > 0 && !PlayerInfo[i][pBeingSentenced]) PlayerInfo[i][pJudgeJailTime]--;
if(PlayerInfo[i][pJudgeJailTime] <= 0 && PlayerInfo[i][pJudgeJailType] != 0) PlayerInfo[i][pJudgeJailType] = 0;
if(PlayerInfo[i][pJailTime] > 0 && --PlayerInfo[i][pJailTime] <= 0) {
if(strfind(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1 || strfind(PlayerInfo[i][pPrisonReason], "[ISOLATE]", true) != -1) {
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
PlayerInfo[i][pVW] = 0;
SetPlayerPos(i, 1745.5969, 396.6139, 19.0345);
}
else {
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
PlayerInfo[i][pVW] = 0;
SetPlayerPos(i, 1544.5059,-1675.5673,13.5585);
}
PlayerInfo[i][pJailTime] = 0;
PhoneOnline[i] = 0;
SendClientMessageEx(i, COLOR_GRAD1," Ban da hoan thanh het nghia vu.");
GameTextForPlayer(i, "~g~Tu do~n~~w~Hay co gang la mot cong dan tot", 5000, 1);
ClearCrimes(i);
strcpy(PlayerInfo[i][pPrisonReason], "None", 128);
SetPlayerToTeamColor(i);
}
if(CommandSpamTimes[i] != 0)
{
CommandSpamTimes[i]--;
}
if(TextSpamTimes[i] != 0)
{
TextSpamTimes[i]--;
}
if(UsedFind[i] >= 1) --UsedFind[i];
if(PlayerInfo[i][pMechTime] > 0) PlayerInfo[i][pMechTime]--;
if(PlayerInfo[i][pLawyerTime] > 0) PlayerInfo[i][pLawyerTime]--;
if(PlayerInfo[i][pDrugsTime] > 0) PlayerInfo[i][pDrugsTime]--;
if(PlayerInfo[i][pRMuted] == 2) {
PlayerInfo[i][pRMutedTime]--;
if(PlayerInfo[i][pRMutedTime] <= 0) {
PlayerInfo[i][pRMuted] = 0;
}
}
if(PlayerInfo[i][pVMuted] == 2) {
PlayerInfo[i][pVMutedTime]--;
if(PlayerInfo[i][pVMutedTime] <= 0) {
PlayerInfo[i][pVMuted] = 0;
}
}
if(GetPVarType(i, "hFind"))
{
new Float:X, Float:Y, Float:Z, pID = GetPVarInt(i, "hFind");
if(IsPlayerConnected(pID))
{
GetPlayerPos(pID, X, Y, Z);
SetPlayerCheckpoint(i, X, Y, Z, 4.0);
}
}
if(WantLawyer[i] >= 1)
{
CallLawyer[i] = 111;
if(WantLawyer[i] == 1)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Ban co muon mot luat su? (Go 'yes' hoac 'no')");
}
WantLawyer[i] ++;
if(WantLawyer[i] == 8)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Ban co muon mot luat su? (Go 'yes' hoac 'no')");
}
if(WantLawyer[i] == 15)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Ban co muon mot luat su? (Go 'yes' hoac 'no')");
}
if(WantLawyer[i] == 20)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Khong co luat su nao lam nhiem vu! Thoi gian o tu bat dau.");
WantLawyer[i] = 0;
CallLawyer[i] = 0;
}
}
}
}