function UsedTimer()
{
new str[256], string[128];
for(new i = 1; i < sizeof(Turfs); i++)
{
if(WarInfo[i][wTime] > 0)
{
WarInfo[i][wTime] -= 1;
new attackers = WarInfo[i][wAttacker];
new defenders = WarInfo[i][wFaction];
foreach(Player, j)
{
if(IsPlayerInTurf(j,i) == 1)
{
if((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
{
WarScore[j][i] += 1;
}
if((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
{
WarScore[j][i] += 1;
}
}
}
if(WarInfo[i][wTime] == 1)
{
new atscore = 0;
new defscore = 0;
new winner;
foreach(Player, j)
{
if((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
{
WarScore[j][i] /= 10;
atscore += WarScore[j][i];
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
if((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
{
WarScore[j][i] /= 10;
defscore += WarScore[j][i];
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
}
War[attackers] = 0;
War[defenders] = 0;
if(atscore >= defscore)
winner = 1;
if(defscore > atscore)
winner = 2;
foreach(Player, j)
{
if(((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers) || ((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders))
{
if(winner == 1)
{
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wAttacker]),i,FactionName(WarInfo[i][wAttacker]),atscore,defscore,FactionName(WarInfo[i][wFaction]));
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
new score = WarScore[j][i];
format(string,sizeof(string),"Your score was: %i (%i deaths)", score, WarDeaths[j][i]);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
mysql_format(SQL, str,256,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",WarInfo[i][wAttacker],i);
mysql_tquery(SQL, str, "", "");
//Change
}
if(winner == 2)
{
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wFaction]),i,FactionName(WarInfo[i][wFaction]),defscore,atscore,FactionName(WarInfo[i][wAttacker]));
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
new score = WarScore[j][i];
format(string,sizeof(string),"Your score was: %i (%i deaths)", score, WarDeaths[j][i]);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
WarScore[j][i] = 0;
WarDeaths[j][i] = 0;
}
GangZoneHideForPlayer(j,i);
if(TurfInfo[i][zOwned] == 2)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorGrove);
}
if(TurfInfo[i][zOwned] == 3)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorGSW);
}
if(TurfInfo[i][zOwned] == 4)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorVNE);
}
}
WarInfo[i][wTime] = 0;
WarInfo[i][wFaction] = 0;
WarInfo[i][wAttacker] = 0;
if(winner == 1)
{
SafeBox[attackers][sbMoney] += WarInfo[i][wPrice];
SafeBox[defenders][sbMoney] -= WarInfo[i][wPrice];
format(string, sizeof(string), "withdraw %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(defenders,-1,string);
format(string, sizeof(string), "deposit %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(attackers,-1,string);
}
if(winner == 2)
{
SafeBox[attackers][sbMoney] -= WarInfo[i][wPrice];
SafeBox[defenders][sbMoney] += WarInfo[i][wPrice];
format(string, sizeof(string), "withdraw %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(attackers,-1,string);
format(string, sizeof(string), "deposit %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(defenders,-1,string);
}
mysql_format(SQL, str,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[attackers][sbMoney], attackers);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[defenders][sbMoney], defenders);
mysql_tquery(SQL, str, "", "");
}
}
}
// from this it starts !!!!!!!
// asd
// asd
//a asd
// from this it starts !!!!!!!
new hours, minutes, year, month, day;
new datestr[128], timestr[32];
gettime(hours, minutes);
getdate(year, month, day);
format(datestr,128,"%02d.%02d.%d", day, month, year);
format(timestr,32,"%02d:%02d",hours,minutes);
TextDrawSetString(txtTimeDisp,timestr);
TextDrawSetString(txtDateDisp,datestr);
if(minutes == 0 || minutes == 30)
{
RandomEvent();
SetWorldTime(hours);
}
foreach(Player, i)
{
new Float:health;
GetPlayerHealth(i, health);
SetPlayerHealth(i, health-1.0);
if(PlayerData[i][TrackLose] >= 0)
{
if(PlayerData[i][WantedLevel] == 0)
{
PlayerData[i][TrackLose] = -1;
}
else
{
PlayerData[i][TrackLose] -= 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `TrackLose`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][TrackLose],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
if(PlayerData[i][TrackLose] == 0)
{
PlayerData[i][WantedLevel] -= 1;
SetPlayerWantedLevel(i,PlayerData[i][WantedLevel]);
mysql_format(SQL, str,128,"UPDATE `users` SET `WantedLevel`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][WantedLevel],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
SendClientMessage(i, COLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose 1 wanted level.");
format(string, sizeof(string), "HQ: Suspect %s lose 1 wanted level, current wanted level: %d.", PlayerData[i][Name],PlayerData[i][WantedLevel]);
SendRadioMessage(1, 0x3350FFFF, string);
if(PlayerData[i][WantedLevel] == 0)
{
SendClientMessage(i, COLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose all stars.");
format(string, sizeof(string), "HQ: Suspect %s losed all wanted levels.", PlayerData[i][Name]);
SendRadioMessage(1, 0x3350FFFF, string);
PlayerData[i][MDC] = 0;
}
else
{
PlayerData[i][TrackLose] = 30;
}
}
}
if(IsPlayerPaused(i) == false && PlayerData[i][IsLoggedIn] == true && Sleeping[i] == 0)
{
PlayerData[i][Exp] += 1;
OnExp[i] += 1;
if(OnExp[i] >= 60)
{
new checks = PlayerData[i][Level] * 300;
new account = PlayerData[i][Bank];
new interest = account / 300;
PlayerData[i][Bank] += interest;
if(PlayerData[i][FPunish] > 0) PlayerData[i][FPunish] -= 1;
SendClientMessage(i, COLOR_WHITE, "________ BANK STATEMENT ________");
format(string, sizeof(string), " Paycheck: $%s", Decimal(checks));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " Old Balance: $%s | Interest rate: 0.1%%", Decimal(account));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " New balance: $%s", Decimal(PlayerData[i][Bank]));
SendClientMessage(i, COLOR_GRAD5, string);
GivePlayerCash(i, checks);
mysql_format(SQL, str,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
OnExp[i] = 0;
}
PlayerData[i][TotalExp] += 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
if(PlayerData[i][CarLic] > 0) PlayerData[i][CarLic] -= 1;
if(PlayerData[i][FlyLic] > 0) PlayerData[i][FlyLic] -= 1;
if(PlayerData[i][BoatLic] > 0) PlayerData[i][BoatLic] -= 1;
if(PlayerData[i][FishLic] > 0) PlayerData[i][FishLic] -= 1;
if(PlayerData[i][GunLic] > 0) PlayerData[i][GunLic] -= 1;
if(PlayerData[i][MatsLic] > 0) PlayerData[i][MatsLic] -= 1;
if(PlayerData[i][CarLic] == 10) SendClientMessage(i, RED, "WARNING: Your driving license will expire in 10 minutes.");
if(PlayerData[i][FlyLic] == 10) SendClientMessage(i, RED, "WARNING: Your flying license will expire in 10 minutes.");
if(PlayerData[i][BoatLic] == 10) SendClientMessage(i, RED, "WARNING: Your sailing license will expire in 10 minutes.");
if(PlayerData[i][FishLic] == 10) SendClientMessage(i, RED, "WARNING: Your fishing license will expire in 10 minutes.");
if(PlayerData[i][GunLic] == 10) SendClientMessage(i, RED, "WARNING: Your weapon license will expire in 10 minutes.");
if(PlayerData[i][MatsLic] == 10) SendClientMessage(i, RED, "WARNING: Your materials license will expire in 10 minutes.");
mysql_format(SQL, str, 128, "UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
new XPneed = GetXPPoints(i);
if(Allowed[i] == 0)
{
format(string, 100, "%d / %d XP", PlayerData[i][Exp], XPneed);
PlayerTextDrawSetString(i, XPRemain, string);
format(string, 100, "Time Left: %d min", XPneed-PlayerData[i][Exp]);
PlayerTextDrawSetString(i, XPTLeft, string);
format(string, 100, "Level: %d (%d XP)", PlayerData[i][Level],PlayerData[i][TotalExp]);
PlayerTextDrawSetString(i, XPTotal, string);
new Float:percent;
percent = ((PlayerData[i][Exp] * 100) / XPneed);
SetPlayerProgressBarValue(i, barxp, percent);
HidePlayerProgressBar(i, barxp);
ShowPlayerProgressBar(i, barxp);
}
if(PlayerData[i][Exp] >= XPneed)
{//Level Up
PlayerData[i][Level] += 1;
SetPlayerScore(i, PlayerData[i][Level]);
new money;
if(PlayerData[i][Level] < 8 && PlayerData[i][Level] > 0) money = PlayerData[i][Level] * 1500;
else money = PlayerData[i][Level] * 500;
GivePlayerCash(i, money);
format(string, sizeof(string), "You recieve %d money for level up.", money);
SendClientMessage(i, COLOR_WHITE, string);
PlayerData[i][Exp] = 0;
mysql_format(SQL, str, 256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
}
if(Sleeping[i] == 1)
{
SleepXP[i] += 1;
if(SleepXP[i] == 5)
{
PlayerData[i][Exp] += 1;
OnExp[i] += 1;
if(OnExp[i] >= 120)
{
new checks = PlayerData[i][Level] * 300;
new account = PlayerData[i][Bank];
new interest = account / 300;
PlayerData[i][Bank] += interest;
if(PlayerData[i][FPunish] > 0) PlayerData[i][FPunish] -= 1;
SendClientMessage(i, COLOR_WHITE, "________ BANK STATEMENT ________");
format(string, sizeof(string), " Paycheck: $%s", Decimal(checks));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " Old Balance: $%s | Interest rate: 0.1%%", Decimal(account));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " New balance: $%s", Decimal(PlayerData[i][Bank]));
SendClientMessage(i, COLOR_GRAD5, string);
GivePlayerCash(i, checks);
mysql_format(SQL, str,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
OnExp[i] = 0;
}
PlayerData[i][TotalExp] += 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
if(PlayerData[i][CarLic] > 0) PlayerData[i][CarLic] -= 1;
if(PlayerData[i][FlyLic] > 0) PlayerData[i][FlyLic] -= 1;
if(PlayerData[i][BoatLic] > 0) PlayerData[i][BoatLic] -= 1;
if(PlayerData[i][FishLic] > 0) PlayerData[i][FishLic] -= 1;
if(PlayerData[i][GunLic] > 0) PlayerData[i][GunLic] -= 1;
if(PlayerData[i][MatsLic] > 0) PlayerData[i][MatsLic] -= 1;
if(PlayerData[i][CarLic] == 10) SendClientMessage(i, RED, "WARNING: Your driving license will expire in 10 minutes.");
if(PlayerData[i][FlyLic] == 10) SendClientMessage(i, RED, "WARNING: Your flying license will expire in 10 minutes.");
if(PlayerData[i][BoatLic] == 10) SendClientMessage(i, RED, "WARNING: Your sailing license will expire in 10 minutes.");
if(PlayerData[i][FishLic] == 10) SendClientMessage(i, RED, "WARNING: Your fishing license will expire in 10 minutes.");
if(PlayerData[i][GunLic] == 10) SendClientMessage(i, RED, "WARNING: Your weapon license will expire in 10 minutes.");
if(PlayerData[i][MatsLic] == 10) SendClientMessage(i, RED, "WARNING: Your materials license will expire in 10 minutes.");
mysql_format(SQL, str, 128, "UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
new XPneed = GetXPPoints(i);
if(Allowed[i] == 0)
{
format(string, 100, "%d / %d XP", PlayerData[i][Exp], XPneed);
PlayerTextDrawSetString(i, XPRemain, string);
format(string, 100, "Time Left: %d min", XPneed-PlayerData[i][Exp]);
PlayerTextDrawSetString(i, XPTLeft, string);
format(string, 100, "Level: %d (%d XP)", PlayerData[i][Level],PlayerData[i][TotalExp]);
PlayerTextDrawSetString(i, XPTotal, string);
new Float:percent;
percent = ((PlayerData[i][Exp] * 100) / XPneed);
SetPlayerProgressBarValue(i, barxp, percent);
HidePlayerProgressBar(i, barxp);
ShowPlayerProgressBar(i, barxp);
}
if(PlayerData[i][Exp] >= XPneed)
{//Level Up
PlayerData[i][Level] += 1;
SetPlayerScore(i, PlayerData[i][Level]);
new money;
if(PlayerData[i][Level] < 8 && PlayerData[i][Level] > 0) money = PlayerData[i][Level] * 1500;
else money = PlayerData[i][Level] * 500;
GivePlayerCash(i, money);
format(string, sizeof(string), "You recieve %d money for level up.", money);
SendClientMessage(i, COLOR_WHITE, string);
PlayerData[i][Exp] = 0;
mysql_format(SQL, str, 256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
SleepXP[i] = 0;
}
}
}
}
spdtimer = SetTimer("Speedo", 750, 1); usetimer = SetTimer("UsedTimer", 60000, 1); othtimer = SetTimer("OtherTimer", 1000, 1); spectatetimer = SetTimer("Spectator", 500, 1); timeranticheat = SetTimer("TimerAntiCheat", 5000, 1); |
function Speedo()
{
new str[128];
foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i) && Allowed[i] == 0)
{
new Float: oldX[MAX_PLAYERS], Float: oldY[MAX_PLAYERS], Float: oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
new str1[128],zone[30];
new vehicle = GetPlayerVehicleID(i);
new oldspeed = PlayerData[i][Speed];
PlayerData[i][Speed] = GetVehicleSpeed(GetPlayerVehicleID(i), 0);
new newspeed = PlayerData[i][Speed];
new acceleration = abs(newspeed - oldspeed);
new Consume = (((acceleration / 10) + 1) * (newspeed / 20));
new Float:Consume2 = float(Consume);
new carid = FindSpawnID(vehicle);
if(!(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle)))
{
Gas[vehicle] -= Consume2/500;
if(Gas[vehicle] <= 0)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vehicle,e,l,a,d,b,bo,o);
SetVehicleParamsEx(vehicle,0,l,a,d,b,bo,o);
format(str1,sizeof(str1),"Fuel: ~r~NO FUEL"); //
PlayerTextDrawSetString(i, Fuell, str1);
Gas[vehicle] = 0;
}
}
else
{
Consume = 0;
}
if(CarInfo[carid][cID] != -2 && carid != 0) PlayerTextDrawHide(i, Odometerr);
PlayerTextDrawHide(i, Speedd);
PlayerTextDrawHide(i, Fuell);
PlayerTextDrawHide(i, Destination);
PlayerTextDrawHide(i, DestinationKM);
PlayerTextDrawHide(i, Radio);
CarInfo[carid][KM] += distanta[i]/1000;
mysql_format(SQL, str,128,"UPDATE `cars` SET `KM`='%f' WHERE `ID`='%d' LIMIT 1",CarInfo[carid][KM],carid);
mysql_tquery(SQL, str, "", "");
if(CarInfo[carid][cID] != -2 && carid != 0)
{
format(str1,sizeof(str1),"Odometer: ~y~%.2f ~w~KM",CarInfo[carid][KM]);
PlayerTextDrawSetString(i, Odometerr, str1);
}
if(PlayerData[i][Speed] <= 110)
{
format(str1,sizeof(str1),"Speed: ~y~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(PlayerData[i][Speed] > 110 && PlayerData[i][Speed] <= 160)
{
format(str1,sizeof(str1),"Speed: ~b~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(PlayerData[i][Speed] > 160)
{
format(str1,sizeof(str1),"Speed: ~r~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(Gas[vehicle] > 0)
{
format(str1,sizeof(str1),"Fuel: %d %% (C: %d %%)", floatround(Gas[vehicle], floatround_round), Consume); //
PlayerTextDrawSetString(i, Fuell, str1);
}
if(DestinationSet[i] == 0)
{
format(str1,sizeof(str1),"Destination: None"); //
PlayerTextDrawSetString(i, Destination, str1);
}
else
{
GetPlayer3DZone2(DestSet[i][0],DestSet[i][1],DestSet[i][2],zone,30);
format(str1,sizeof(str1),"Destination: ~y~%s",zone); //
PlayerTextDrawSetString(i, Destination, str1);
new Float:distance = GetPlayerDistanceFromPoint(i, DestSet[i][0],DestSet[i][1],DestSet[i][2]);
format(str1,sizeof(str1)," ~y~%.2f meters",distance); //
PlayerTextDrawSetString(i, DestinationKM, str1);
PlayerTextDrawShow(i, DestinationKM);
}
if(RadioSet[i] == 0)
{
format(str1,sizeof(str1),"Radio: ~r~OFF"); //
PlayerTextDrawSetString(i, Radio, str1);
}
else
{
format(str1,sizeof(str1),"Radio: ~y~%s",RadioName(RadioSet[i])); //
PlayerTextDrawSetString(i, Radio, str1);
}
if(CarInfo[carid][cID] != -2 && carid != 0) PlayerTextDrawShow(i, Odometerr);
PlayerTextDrawShow(i, Speedd);
PlayerTextDrawShow(i, Fuell);
PlayerTextDrawShow(i, Destination);
PlayerTextDrawShow(i, Radio);
}
else
{
PlayerTextDrawHide(i, Odometerr);
PlayerTextDrawHide(i, Speedd);
PlayerTextDrawHide(i, Fuell);
PlayerTextDrawHide(i, Destination);
PlayerTextDrawHide(i, Radio);
PlayerTextDrawHide(i, DestinationKM);
}
}
}
function UsedTimer()
{
new str[256], string[128];
for(new i = 1; i < sizeof(Turfs); i++)
{
if(WarInfo[i][wTime] > 0)
{
WarInfo[i][wTime] -= 1;
new attackers = WarInfo[i][wAttacker];
new defenders = WarInfo[i][wFaction];
foreach(Player, j)
{
if(IsPlayerInTurf(j,i) == 1)
{
if((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
{
WarScore[j][i] += 1;
}
if((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
{
WarScore[j][i] += 1;
}
}
}
if(WarInfo[i][wTime] == 1)
{
new atscore = 0;
new defscore = 0;
new winner;
foreach(Player, j)
{
if((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
{
WarScore[j][i] /= 10;
atscore += WarScore[j][i];
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
if((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
{
WarScore[j][i] /= 10;
defscore += WarScore[j][i];
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
}
War[attackers] = 0;
War[defenders] = 0;
if(atscore >= defscore)
winner = 1;
if(defscore > atscore)
winner = 2;
foreach(Player, j)
{
if(((PlayerData[j][Member] + PlayerData[j][Leader]) == attackers) || ((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders))
{
if(winner == 1)
{
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wAttacker]),i,FactionName(WarInfo[i][wAttacker]),atscore,defscore,FactionName(WarInfo[i][wFaction]));
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
new score = WarScore[j][i];
format(string,sizeof(string),"Your score was: %i (%i deaths)", score, WarDeaths[j][i]);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
mysql_format(SQL, str,256,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",WarInfo[i][wAttacker],i);
mysql_tquery(SQL, str, "", "");
//Change
}
if(winner == 2)
{
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wFaction]),i,FactionName(WarInfo[i][wFaction]),defscore,atscore,FactionName(WarInfo[i][wAttacker]));
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
new score = WarScore[j][i];
format(string,sizeof(string),"Your score was: %i (%i deaths)", score, WarDeaths[j][i]);
SendClientMessage(j, TEAM_AZTECAS_COLOR,string);
}
WarScore[j][i] = 0;
WarDeaths[j][i] = 0;
}
GangZoneHideForPlayer(j,i);
if(TurfInfo[i][zOwned] == 2)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorGrove);
}
if(TurfInfo[i][zOwned] == 3)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorGSW);
}
if(TurfInfo[i][zOwned] == 4)
{
GangZoneShowForPlayer(j, Turfs[i], TurfColorVNE);
}
}
WarInfo[i][wTime] = 0;
WarInfo[i][wFaction] = 0;
WarInfo[i][wAttacker] = 0;
if(winner == 1)
{
SafeBox[attackers][sbMoney] += WarInfo[i][wPrice];
SafeBox[defenders][sbMoney] -= WarInfo[i][wPrice];
format(string, sizeof(string), "withdraw %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(defenders,-1,string);
format(string, sizeof(string), "deposit %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(attackers,-1,string);
}
if(winner == 2)
{
SafeBox[attackers][sbMoney] -= WarInfo[i][wPrice];
SafeBox[defenders][sbMoney] += WarInfo[i][wPrice];
format(string, sizeof(string), "withdraw %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(attackers,-1,string);
format(string, sizeof(string), "deposit %d money (WAR).", WarInfo[i][wPrice]);
SafeboxLog(defenders,-1,string);
}
mysql_format(SQL, str,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[attackers][sbMoney], attackers);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[defenders][sbMoney], defenders);
mysql_tquery(SQL, str, "", "");
}
}
}
new hours, minutes, year, month, day;
new datestr[128], timestr[32];
gettime(hours, minutes);
getdate(year, month, day);
format(datestr,128,"%02d.%02d.%d", day, month, year);
format(timestr,32,"%02d:%02d",hours,minutes);
TextDrawSetString(txtTimeDisp,timestr);
TextDrawSetString(txtDateDisp,datestr);
if(minutes == 0 || minutes == 30)
{
RandomEvent();
SetWorldTime(hours);
}
foreach(Player, i)
{
new Float:health;
GetPlayerHealth(i, health);
SetPlayerHealth(i, health-1.0);
if(PlayerData[i][TrackLose] >= 0)
{
if(PlayerData[i][WantedLevel] == 0)
{
PlayerData[i][TrackLose] = -1;
}
else
{
PlayerData[i][TrackLose] -= 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `TrackLose`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][TrackLose],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
if(PlayerData[i][TrackLose] == 0)
{
PlayerData[i][WantedLevel] -= 1;
SetPlayerWantedLevel(i,PlayerData[i][WantedLevel]);
mysql_format(SQL, str,128,"UPDATE `users` SET `WantedLevel`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][WantedLevel],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
SendClientMessage(i, COLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose 1 wanted level.");
format(string, sizeof(string), "HQ: Suspect %s lose 1 wanted level, current wanted level: %d.", PlayerData[i][Name],PlayerData[i][WantedLevel]);
SendRadioMessage(1, 0x3350FFFF, string);
if(PlayerData[i][WantedLevel] == 0)
{
SendClientMessage(i, COLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose all stars.");
format(string, sizeof(string), "HQ: Suspect %s losed all wanted levels.", PlayerData[i][Name]);
SendRadioMessage(1, 0x3350FFFF, string);
PlayerData[i][MDC] = 0;
}
else
{
PlayerData[i][TrackLose] = 30;
}
}
}
if(IsPlayerPaused(i) == false && PlayerData[i][IsLoggedIn] == true && Sleeping[i] == 0)
{
PlayerData[i][Exp] += 1;
OnExp[i] += 1;
if(OnExp[i] >= 60)
{
new checks = PlayerData[i][Level] * 300;
new account = PlayerData[i][Bank];
new interest = account / 300;
PlayerData[i][Bank] += interest;
if(PlayerData[i][FPunish] > 0) PlayerData[i][FPunish] -= 1;
SendClientMessage(i, COLOR_WHITE, "________ BANK STATEMENT ________");
format(string, sizeof(string), " Paycheck: $%s", Decimal(checks));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " Old Balance: $%s | Interest rate: 0.1%%", Decimal(account));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " New balance: $%s", Decimal(PlayerData[i][Bank]));
SendClientMessage(i, COLOR_GRAD5, string);
GivePlayerCash(i, checks);
mysql_format(SQL, str,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
OnExp[i] = 0;
}
PlayerData[i][TotalExp] += 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
if(PlayerData[i][CarLic] > 0) PlayerData[i][CarLic] -= 1;
if(PlayerData[i][FlyLic] > 0) PlayerData[i][FlyLic] -= 1;
if(PlayerData[i][BoatLic] > 0) PlayerData[i][BoatLic] -= 1;
if(PlayerData[i][FishLic] > 0) PlayerData[i][FishLic] -= 1;
if(PlayerData[i][GunLic] > 0) PlayerData[i][GunLic] -= 1;
if(PlayerData[i][MatsLic] > 0) PlayerData[i][MatsLic] -= 1;
if(PlayerData[i][CarLic] == 10) SendClientMessage(i, RED, "WARNING: Your driving license will expire in 10 minutes.");
if(PlayerData[i][FlyLic] == 10) SendClientMessage(i, RED, "WARNING: Your flying license will expire in 10 minutes.");
if(PlayerData[i][BoatLic] == 10) SendClientMessage(i, RED, "WARNING: Your sailing license will expire in 10 minutes.");
if(PlayerData[i][FishLic] == 10) SendClientMessage(i, RED, "WARNING: Your fishing license will expire in 10 minutes.");
if(PlayerData[i][GunLic] == 10) SendClientMessage(i, RED, "WARNING: Your weapon license will expire in 10 minutes.");
if(PlayerData[i][MatsLic] == 10) SendClientMessage(i, RED, "WARNING: Your materials license will expire in 10 minutes.");
mysql_format(SQL, str, 128, "UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
new XPneed = GetXPPoints(i);
if(Allowed[i] == 0)
{
format(string, 100, "%d / %d XP", PlayerData[i][Exp], XPneed);
PlayerTextDrawSetString(i, XPRemain, string);
format(string, 100, "Time Left: %d min", XPneed-PlayerData[i][Exp]);
PlayerTextDrawSetString(i, XPTLeft, string);
format(string, 100, "Level: %d (%d XP)", PlayerData[i][Level],PlayerData[i][TotalExp]);
PlayerTextDrawSetString(i, XPTotal, string);
new Float:percent;
percent = ((PlayerData[i][Exp] * 100) / XPneed);
SetPlayerProgressBarValue(i, barxp, percent);
HidePlayerProgressBar(i, barxp);
ShowPlayerProgressBar(i, barxp);
}
if(PlayerData[i][Exp] >= XPneed)
{//Level Up
PlayerData[i][Level] += 1;
SetPlayerScore(i, PlayerData[i][Level]);
new money;
if(PlayerData[i][Level] < 8 && PlayerData[i][Level] > 0) money = PlayerData[i][Level] * 1500;
else money = PlayerData[i][Level] * 500;
GivePlayerCash(i, money);
format(string, sizeof(string), "You recieve %d money for level up.", money);
SendClientMessage(i, COLOR_WHITE, string);
PlayerData[i][Exp] = 0;
mysql_format(SQL, str, 256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
}
if(Sleeping[i] == 1)
{
SleepXP[i] += 1;
if(SleepXP[i] == 5)
{
PlayerData[i][Exp] += 1;
OnExp[i] += 1;
if(OnExp[i] >= 120)
{
new checks = PlayerData[i][Level] * 300;
new account = PlayerData[i][Bank];
new interest = account / 300;
PlayerData[i][Bank] += interest;
if(PlayerData[i][FPunish] > 0) PlayerData[i][FPunish] -= 1;
SendClientMessage(i, COLOR_WHITE, "________ BANK STATEMENT ________");
format(string, sizeof(string), " Paycheck: $%s", Decimal(checks));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " Old Balance: $%s | Interest rate: 0.1%%", Decimal(account));
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " New balance: $%s", Decimal(PlayerData[i][Bank]));
SendClientMessage(i, COLOR_GRAD5, string);
GivePlayerCash(i, checks);
mysql_format(SQL, str,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
OnExp[i] = 0;
}
PlayerData[i][TotalExp] += 1;
mysql_format(SQL, str,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
if(PlayerData[i][CarLic] > 0) PlayerData[i][CarLic] -= 1;
if(PlayerData[i][FlyLic] > 0) PlayerData[i][FlyLic] -= 1;
if(PlayerData[i][BoatLic] > 0) PlayerData[i][BoatLic] -= 1;
if(PlayerData[i][FishLic] > 0) PlayerData[i][FishLic] -= 1;
if(PlayerData[i][GunLic] > 0) PlayerData[i][GunLic] -= 1;
if(PlayerData[i][MatsLic] > 0) PlayerData[i][MatsLic] -= 1;
if(PlayerData[i][CarLic] == 10) SendClientMessage(i, RED, "WARNING: Your driving license will expire in 10 minutes.");
if(PlayerData[i][FlyLic] == 10) SendClientMessage(i, RED, "WARNING: Your flying license will expire in 10 minutes.");
if(PlayerData[i][BoatLic] == 10) SendClientMessage(i, RED, "WARNING: Your sailing license will expire in 10 minutes.");
if(PlayerData[i][FishLic] == 10) SendClientMessage(i, RED, "WARNING: Your fishing license will expire in 10 minutes.");
if(PlayerData[i][GunLic] == 10) SendClientMessage(i, RED, "WARNING: Your weapon license will expire in 10 minutes.");
if(PlayerData[i][MatsLic] == 10) SendClientMessage(i, RED, "WARNING: Your materials license will expire in 10 minutes.");
mysql_format(SQL, str, 128, "UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
mysql_format(SQL, str, 128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
new XPneed = GetXPPoints(i);
if(Allowed[i] == 0)
{
format(string, 100, "%d / %d XP", PlayerData[i][Exp], XPneed);
PlayerTextDrawSetString(i, XPRemain, string);
format(string, 100, "Time Left: %d min", XPneed-PlayerData[i][Exp]);
PlayerTextDrawSetString(i, XPTLeft, string);
format(string, 100, "Level: %d (%d XP)", PlayerData[i][Level],PlayerData[i][TotalExp]);
PlayerTextDrawSetString(i, XPTotal, string);
new Float:percent;
percent = ((PlayerData[i][Exp] * 100) / XPneed);
SetPlayerProgressBarValue(i, barxp, percent);
HidePlayerProgressBar(i, barxp);
ShowPlayerProgressBar(i, barxp);
}
if(PlayerData[i][Exp] >= XPneed)
{//Level Up
PlayerData[i][Level] += 1;
SetPlayerScore(i, PlayerData[i][Level]);
new money;
if(PlayerData[i][Level] < 8 && PlayerData[i][Level] > 0) money = PlayerData[i][Level] * 1500;
else money = PlayerData[i][Level] * 500;
GivePlayerCash(i, money);
format(string, sizeof(string), "You recieve %d money for level up.", money);
SendClientMessage(i, COLOR_WHITE, string);
PlayerData[i][Exp] = 0;
mysql_format(SQL, str, 256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
mysql_tquery(SQL, str, "", "");
}
SleepXP[i] = 0;
}
}
}
}
function OtherTimer()
{
new str[128], string[128];
//new username[MAX_PLAYER_NAME];
foreach(Player, i)
{
/*if(IsPlayerConnected(i))
{
GetPlayerName(i,username,sizeof(username));
new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
if((distanta[i] > 65.0) && (PlayerData[i][Admin] == 0)) // IsLoggedIn
{
//format(string,sizeof(string), "TeleportHack: Este posibil ca %s(id:%d)sa aibe teleport hack, distanta teleportata %f(puneti-va spec).",username,i,distanta[i]);
//ABroadCast(RED,string,1);
}
} */
if (PlayerToPoint(2.0, i, 2486.5198,-1645.2394,14.0772))
{
GameTextForPlayer(i, "~w~HQ Groove St. 125", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1172.4932,-1323.3479,15.4030))
{
GameTextForPlayer(i, "~w~HQ Emergency Dept.", 5000, 1);
}
if (PlayerToPoint(2.0, i, 755.3737,-1362.3281,13.5131))
{
GameTextForPlayer(i, "~w~HQ SAN Network", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1653.7765,-1655.5151,22.5156))
{
GameTextForPlayer(i, "~w~HQ SA Gov", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1899.4996,-2005.1289,13.5469))
{
GameTextForPlayer(i, "~w~HQ Varrio Nuevo Estrada", 5000, 1);
}
if (PlayerToPoint(2.0, i, 2000.0482,-1114.3588,27.1250))
{
GameTextForPlayer(i, "~w~HQ Ballas", 5000, 1);
}
if(PlayerData[i][IsLoggedIn] == false && ByPASS[i] == 0)
{
if (AFKLoggin[i] != -1)
{
AFKLoggin[i] -= 1;
if(AFKLoggin[i] == 0)
{
SendClientMessage(i, COLOR_LIGHTRED, "** You haven't login in 40 seconds (Kicked) **");
KickEx(i);
}
}
}
if(PlayerData[i][Cash] != GetPlayerMoney(i))//
{
new hack = GetPlayerMoney(i) - PlayerData[i][Cash];
if(hack!=0)
{
ResetMoneyBar(i);
UpdateMoneyBar(i,PlayerData[i][Cash]);
}
}
new Float: oldX[MAX_PLAYERS], Float: oldY[MAX_PLAYERS], Float: oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
if(distanta[i] == 0) PlayerAFK[i] = 1;
else PlayerAFK[i] = 0;
//new faction = PlayerData[i][Member] + PlayerData[i][Leader];
if(PlayerData[i][Muted] > 0)
{
if(PlayerData[i][MutedTime] > 0) PlayerData[i][MutedTime] -= 1;
if(PlayerData[i][MutedTime] <= 0)
{
PlayerData[i][MutedTime] = 0;
PlayerData[i][Muted] = 0;
mysql_format(SQL,str,128,"UPDATE `users` SET `Muted`='0', `MutedTime`='0' WHERE `id`='%d'", PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
SendClientMessage(i, 0xFFFF00AA, "* Your time of silence has ended.");
format(string, 128, "Mute time has ended!");
GameTextForPlayer(i, string, 5000, 1);
}
}
if(PlayerData[i][PlayerCuffed] > 1)
{
PlayerData[i][PlayerCuffed] -= 1;
if(PlayerData[i][PlayerCuffed] == 0)
{
GameTextForPlayer(i, "~r~You broke the Cuffs, you are free!", 2500, 3);
TogglePlayerControllable(i, 1);
PlayerData[i][PlayerCuffed] = 0;
}
}
if(PlayerData[i][Jailed] == 1)
{
if(PlayerData[i][JailTime] > 0) PlayerData[i][JailTime] -= 1;
mysql_format(SQL,str,128,"UPDATE `users` SET `JailTime`='%d' WHERE `id`='%d'", PlayerData[i][JailTime], PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
if(PlayerData[i][JailTime] <= 0)
{
PlayerData[i][JailTime] = 0;
PlayerData[i][Jailed] = 0;
mysql_format(SQL,str,128,"UPDATE `users` SET `Jailed`='0', `JailTime`='0' WHERE `id`='%d'", PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
SpawnPlayer(i);
}
}
if(PlayerData[i][PlayerToFind] >= 0)
{
new id = PlayerData[i][PlayerToFind];
if(PlayerData[id][InBizz] == -1 && PlayerData[id][InHouse] == -1 && PlayerData[id][InHQ] == -1)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(id, X,Y,Z);
SetPlayerCheckpoint(i, X,Y,Z, 3);
}
else
{
if(PlayerData[id][InBizz] > -1)
{
new biz = PlayerData[id][InBizz];
SetPlayerCheckpoint(i, BizzInfo[biz][bEntranceX],BizzInfo[biz][bEntranceY],BizzInfo[biz][bEntranceZ], 3);
}
else if(PlayerData[id][InHouse] > -1)
{
new house = PlayerData[id][InHouse];
SetPlayerCheckpoint(i, HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez], 3);
}
else if(PlayerData[id][InHQ] == 2) { SetPlayerCheckpoint(i, 2486.5198,-1645.2394,14.0772, 3); }
else if(PlayerData[id][InHQ] == 3) { SetPlayerCheckpoint(i, 2000.0482,-1114.3588,27.1250, 3); }
else if(PlayerData[id][InHQ] == 4) { SetPlayerCheckpoint(i, 1899.4996,-2005.1289,13.5469, 3); }
else if(PlayerData[id][InHQ] == 5) { SetPlayerCheckpoint(i, 1653.7765,-1655.5151,22.5156, 3); }
else if(PlayerData[id][InHQ] == 6) { SetPlayerCheckpoint(i, 755.3737,-1362.3281,13.5131, 3); }
else if(PlayerData[id][InHQ] == 7) { SetPlayerCheckpoint(i, 1172.4932,-1323.3479,15.4030, 3); }
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && PlayerData[i][Speedlimit])
{//Speedlimit
new a, b, c;
GetPlayerKeys(i, a, b ,c);
new speed = PlayerData[i][Speed];
if(a == 8 && speed > PlayerData[i][Speedlimit])
{
new newspeed = speed - PlayerData[i][Speedlimit];
ModifyVehicleSpeed(GetPlayerVehicleID(i), -newspeed);
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new speed=GetPlayerSpeed(i,0);
new string23[256],sendername[25];
GetPlayerName(i,sendername,sizeof(sendername));
if(speed>230)
{
format(string23, 256, "SpeedHack: %s(id:%d) conduce cu %.0d km/h folosind un %s(puneti-va spec).", sendername,i,speed,vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
ABroadCast(RED,string23,1);
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i))
{//Radar
if(PlayerData[i][RadarUse] > 0)
{
new Float:x1, Float:y1, Float:z1;
GetPlayerPos(i,x1,y1,z1);
foreach(Player, o)
{
if(o != i)
{
if(IsPlayerInRangeOfPoint(o, 20, x1,y1,z1))
{
new factiono = PlayerData[o][Member] + PlayerData[o][Leader];
new speed = PlayerData[o][Speed];
if(speed >= PlayerData[i][RadarUse] && GetPlayerState(o) == PLAYER_STATE_DRIVER)
{
if(factiono != 1 || PlayerData[o][OnDuty] == 0)
{
format(string, sizeof(string), "%s(%d) is driving with %.0d km/h, Radar Limit: %d km/h!",PlayerData[o][Name],o,speed,PlayerData[i][RadarUse]);
SendClientMessage(i, COLOR_REDD, string);
format(string, sizeof(string), "You were caught by %s's(%d) radar with %.0d km/h, Radar Limit: %d km/h!",PlayerData[i][Name],i,speed,PlayerData[i][RadarUse]);
SendClientMessage(o, COLOR_REDD, string);
}
}
}
}
}
if(PlayerData[i][Speed] > 1)
{
PlayerData[i][RadarUse] = 0;
SendClientMessage(i, COLOR_LIGHTBLUE2, "You stopped your radar.");
}
}
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && PlayerData[i][Admin] < 1)
{
new reasonn[64];
format(reasonn,sizeof(reasonn),"Jetpack");
BanA(i,"AdmBot",reasonn,0,0,1);
}
}
}
function Spectator()
{
new string[256];
foreach(Player, i)
{
if(PlayerData[i][Spectate] >= 0)
{
SetPlayerColor(i,COLOR_SPEC);
new targetid = PlayerData[i][Spectate];
if(IsPlayerConnected(targetid))
{
if(PlayerData[i][Admin] >= 1)
{
new Float:health;
new name[MAX_PLAYER_NAME];
GetPlayerName(targetid, name, sizeof(name));
GetPlayerHealth(targetid, health);
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER)
{
new Float:Valoarea;
new carid = GetPlayerVehicleID(targetid);
GetVehicleHealth(carid,Valoarea);
TextDrawHideForPlayer(i, TextDrawSpec[i][1]); TextDrawHideForPlayer(i, TextDrawSpec[i][2]); TextDrawHideForPlayer(i, TextDrawSpec[i][3]); TextDrawHideForPlayer(i, TextDrawSpec[i][4]);
format(string, sizeof(string), "~y~%s (%d)", name, targetid);
TextDrawSetString(TextDrawSpec[i][1], string);
format(string, sizeof(string), "Health:~r~ %.1f", health);
TextDrawSetString(TextDrawSpec[i][2], string);
format(string, sizeof(string), "Vehicle ID:~r~ %d", carid);
TextDrawSetString(TextDrawSpec[i][3], string);
format(string, sizeof(string), "Vehicle Health:~r~ %.1f", Valoarea);
TextDrawSetString(TextDrawSpec[i][4], string);
TextDrawShowForPlayer(i, TextDrawSpec[i][1]); TextDrawShowForPlayer(i, TextDrawSpec[i][2]); TextDrawShowForPlayer(i, TextDrawSpec[i][3]); TextDrawShowForPlayer(i, TextDrawSpec[i][4]);
}
else
{
//format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s[ID:%d]~n~~w~Health:~r~%.1f",name,targetid,health);
TextDrawHideForPlayer(i, TextDrawSpec[i][1]); TextDrawHideForPlayer(i, TextDrawSpec[i][2]); TextDrawHideForPlayer(i, TextDrawSpec[i][3]); TextDrawHideForPlayer(i, TextDrawSpec[i][4]);
format(string, sizeof(string), "~y~%s (%d)", name, targetid);
TextDrawSetString(TextDrawSpec[i][1], string);
format(string, sizeof(string), "Health:~r~ %.1f", health);
TextDrawSetString(TextDrawSpec[i][2], string);
TextDrawShowForPlayer(i, TextDrawSpec[i][1]); TextDrawShowForPlayer(i, TextDrawSpec[i][2]);
}
//GameTextForPlayer(i, string, 2500, 4);
}
}//Targetid connected
else
{
TextDrawHideForPlayer(i, TextDrawSpec[i][1]); TextDrawHideForPlayer(i, TextDrawSpec[i][2]); TextDrawHideForPlayer(i, TextDrawSpec[i][3]); TextDrawHideForPlayer(i, TextDrawSpec[i][4]);
}
}
if(PlayerData[i][Spectate] == -2)
{
PlayerData[i][Spectate] = -1;
TogglePlayerControllable(i, 1);
TogglePlayerSpectating(i, 0);
SpawnPlayer(i);
SetPlayerFColor(i);
TextDrawHideForPlayer(i, TextDrawSpec[i][1]);
TextDrawHideForPlayer(i, TextDrawSpec[i][2]);
TextDrawHideForPlayer(i, TextDrawSpec[i][3]);
TextDrawHideForPlayer(i, TextDrawSpec[i][4]);
TextDrawHideForPlayer(i, TextDrawSpec[i][1]);
TextDrawHideForPlayer(i, TextDrawSpec[i][2]);
TextDrawHideForPlayer(i, TextDrawSpec[i][3]);
TextDrawHideForPlayer(i, TextDrawSpec[i][4]);
}
}
}
function TimerAntiCheat()
{
foreach(Player, i)
{
new string24[256],sendername[25];
GetPlayerName(i,sendername,sizeof(sendername));
new Float:health;
GetPlayerHealth(i,health);
if (health > 98.0)
{
format(string24,sizeof(string24), "HealthHack: Este posibil ca %s(id:%d)sa aibe hack de viata(puneti-va spec).",sendername,i);
ABroadCast(RED,string24,1);
}
new string25[256],username[25];
GetPlayerName(i,username,sizeof(username));
new Float:armour;
GetPlayerArmour(i, armour);
if (armour > 98.0)
{
format(string25,sizeof(string25), "ArmourHack: Este posibil ca %s(id:%d)sa aibe hack de armura(puneti-va spec).",username,i);
ABroadCast(RED,string25,1);
}
}
}