17.05.2014, 08:08
(
Последний раз редактировалось morha12; 17.05.2014 в 09:48.
)
Quote:
CallRemoteFunction will return always 1 if it execute success.
Just replace with |
I had to change the stock name too because if I would not change it, it says undefined symbol...
Updated script:
pawn Код:
stock IsACop(playerid)
{
return CallRemoteFunction("IsACop", "i", playerid);
}
CheckPlayerSpeeding(playerid)
{
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
if (!IsACop(playerid))
{
// Loop through all speedcameras
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this camera has been created
if (ACameras[CamID][CamSpeed] != 0)
{
// Check if the player is the driver of the vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Check if the player's speed is greater than the speed allowed by this camera (no need to process a distance-check if not speeding)
if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
{
// Check if the player is near the camera
if (IsPlayerInRangeOfPoint(playerid, 20.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Speed Cam has given you a ticket costing $2500, reason: High Speed");
GivePlayerCash(playerid, -2500);
}
}
}
}
}
}
}
else // If the player has been caught before, reduce the value until it's 0 again, then he can be caught again
APlayerData[playerid][PlayerCaughtSpeeding]--;
return 1;
}