18.05.2018, 12:44
Hey.
log:
"SecondTimer()"
Also there is a bug in this function which is used under "SecondTimer" but when i commented it , no effects took place.
It is supposed to add 1 value to the "AFKTime" each second, but IDK why doesn't it do that.
log:
Quote:
[11:26:02] [debug] AMX backtrace: [11:26:02] [debug] #0 000895d4 in public SecondTimer () from asd.amx [11:26:02] [debug] Run time error 4: "Array index out of bounds" [11:26:02] [debug] Attempted to read/write array element at negative index -1 |
PHP код:
forward SecondTimer();
public SecondTimer()
{
new hour, minute, boomboxid, string[128];
gettime(hour, minute);
if((gGMX) && mysql_unprocessed_queries(connectionID) == 0)
{
SendRconCommand("gmx");
}
foreach(new i : Player)
{
SetPlayerTime(i, hour, minute);
if(PlayerInfo[i][pLogged] && !PlayerInfo[i][pKicked])
{
AFKCheck(i);
//NOPCheck(i);
if(PlayerInfo[i][pSpamTime] > 0)
{
PlayerInfo[i][pSpamTime]--;
}
if(PlayerInfo[i][pVehicleCount] > 0)
{
PlayerInfo[i][pVehicleCount]--;
}
if(PlayerInfo[i][pMechanicCall] > 0)
{
PlayerInfo[i][pMechanicCall]--;
}
if(PlayerInfo[i][pTaxiCall] > 0)
{
PlayerInfo[i][pTaxiCall]--;
}
if(PlayerInfo[i][pEmergencyCall] > 0)
{
PlayerInfo[i][pEmergencyCall]--;
}
if(PlayerInfo[i][pCourierCooldown] > 0)
{
PlayerInfo[i][pCourierCooldown]--;
}
if(PlayerInfo[i][pPizzaCooldown] > 0)
{
PlayerInfo[i][pPizzaCooldown]--;
}
if(PlayerInfo[i][pDetectiveCooldown] > 0)
{
PlayerInfo[i][pDetectiveCooldown]--;
}
if(PlayerInfo[i][pThiefCooldown] > 0)
{
PlayerInfo[i][pThiefCooldown]--;
}
if(PlayerInfo[i][pCocaineCooldown] > 0)
{
PlayerInfo[i][pCocaineCooldown]--;
}
if(PlayerInfo[i][pACFired] > 0)
{
PlayerInfo[i][pACFired]--;
}
if(PlayerInfo[i][pRapidFire] > 0)
{
PlayerInfo[i][pRapidFire]--;
}
if(PlayerInfo[i][pGodmode] > 0)
{
PlayerInfo[i][pGodmode]--;
}
if(PlayerInfo[i][pPreviewHouse] >= 0)
{
PlayerInfo[i][pPreviewTime]--;
if(PlayerInfo[i][pPreviewTime] <= 0 && GetPlayerInterior(i) == houseInteriors[PlayerInfo[i][pPreviewType]][intID])
{
SetPlayerPos(i, HouseInfo[PlayerInfo[i][pPreviewHouse]][hIntX], HouseInfo[PlayerInfo[i][pPreviewHouse]][hIntY], HouseInfo[PlayerInfo[i][pPreviewHouse]][hIntZ]);
SetPlayerFacingAngle(i, HouseInfo[PlayerInfo[i][pPreviewHouse]][hIntA]);
SetPlayerInterior(i, HouseInfo[PlayerInfo[i][pPreviewHouse]][hInterior]);
SetPlayerVirtualWorld(i, HouseInfo[PlayerInfo[i][pPreviewHouse]][hWorld]);
SetCameraBehindPlayer(i);
PlayerInfo[i][pPreviewHouse] = -1;
PlayerInfo[i][pPreviewType] = 0;
PlayerInfo[i][pPreviewTime] = 0;
SendClientMessage(i, COLOR_WHITE, "You are no longer previewing the interior as the time period ran out.");
}
}
if(PlayerInfo[i][pLoopAnim] && !PlayerInfo[i][pToggleTextdraws]) {
TextDrawShowForPlayer(i, AnimationTD);
} else {
TextDrawHideForPlayer(i, AnimationTD);
}
if(GetPlayerSurfingVehicleID(i) != INVALID_PLAYER_ID && GetPlayerState(i) == PLAYER_STATE_ONFOOT && !IsSurfVehicle(GetPlayerSurfingVehicleID(i)) && !PlayerInfo[i][pAdminDuty] && GetVehicleSpeed(GetPlayerSurfingVehicleID(i)) > 40)
{
new
Float:x,
Float:y,
Float:z;
SendProximityMessage(i, 20.0, COLOR_PURPLE, "** %s slipped off the top of the vehicle.", GetPlayerRPName(i));
GetPlayerPos(i, x, y, z);
SetPlayerPos(i, x + 1, y, z + 3.0);
ApplyAnimation(i, "PED", "BIKE_fallR", 4.1, 0, 1, 1, 0, 0);
}
if(PlayerInfo[i][pShipment] >= 0)
{
if((GetPlayerState(i) == PLAYER_STATE_DRIVER) && (GetVehicleModel(GetPlayerVehicleID(i)) != 414 && GetVehicleModel(GetPlayerVehicleID(i)) != 498))
{
PlayerInfo[i][pShipment] = -1;
SendClientMessage(i, COLOR_GREY, "Shipment cancelled. You went into another vehicle.");
}
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_DRINK_BEER || GetPlayerSpecialAction(i) == SPECIAL_ACTION_DRINK_WINE)
{
if(GetPlayerDrunkLevel(i) > 7000)
{
Awardh(i, "Party hard");
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(IsNearSpeedCam(i) && PlayerInfo[i][pSpeedTicketAllowed] == 0)
{
new speedcamID = Speed_Nearest(i);
if(GetVehicleSpeed(GetPlayerVehicleID(i)) > SpeedData[speedcamID][speedLimit] )
{
SendClientMessage(i, COLOR_AQUA, "**You have been spotted by a speed camera, You have been issued a fine of 1500$");
AddToTaxVault(1500);
GivePlayerCash(i, -1500);
PlayerInfo[i][pSpeedTicketAllowed] = 1;
}
}
}
if(PlayerInfo[i][pPizzas] > 0 && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(i)) == 448)
{
if(PlayerInfo[i][pPizzaTime] < 90)
{
PlayerInfo[i][pPizzaTime]++;
}
}
else
{
PlayerInfo[i][pPizzas] = 0;
PlayerInfo[i][pCP] = 0;
DisablePlayerCheckpoint(i);
SendClientMessage(i, COLOR_GREY, "Pizza delivery cancelled. You went into another vehicle.");
}
}
else if (PlayerInfo[i][pGraffiti] != -1 && PlayerInfo[i][pGraffitiTime] > 0)
{
if (Graffiti_Nearest(i) != PlayerInfo[i][pGraffiti])
{
PlayerInfo[i][pGraffiti] = -1;
PlayerInfo[i][pGraffitiTime] = 0;
}
else
{
PlayerInfo[i][pGraffitiTime]--;
if (PlayerInfo[i][pGraffitiTime] < 1)
{
new str[500];
strunpack(str, PlayerInfo[i][pGraffitiText]);
format(GraffitiData[PlayerInfo[i][pGraffiti]][graffitiText], 64, str);
GraffitiData[PlayerInfo[i][pGraffiti]][graffitiColor] = PlayerInfo[i][pGraffitiColor];
Graffiti_Refresh(PlayerInfo[i][pGraffiti]);
Graffiti_Save(PlayerInfo[i][pGraffiti]);
ClearAnimations(i, 1);
SendProximityMessage(i, 30.0, COLOR_PURPLE, "** %s puts their can of spray paint away.", GetPlayerRPName(i));
PlayerInfo[i][pGraffiti] = -1;
PlayerInfo[i][pGraffitiTime] = 0;
}
}
}
if(!PlayerInfo[i][pToggleTextdraws])
{
if(PlayerInfo[i][pGPSOn])
{
PlayerTextDrawSetString(i, PlayerInfo[i][pText][0], GetPlayerZoneName(i));
}
}
/*if(NetStats_PacketLossPercent(i) > 20.0 && gettime() - PlayerInfo[i][pLastDesync] > 120)
{
GameTextForPlayer(i, "You are desynced. Please relog once you see this message.", 10000, 6);
PlayerInfo[i][pLastDesync] = gettime();
}*/
if(PlayerInfo[i][pSpectating] != INVALID_PLAYER_ID)
{
if(GetPlayerInterior(i) != GetPlayerInterior(PlayerInfo[i][pSpectating])) SetPlayerInterior(i, GetPlayerInterior(PlayerInfo[i][pSpectating]));
if(GetPlayerVirtualWorld(i) != GetPlayerVirtualWorld(PlayerInfo[i][pSpectating])) SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(PlayerInfo[i][pSpectating]));
}
if(PlayerInfo[i][pTutorial])
{
TogglePlayerControllable(i, 0);
}
if(PlayerInfo[i][pAwaitingClothing])
{
SetPlayerClothing(i);
}
if(PlayerInfo[i][pDraggedBy] != INVALID_PLAYER_ID)
{
TeleportToPlayer(i, PlayerInfo[i][pDraggedBy]);
}
if(PlayerInfo[i][pVIPPackage] > 0 && gettime() > PlayerInfo[i][pVIPTime])
{
PlayerInfo[i][pVIPPackage] = 0;
PlayerInfo[i][pVIPTime] = 0;
//PlayerInfo[i][pSecondJob] = -1;
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET vippackage = 0, viptime = 0, secondjob = -1 WHERE uid = %i", PlayerInfo[i][pID]);
mysql_tquery(connectionID, queryBuffer);
SendClientMessage(i, COLOR_LIGHTRED, "Your VIP subscription has expired. You are no longer a VIP.");
}
if(PlayerInfo[i][pVIPPackage] < 2 && PlayerInfo[i][pSecondJob] != JOB_NONE)
{
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET secondjob = -1 WHERE uid = %i", PlayerInfo[i][pID]);
mysql_tquery(connectionID, queryBuffer);
PlayerInfo[i][pSecondJob] = JOB_NONE;
SendClientMessage(i, COLOR_LIGHTRED, "Your second job has been removed as you aren't a Gold+ VIP.");
}
if(PlayerInfo[i][pHHCheck])
{
if(PlayerInfo[i][pHHTime] > 0)
{
new health = GetPlayerHealthEx(i);
if(health == PlayerInfo[i][pHHRounded])
{
PlayerInfo[i][pHHCount]++;
}
SetPlayerHealth(i, random(100) + 1);
PlayerInfo[i][pHHTime]--;
PlayerInfo[i][pHHRounded] = health;
}
else
{
if(gettime() - PlayerInfo[i][pLastUpdate] >= 3)
{
SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s[%i] failed the health hack check as they tabbed.", GetPlayerRPName(i), i);
}
else if(PlayerInfo[i][pHHCount] > 0)
{
SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s[%i] is possibly health hacking with a %i percent chance.", GetPlayerRPName(i), i, PlayerInfo[i][pHHCount] * 20);
}
else
{
SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s[%i] does not appear to be health hacking.", GetPlayerRPName(i), i);
}
if(NetStats_PacketLossPercent(i) > 10.0)
{
SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s[%i] is desynced and has a packet loss of %.1f percent.", GetPlayerRPName(i), i, NetStats_PacketLossPercent(i));
}
SetPlayerHealth(i, PlayerInfo[i][pHealth]);
PlayerInfo[i][pHHCheck] = 0;
}
}
if(PlayerInfo[i][pReceivingAid] && !PlayerInfo[i][pHHCheck])
{
new
Float:health;
GetPlayerHealth(i, health);
if((health + 1.0) > 100.0)
{
SetPlayerHealth(i, 100.0);
PlayerInfo[i][pReceivingAid] = 0;
}
else
{
SetPlayerHealth(i, health + 1.0);
}
}
if(PlayerInfo[i][pInjured] && IsPlayerInAnyVehicle(i) && GetVehicleModel(GetPlayerVehicleID(i)) != 416)
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(i, x, y, z);
SetPlayerPos(i, x, y, z + 0.5);
ClearAnimations(i);
}
if(PlayerInfo[i][pTazedTime] > 0)
{
PlayerInfo[i][pTazedTime]--;
if(!PlayerInfo[i][pTazedTime])
{
ClearAnimations(i, 1);
if(!PlayerInfo[i][pCuffed])
{
TogglePlayerControllable(i, 1);
}
}
}
if(PlayerInfo[i][pFishTime] > 0)
{
PlayerInfo[i][pFishTime]--;
if(!IsPlayerAtFishingPlace(i))
{
ClearAnimations(i, 1);
RemovePlayerAttachedObject(i, 9);
PlayerInfo[i][pFishTime] = 0;
}
else if(PlayerInfo[i][pFishTime] <= 0 && IsPlayerAtFishingPlace(i))
{
new rand = Random(1, 100);
if(1 <= rand <= 20)
{
SendClientMessage(i, COLOR_GREY, "You reeled in your line and caught nothing...");
}
else if(21 <= rand <= 30)
{
new amount = 50 + random(100);
SendClientMessageEx(i, COLOR_AQUA, "You reeled in your line and caught a used wallet with {00AA00}$%i{33CCFF} inside.", amount);
GivePlayerCash(i, amount);
}
else if(98 <= rand <= 99)
{
new amount = random(2000) + 1000;
SendClientMessageEx(i, COLOR_AQUA, "You reeled in your line and caught a rare 18th century coin valued at {00AA00}$%i{33CCFF}!", amount);
GivePlayerCash(i, amount);
}
else
{
new weight, level = GetJobLevel(i, JOB_FISHERMAN);
if(PlayerInfo[i][pUsedBait]) {
weight = random(40) + (level * 10);
} else {
weight = random(15) + (level * 10);
}
SendClientMessageEx(i, COLOR_AQUA, "You reeled in your line and caught a fish weighing %i kg!", weight);
PlayerInfo[i][pFishWeight] += weight;
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET fishweight = %i WHERE uid = %i", PlayerInfo[i][pFishWeight], PlayerInfo[i][pID]);
mysql_tquery(connectionID, queryBuffer);
IncreaseJobSkill(i, JOB_FISHERMAN);
if(PlayerInfo[i][pFishWeight] >= 1500)
{
SendClientMessage(i, COLOR_YELLOW, "You have too much fish. You can continue fishing once you sell your load.");
}
}
ClearAnimations(i, 1);
RemovePlayerAttachedObject(i, 9);
}
}
if(PlayerInfo[i][pJailType] > 0)
{
PlayerInfo[i][pJailTime]--;
if(PlayerInfo[i][pJailTime] <= 0)
{
ResetPlayerWeaponsEx(i);
SendClientMessage(i, COLOR_GREY2, "Your jail sentence has expired.");
SetPlayerPos(i, 1544.4407, -1675.5522, 13.5584);
SetPlayerFacingAngle(i, 90.0000);
SetPlayerInterior(i, 0);
SetPlayerVirtualWorld(i, 0);
SetCameraBehindPlayer(i);
PlayerInfo[i][pJailType] = 0;
PlayerInfo[i][pJailTime] = 0;
}
}
if(PlayerInfo[i][pEditType] > 0 && IsValidDynamicObject(PlayerInfo[i][pEditObject]) && !IsPlayerInRangeOfDynamicObject(i, PlayerInfo[i][pEditObject], 50.0))
{
if(PlayerInfo[i][pEditType] == EDIT_FURNITURE_PREVIEW)
{
SendClientMessage(i, COLOR_GREY2, "You left the editing area. Furniture previewing cancelled.");
DestroyDynamicObject(PlayerInfo[i][pEditObject]);
}
else if(PlayerInfo[i][pEditType] == EDIT_FURNITURE)
{
ReloadFurniture(PlayerInfo[i][pEditObject], HouseInfo[PlayerInfo[i][pFurnitureHouse]][hLabels]);
SendClientMessage(i, COLOR_GREY2, "You left the editing area. Editing mode has been disabled.");
}
else if(PlayerInfo[i][pEditType] == EDIT_LAND_OBJECT)
{
ReloadLandObject(PlayerInfo[i][pEditObject], LandInfo[PlayerInfo[i][pObjectLand]][lLabels]);
SendClientMessage(i, COLOR_GREY2, "You left the editing area. Editing mode has been disabled.");
}
else if(PlayerInfo[i][pEditType] == EDIT_LAND_OBJECT_PREVIEW)
{
SendClientMessage(i, COLOR_GREY2, "You left the editing area. Furniture previewing cancelled.");
DestroyDynamicObject(PlayerInfo[i][pEditObject]);
}
CancelEdit(i);
PlayerInfo[i][pEditType] = 0;
PlayerInfo[i][pEditObject] = INVALID_OBJECT_ID;
}
if(PlayerInfo[i][pHospital] && PlayerInfo[i][pHospitalTime])
{
PlayerInfo[i][pHospitalTime]--;
if(PlayerInfo[i][pHospitalTime] == 0)
{
if(PlayerInfo[i][pInsurance] > 0)
{
Awardh(i, "Obamacare");
}
SetPlayerPos(i, -10.4534, 149.3639, 999.0613);
SetPlayerFacingAngle(i, 180.0000);
SetPlayerInterior(i, 1);
SetPlayerVirtualWorld(i, PlayerInfo[i][pHospitalType]);
SetCameraBehindPlayer(i);
if(!(GetFactionType(i) == FACTION_POLICE || GetFactionType(i) == FACTION_MEDIC))
{
GivePlayerCash(i, -500);
GameTextForPlayer(i, "~w~Discharged~n~~r~-$500", 5000, 1);
}
TogglePlayerControllable(i, 1);
SetPlayerDrunkLevel(i, 0);
if(PlayerInfo[i][pDelivered])
{
if(GetFactionType(i) == FACTION_POLICE || GetFactionType(i) == FACTION_MEDIC)
SendClientMessage(i, COLOR_DOCTOR, "You have not been billed for your stay. You also keep all of your weapons!");
else
SendClientMessage(i, COLOR_DOCTOR, "You have been billed $500 for your stay. You also keep all of your weapons!");
PlayerInfo[i][pDelivered] = 0;
}
else
{
if(GetFactionType(i) == FACTION_POLICE || GetFactionType(i) == FACTION_MEDIC)
SendClientMessage(i, COLOR_DOCTOR, "You have not been billed for your stay. Your weapons have been confiscated by staff.");
else
SendClientMessage(i, COLOR_DOCTOR, "You have been billed $500 for your stay. Your weapons have been confiscated by staff.");
SendClientMessage(i, COLOR_LIGHTRED, "(( You have lost 30 minutes of your memory. ))");
}
new hospital[32];
switch(PlayerInfo[i][pHospitalType])
{
case HOSPITAL_COUNTY: strcat(hospital, "All Saints General");
case HOSPITAL_ALLSAINTS: strcat(hospital, "County General");
case HOSPITAL_FMDHQ: strcat(hospital, "FMD HQ");
}
foreach(new x : Player)
{
if(IsLawEnforcement(x))
{
SendClientMessageEx(x, COLOR_YELLOW, "LSFMD: Wanted suspect %s[%i] was last spotted at the %s hospital!", GetPlayerRPName(i), i, hospital);
}
}
SetPlayerHealth(i, PlayerInfo[i][pSpawnHealth]);
SetScriptArmour(i, PlayerInfo[i][pSpawnArmor]);
PlayerInfo[i][pHospital] = 0;
PlayerInfo[i][pHospitalTime] = 0;
}
else
{
GameTextForPlayer(i, "~w~Recovering...", 1500, 3);
SetPlayerDrunkLevel(i, 50000);
}
}
if(PlayerInfo[i][pRefuel] != INVALID_VEHICLE_ID)
{
PlayerInfo[i][pRefuelAmount] += 2;
vehicleFuel[PlayerInfo[i][pRefuel]]++;
if(vehicleFuel[PlayerInfo[i][pRefuel]] >= 100 || PlayerInfo[i][pCash] < PlayerInfo[i][pRefuelAmount])
{
AddPointMoney(POINT_FUEL, PlayerInfo[i][pRefuelAmount]);
GivePlayerCash(i, -PlayerInfo[i][pRefuelAmount]);
SendClientMessageEx(i, COLOR_AQUA, "You've refilled your vehicle's gas tank for {FF6347}$%i{33CCFF}.", PlayerInfo[i][pRefuelAmount]);
PlayerInfo[i][pRefuel] = INVALID_VEHICLE_ID;
PlayerInfo[i][pRefuelAmount] = 0;
}
}
if(PlayerInfo[i][pMiningTime] > 0)
{
PlayerInfo[i][pMiningTime]--;
if(PlayerInfo[i][pMiningTime] <= 0)
{
if(IsPlayerInMiningArea(i) && GetPlayerState(i) == PLAYER_STATE_ONFOOT && !PlayerInfo[i][pTazedTime] && !PlayerInfo[i][pCuffed])
{
new number = random(10) + 1;
PlayerInfo[i][pCP] = CHECKPOINT_MINING;
SetPlayerAttachedObject(i, 9, 3929, 1, 0.242999, 0.324000, 0.012000, -17.200078, 20.699993, 9.800034, 0.579999, 0.617999, 0.676999);
SetPlayerSpecialAction(i, SPECIAL_ACTION_CARRY);
ApplyAnimation(i, "CARRY", "liftup", 4.1, 0, 0, 0, 0, 0, 1);
SetPlayerCheckpoint(i, 1278.0778, -1267.9661, 12.5413, 2.0);
if(1 <= number <= 5)
{
PlayerInfo[i][pMiningRock] = 1;
SendClientMessage(i, COLOR_AQUA, "You have dug up an ordinary stone. Drop it off at the marker.");
}
else if(number == 6 && !PlayerInfo[i][pRareTime])
{
SendClientMessage(i, COLOR_AQUA, "Woah, this looks oddly weird to find in the middle of a city, lets show it to the boss.");
PlayerInfo[i][pMiningRock] = 3;
}
else
{
PlayerInfo[i][pMiningRock] = 2;
SendClientMessage(i, COLOR_AQUA, "You have dug up a quality stone. Drop it off at the marker.");
}
}
else
{
RemovePlayerAttachedObject(i, 9);
ClearAnimations(i, 1);
}
}
}
if(PlayerInfo[i][pSweeping] && GetVehicleModel(GetPlayerVehicleID(i)) == 574 && GetVehicleSpeed(GetPlayerVehicleID(i)) > 35.0 && !PlayerInfo[i][pAFK])
{
PlayerInfo[i][pSweepTime]--;
if(PlayerInfo[i][pSweepTime] <= 0)
{
new cost = 200 + random(50);
if(PlayerInfo[i][pLaborUpgrade] > 0)
{
cost += percent(cost, PlayerInfo[i][pLaborUpgrade]);
}
AddToPaycheck(i, cost);
format(string, sizeof(string), "~g~+$%i", cost);
GameTextForPlayer(i, string, 5000, 1);
PlayerInfo[i][pSweepEarnings] += cost;
PlayerInfo[i][pSweepTime] = 30;
}
}
if(PlayerInfo[i][pTaxiPassenger] != INVALID_PLAYER_ID)
{
if((GetVehicleModel(GetPlayerVehicleID(i)) != 420 && GetVehicleModel(GetPlayerVehicleID(i)) != 438) || !IsPlayerInVehicle(PlayerInfo[i][pTaxiPassenger], GetPlayerVehicleID(i)) || PlayerInfo[i][pTaxiFare] == 0 || PlayerInfo[PlayerInfo[i][pTaxiPassenger]][pCash] < PlayerInfo[i][pTaxiBill])
{
CancelTaxiRide(i);
}
else
{
PlayerInfo[i][pTaxiTime]++;
if(PlayerInfo[i][pTaxiTime] >= 15)
{
PlayerInfo[i][pTaxiTime] = 0;
PlayerInfo[i][pTaxiBill] += PlayerInfo[i][pTaxiFare];
}
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~Taxi Meter:~w~ $%i", PlayerInfo[i][pTaxiBill]);
GameTextForPlayer(i, string, 3000, 3);
}
}
if(PlayerInfo[i][pMuted] > 0)
{
PlayerInfo[i][pMuted]--;
if(PlayerInfo[i][pMuted] <= 0)
{
SendClientMessage(i, COLOR_GREY, "You are no longer muted.");
}
}
if(PlayerInfo[i][pCocaineTrunk] != INVALID_VEHICLE_ID)
{
if(!IsPlayerInRangeOfBoot(i, PlayerInfo[i][pCocaineTrunk]))
{
SendClientMessage(i, COLOR_GREY, "You are no longer cracking the trunk as you left your spot.");
PlayerInfo[i][pCocaineTrunk] = INVALID_VEHICLE_ID;
}
else if(VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vLocked])
{
SendClientMessage(i, COLOR_GREY, "You are no longer cracking the trunk as the vehicle is now locked.");
PlayerInfo[i][pCocaineTrunk] = INVALID_VEHICLE_ID;
}
else
{
PlayerInfo[i][pCocaineTime]--;
if(PlayerInfo[i][pCocaineTime] <= 0)
{
new count;
for(new x = 0; x < 5; x ++)
{
if(VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vWeapons][x] != 0)
{
count++;
}
}
if(count == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vCocaine] == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vMeth] == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vWeed] == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vPainkillers] == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vMaterials] == 0 && VehicleInfo[PlayerInfo[i][pCocaineTrunk]][vCash] == 0)
{
SendProximityMessage(i, 20.0, COLOR_PURPLE, "** %s cracks open the trunk of the %s and finds nothing.", GetPlayerRPName(i), GetVehicleName(PlayerInfo[i][pCocaineTrunk]));
}
else
{
PlayerInfo[i][pCocaineFrom] = PlayerInfo[i][pCocaineTrunk];
ShowDialogToPlayer(i, DIALOG_CRACKTRUNK);
}
switch(GetJobLevel(i, JOB_THIEF))
{
case 1: PlayerInfo[i][pCocaineCooldown] = 720;
case 2: PlayerInfo[i][pCocaineCooldown] = 600;
case 3: PlayerInfo[i][pCocaineCooldown] = 420;
case 4: PlayerInfo[i][pCocaineCooldown] = 300;
case 5: PlayerInfo[i][pCocaineCooldown] = 180;
}
IncreaseJobSkill(i, JOB_THIEF);
PlayerInfo[i][pCocaineTrunk] = INVALID_VEHICLE_ID;
}
else
{
format(string, sizeof(string), "~w~Cracking trunk... ~r~%i", PlayerInfo[i][pCocaineTime]);
GameTextForPlayer(i, string, 2000, 3);
}
}
}
if(PlayerInfo[i][pLootTime] > 0)
{
PlayerInfo[i][pLootTime]--;
if(IsPlayerInBankRobbery(i) && PlayerInfo[i][pLootTime] <= 0)
{
new amount = random(500) + 500;
ClearAnimations(i, 1);
PlayerInfo[i][pRobCash] += amount;
PlayerInfo[i][pCP] = CHECKPOINT_ROBBERY;
PlayerInfo[i][pLastLoad] = gettime();
format(string, sizeof(string), "~g~+$%i", amount);
GameTextForPlayer(i, string, 5000, 1);
SendClientMessageEx(i, COLOR_AQUA, "You have looted {00AA00}$%i{33CCFF} and now have $%i. You can keep looting or deliver the cash to the {FF6347}marker{33CCFF}.", amount, PlayerInfo[i][pRobCash]);
SetPlayerCheckpoint(i, 1429.9939, 1066.9581, 9.8938, 3.0);
}
else if((PlayerInfo[i][pRobbingBiz] >= 0 && PlayerInfo[i][pRobbingBiz] == GetInsideBusiness(i)) && PlayerInfo[i][pLootTime] <= 0)
{
new amount = random(300) + 100;
ClearAnimations(i, 1);
PlayerInfo[i][pRobCash] += amount;
PlayerInfo[i][pCP] = CHECKPOINT_ROBBERY;
PlayerInfo[i][pLastLoad] = gettime();
format(string, sizeof(string), "~g~+$%i", amount);
GameTextForPlayer(i, string, 5000, 1);
SendClientMessageEx(i, COLOR_AQUA, "You have looted {00AA00}$%i{33CCFF} and now have $%i. You can keep looting or deliver the cash to the {FF6347}marker{33CCFF} (/stoprobbery).", amount, PlayerInfo[i][pRobCash]);
SetPlayerCheckpoint(i, 1429.9939, 1066.9581, 9.8938, 3.0);
if(PlayerInfo[i][pRobCash] < 10000)
{
ApplyAnimation(i, "BOMBER", "BOM_Plant_Loop", 4.1, 1, 0, 0, 0, 0, 1);
GameTextForPlayer(i, "~w~Looting business vault...", 5000, 3);
PlayerInfo[i][pLootTime] = 5;
}
else
{
callcmd::stoprobbery(i, "/1");
}
}
}
if(PlayerInfo[i][pHunted] > 0)
{
foreach(new x : Player)
{
if(PlayerInfo[x][pLogged] && GetPlayerInterior(x) == GetPlayerInterior(i) && PlayerInfo[i][pHunted] > 0)
{
SetPlayerMarkerForPlayer(x, i, COLOR_RETIRED);
}
}
}
if(PlayerInfo[i][pFindTime] > 0)
{
PlayerInfo[i][pFindTime]--;
if(PlayerInfo[i][pFindTime] == 0)
{
SetPlayerMarkerForPlayer(i, PlayerInfo[i][pFindPlayer], GetPlayerColor(PlayerInfo[i][pFindPlayer]));
PlayerInfo[i][pFindPlayer] = INVALID_PLAYER_ID;
}
}
if((PlayerInfo[i][pToggleMusic]) || (PlayerInfo[i][pBoomboxListen] != INVALID_PLAYER_ID && GetNearbyBoombox(i) != PlayerInfo[i][pBoomboxListen]))
{
PlayerInfo[i][pBoomboxListen] = INVALID_PLAYER_ID;
if(PlayerInfo[i][pStreamType] == MUSIC_BOOMBOX)
{
StopAudioStreamForPlayer(i);
PlayerInfo[i][pStreamType] = MUSIC_NONE;
}
}
if((!PlayerInfo[i][pToggleMusic]) && ((boomboxid = GetNearbyBoombox(i)) != INVALID_PLAYER_ID && PlayerInfo[i][pBoomboxListen] != boomboxid))
{
PlayerInfo[i][pBoomboxListen] = boomboxid;
if(PlayerInfo[i][pStreamType] == MUSIC_NONE)
{
PlayAudioStreamForPlayer(i, PlayerInfo[boomboxid][pBoomboxURL]);
PlayerInfo[i][pStreamType] = MUSIC_BOOMBOX;
}
}
if(PlayerInfo[i][pPickPlant] != INVALID_PLAYER_ID)
{
PlayerInfo[i][pPickTime]--;
if(PlayerInfo[i][pPickTime] <= 0)
{
new planterid = PlayerInfo[i][pPickPlant];
if(!IsPlayerConnected(planterid) || !PlayerInfo[planterid][pLogged] || !PlayerInfo[planterid][pWeedPlanted])
{
SendClientMessage(i, COLOR_GREY, "This plant is no longer available to pick.");
}
else if(!IsPlayerInRangeOfPoint(i, 3.0, PlayerInfo[planterid][pWeedX], PlayerInfo[planterid][pWeedY], PlayerInfo[planterid][pWeedZ]))
{
SendClientMessage(i, COLOR_GREY, "Picking failed. You left the area of the plant.");
}
else if(GetPlayerSpecialAction(i) != SPECIAL_ACTION_DUCK)
{
SendClientMessage(i, COLOR_GREY, "Picking failed. You must stay crouched when picking a plant.");
}
else
{
PlayerInfo[i][pWeed] += PlayerInfo[planterid][pWeedGrams];
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET weed = %i WHERE uid = %i", PlayerInfo[i][pWeed], PlayerInfo[i][pID]);
mysql_tquery(connectionID, queryBuffer);
SendClientMessageEx(i, COLOR_AQUA, "You have harvested %i grams of weed from this plant.", PlayerInfo[planterid][pWeedGrams]);
DestroyWeedPlant(planterid);
}
PlayerInfo[i][pPickPlant] = INVALID_PLAYER_ID;
PlayerInfo[i][pPickTime] = 0;
}
}
if(PlayerInfo[i][pCookMeth] > 0)
{
PlayerInfo[i][pCookTime]--;
if(PlayerInfo[i][pCookTime] <= 0)
{
if(!IsPlayerInRangeOfPoint(i, 5.0, 1.2179, 2.8095, 999.4284))
{
SendClientMessage(i, COLOR_GREY, "Cooking failed. You have left the cooking spot.");
ResetCooking(i);
}
else if(PlayerInfo[i][pEphedrine] <= 0)
{
SendClientMessage(i, COLOR_GREY, "Cooking failed. You have ran out of ephedrine.");
ResetCooking(i);
}
else if(PlayerInfo[i][pMeth] + 2 > GetPlayerCapacity(i, CAPACITY_METH))
{
SendClientMessage(i, COLOR_GREY, "Cooking failed. You have ran out of inventory space for meth.");
ResetCooking(i);
}
else
{
GameTextForPlayer(i, "~g~+2~w~ grams of meth", 3000, 3);
PlayerInfo[i][pEphedrine] -= 1;
PlayerInfo[i][pMeth] += 2;
PlayerInfo[i][pCookGrams] += 2;
if((PlayerInfo[i][pCookGrams] % 4) == 0)
{
PlayerInfo[i][pMuriaticAcid]--;
}
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET ephedrine = %i, meth = %i, muriaticacid = %i WHERE uid = %i", PlayerInfo[i][pEphedrine], PlayerInfo[i][pMeth], PlayerInfo[i][pMuriaticAcid], PlayerInfo[i][pID]);
mysql_tquery(connectionID, queryBuffer);
if(!PlayerInfo[i][pEphedrine])
{
SendClientMessageEx(i, COLOR_LIGHTRED, "You ran out of ephedrine therefore ending your cookoff. You made %i grams of meth from %i grams of ephedrine.", PlayerInfo[i][pCookGrams], PlayerInfo[i][pCookGrams] / 2);
ResetCooking(i);
}
else if(!PlayerInfo[i][pMuriaticAcid])
{
SendClientMessageEx(i, COLOR_LIGHTRED, "You ran out of muriatic acid therefore ending your cookoff. You made %i grams of meth from %i grams of ephedrine.", PlayerInfo[i][pCookGrams], PlayerInfo[i][pCookGrams] / 2);
ResetCooking(i);
}
else if(PlayerInfo[i][pMeth] >= GetPlayerCapacity(i, CAPACITY_METH))
{
SendClientMessageEx(i, COLOR_LIGHTRED, "You ran out of inventory space for meth therefore ending your cookoff. You made %i grams of meth from %i grams of ephedrine.", PlayerInfo[i][pCookGrams], PlayerInfo[i][pCookGrams] / 2);
ResetCooking(i);
}
else
{
PlayerInfo[i][pCookTime] = 15;
}
}
}
}
if(PlayerInfo[i][pDrugsUsed] >= 4)
{
PlayerInfo[i][pDrugsTime]--;
if(PlayerInfo[i][pDrugsTime] <= 0)
{
SendClientMessage(i, COLOR_GREY, "You are no longer stoned.");
SetPlayerWeather(i, gWeather);
SetPlayerTime(i, gWorldTime, 0);
SetPlayerDrunkLevel(i, 500);
PlayerInfo[i][pDrugsUsed] = 0;
PlayerInfo[i][pDrugsTime] = 0;
}
else
{
SetPlayerWeather(i, -66);
SetPlayerTime(i, 12, 0);
SetPlayerDrunkLevel(i, 40000);
}
}
if(PlayerInfo[i][pCapturingPoint] >= 0)
{
PlayerInfo[i][pCaptureTime]--;
if(PlayerInfo[i][pCaptureTime] <= 0)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
if(PointInfo[PlayerInfo[i][pCapturingPoint]][pTime] == 0 && PlayerInfo[i][pPointX] == x && PlayerInfo[i][pPointY] == y && PlayerInfo[i][pPointZ] == z)
{
SendClientMessageToAllEx(COLOR_YELLOW, "Point wars: %s attempted to capture %s for %s. It will be theirs in 15 minutes.", GetPlayerRPName(i), PointInfo[PlayerInfo[i][pCapturingPoint]][pName], GangInfo[PlayerInfo[i][pGang]][gName]);
PointInfo[PlayerInfo[i][pCapturingPoint]][pCaptureTime] = 15;
PointInfo[PlayerInfo[i][pCapturingPoint]][pCapturer] = i;
}
else
{
SendClientMessage(i, COLOR_GREY, "You moved from your position and therefore failed to capture.");
}
PlayerInfo[i][pCapturingPoint] = -1;
PlayerInfo[i][pCaptureTime] = 0;
}
}
if(PlayerInfo[i][pPoisonTime] > 0)
{
new
Float:health;
GetPlayerHealth(i, health);
SetPlayerHealth(i, health - 3.0 < 1.0 ? 1.0 : health - 3.0);
PlayerInfo[i][pPoisonTime]--;
}
AnticheatCheck(i);
//GetPlayerHealth(i, PlayerInfo[i][pHealth]);
if(PlayerInfo[i][pGang] >= 0 && !PlayerInfo[i][pBandana])
{
new id;
if((id = GetNearbyTurf(i)) >= 0 && TurfInfo[id][tTime] == 0 && TurfInfo[id][tCapturer] != INVALID_PLAYER_ID)
{
if(PlayerInfo[i][pTagType] == TAG_VIP)
{
SetPlayerSpecialTag(i, TAG_NONE);
SendClientMessage(i, COLOR_YELLOW, "Your VIP tag was automatically disabled as you've entered an active turf area.");
}
PlayerInfo[i][pBandana] = 1;
SendClientMessage(i, COLOR_WHITE, "Your bandana was enabled automatically as you entered a turf in an active war.");
SetPlayerColor(i, GangInfo[PlayerInfo[i][pGang]][gColor] & ~0xff);
}
if((id = GetNearbyPoint(i, 30.0)) >= 0 && PointInfo[id][pTime] == 0 && PointInfo[id][pCapturer] != INVALID_PLAYER_ID)
{
if(PlayerInfo[i][pTagType] == TAG_VIP)
{
SetPlayerSpecialTag(i, TAG_NONE);
SendClientMessage(i, COLOR_YELLOW, "Your VIP tag was automatically disabled as you've entered an active point area.");
}
PlayerInfo[i][pBandana] = 1;
SendClientMessage(i, COLOR_WHITE, "Your bandana was enabled automatically as you are in range of an active point.");
}
}
if(!PlayerInfo[i][pBackup] && !IsPlayerBeingFound(i))
{
// Yeah, this is indeed a mess. But it works. Cleaning this section is on my list.
if(PlayerInfo[i][pJoinedEvent] && EventInfo[eType] == 2) {
SetPlayerColor(i, (PlayerInfo[i][pEventTeam] == RED_TEAM) ? (0xFF000000) : (0x0000FF00));
} else if(PlayerInfo[i][pPaintball] == 2) {
SetPlayerColor(i, (PlayerInfo[i][pPaintballTeam] == 1) ? (0x33CCFF00) : (0xFFFF9900));
} else if(PlayerInfo[i][pJailType] == 2) {
SetPlayerColor(i, 0xAD7A2100);
} else if(PlayerInfo[i][pFaction] >= 0 && PlayerInfo[i][pDuty] && FactionInfo[PlayerInfo[i][pFaction]][fType] != FACTION_HITMAN) {
SetPlayerColor(i, FactionInfo[PlayerInfo[i][pFaction]][fColor] & ~0xff);
//} else if(PlayerInfo[i][pFaction] >= 0 && PlayerInfo[i][pDuty] == 0 && FactionInfo[PlayerInfo[i][pFaction]][fType] != FACTION_HITMAN && FactionInfo[PlayerInfo[i][pFaction]][fType] != FACTION_POLICE && FactionInfo[PlayerInfo[i][pFaction]][fType] != FACTION_MEDIC) {
//SetPlayerColor(i, FactionInfo[PlayerInfo[i][pFaction]][fColor] & ~0xff);
} else if(PlayerInfo[i][pGang] >= 0 && PlayerInfo[i][pBandana]) {
SetPlayerColor(i, GangInfo[PlayerInfo[i][pGang]][gColor] & ~0xff);
} else if(PlayerHasJob(i, JOB_TAXIDRIVER) && PlayerInfo[i][pTaxiFare] > 0) {
SetPlayerColor(i, 0xF5DEB300);
} else if(PlayerInfo[i][pVIPPackage] > 0 && PlayerInfo[i][pVIPColor]) {
SetPlayerColor(i, 0xFF00FF00);
//} else if(PlayerInfo[i][pAdmin] > 0 && PlayerInfo[i][pAdminDuty]) {
//SetPlayerColor(i, 0xAA333300); // 0xFFD70000
} else {
SetPlayerColor(i, 0xFFFFFF00);
}
}
}
}
for(new i = 0; i < MAX_ACTORS; i ++)
{
if(IsValidActor(i))
{
new
Float:x,
Float:y,
Float:z;
GetActorPos(i, x, y, z);
SetActorPos(i, x, y, z);
}
}
format(string, sizeof(string), "Raw ephedrine\nStock: %i\nPrice: $1,000/gram\n/buydrug ephedrine [amount]", gEphedrineStock);
UpdateDynamic3DTextLabelText(gEphedrineStockText, COLOR_YELLOW, string);
format(string, sizeof(string), "Marijuana seeds\nStock: %i\nPrice: $500/seed\n/buydrug seeds [amount]", gSeedsStock);
UpdateDynamic3DTextLabelText(gSeedsStockText, COLOR_YELLOW, string);
format(string, sizeof(string), "Cocaine\nStock: %i\nPrice: $750/gram\n/buydrug cocaine [amount]", gCocaineStock);
UpdateDynamic3DTextLabelText(gCocaineText, COLOR_YELLOW, string);
if(Iter_Count(Player) > gPlayerRecord)
{
gPlayerRecord = Iter_Count(Player);
gRecordDate = GetDate();
SaveServerInfo();
}
}
PHP код:
AFKCheck(playerid)
{
new
Float:x,
Float:y,
Float:z,
Float:cx,
Float:cy,
Float:cz;
GetPlayerPos(playerid, x, y, z);
GetPlayerCameraPos(playerid, cx, cy, cz);
if(PlayerInfo[playerid][pAFKPos][0] == x && PlayerInfo[playerid][pAFKPos][1] == y && PlayerInfo[playerid][pAFKPos][2] == z && PlayerInfo[playerid][pAFKPos][3] == cx && PlayerInfo[playerid][pAFKPos][4] == cy && PlayerInfo[playerid][pAFKPos][5] == cz)
{
PlayerInfo[playerid][pAFKTime]++;
if(!PlayerInfo[playerid][pAFK] && PlayerInfo[playerid][pAFKTime] >= 60)
{
SendClientMessage(playerid, COLOR_LIGHTORANGE, "** You are now marked as {00AA00}Away from keyboard{F7A763} as you haven't moved in one minute.");
//SendClientMessage(i, COLOR_LIGHTRED, "SERVER: You have been marked as AFK as you haven't moved in one minute.");
PlayerInfo[playerid][pAFK] = 1;
}
}
else
{
if(PlayerInfo[playerid][pAFK])
{
if(PlayerInfo[playerid][pAFKTime] < 120) {
//SendClientMessageEx(i, COLOR_LIGHTORANGE, "** You are no longer marked as Away from Keyboard after %i seconds.", PlayerInfo[playerid][pAFKTime]);
SendClientMessageEx(playerid, COLOR_LIGHTRED, "SERVER: You are no longer marked as AFK after %i seconds.", PlayerInfo[playerid][pAFKTime]);
} else if(PlayerInfo[playerid][pAFKTime] >= 120) {
//SendClientMessageEx(i, COLOR_LIGHTORANGE, "** You are no longer marked as Away from Keyboard after %i minutes.", PlayerInfo[playerid][pAFKTime] / 60);
SendClientMessageEx(playerid, COLOR_LIGHTRED, "SERVER: You are no longer marked as AFK after %i minutes.", PlayerInfo[playerid][pAFKTime] / 60);
}
PlayerInfo[playerid][pAFK] = 0;
}
PlayerInfo[playerid][pAFKTime] = 0;
}
PlayerInfo[playerid][pAFKPos][0] = x;
PlayerInfo[playerid][pAFKPos][1] = y;
PlayerInfo[playerid][pAFKPos][2] = z;
PlayerInfo[playerid][pAFKPos][3] = cx;
PlayerInfo[playerid][pAFKPos][4] = cy;
PlayerInfo[playerid][pAFKPos][5] = cz;
}