Skip to content

Instantly share code, notes, and snippets.

@earlwlkr
Created September 6, 2014 00:17
Show Gist options
  • Save earlwlkr/e4be25fd14d6f65abcc7 to your computer and use it in GitHub Desktop.
Save earlwlkr/e4be25fd14d6f65abcc7 to your computer and use it in GitHub Desktop.
timer DieuTraTimer[1000](playerid)
{
if (!DangDieuTra{ playerid }) return 1;
if (DieuTraLimit[playerid] > 1)
{
if (!(--DieuTraLimit[playerid]))
{
SendClientMessage(playerid, X11_LIGHT_GREY, "Ban da that bai trong viec tim kiem thu pham");
DangDieuTra{ playerid } = false;
return 1;
}
if (IsPlayerInRangeOfPoint(playerid, 2.0, DieuTraPos[playerid][0], DieuTraPos[playerid][1], DieuTraPos[playerid][2]))
{
new string[128];
DieuTraCountDown[playerid]--;
if (DieuTraCountDown[playerid] > 0)
{
format(string, sizeof (string), "Thoi gian con lai~n~~y~%d", DieuTraCountDown[playerid]);
GameTextForPlayer(playerid, string, 900, 6);
}
else
{
new
victim = DieuTraVictim[playerid];
if (GetKillerID[victim] == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, X11_WHITE, "Thu pham khong ton tai (da thoat)");
}
else if (IsInjured(victim))
{
investigation_data[victim][E_CSI_INSPECTOR] = INVALID_PLAYER_ID;
for (new i; i != investigation_data[victim][E_CSI_WITNESSES_COUNT]; i++)
{
if (investigation_data[victim][E_CSI_WITNESSES][i] != INVALID_PLAYER_ID)
{
format(string, sizeof (string), "Nhan chung: %s", GetName(investigation_data[victim][E_CSI_WITNESSES][i]));
UpdateDynamic3DTextLabelText(investigation_data[victim][E_CSI_WITNESSES_LABEL][i], -1, string);
}
}
for (new i; i != investigation_data[victim][E_CSI_ARMED_COUNT]; i++)
{
if (investigation_data[victim][E_CSI_ARMED][i] != INVALID_PLAYER_ID)
{
format(string, sizeof (string), "Vo dan sung: %s\nGiay phep su dung: %s",
GetWeaponNameEx(investigation_data[victim][E_CSI_ARMED_WEAPONS][i]),
GetName(investigation_data[victim][E_CSI_ARMED][i]));
UpdateDynamic3DTextLabelText(investigation_data[victim][E_CSI_ARMED_LABEL][i], -1, string);
}
}
new
Float: victim_positions[3];
GetPlayerPos(victim, victim_positions[0], victim_positions[1], victim_positions[2]);
format(string, sizeof (string), "Hung khi giet nguoi: %s", GetWeaponNameEx(investigation_data[victim][E_CSI_KILLER_WEAPON]));
investigation_data[victim][E_CSI_VICTIM_LABEL] = CreateDynamic3DTextLabel(string, -1, victim_positions[0], victim_positions[1], victim_positions[2], 20.0);
defer ClearInvestigation[30000]( victim );
SendClientMessage(playerid, X11_WHEAT, "Dieu tra thanh cong, hay truy tim tung tich ke sat nhan.");
SendClientMessage(playerid, X11_WHEAT, "Ban co 1 phut truoc khi manh moi bien mat.");
}
DieuTraVictim[playerid] = INVALID_PLAYER_ID;
DangDieuTra{ playerid } = false;
DieuTraCountDown[playerid] = 0;
DieuTraLimit[playerid] = 0;
return 1;
}
}
defer DieuTraTimer(playerid);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment