08.03.2019, 17:53
Seguinte, tenho um sistema de radar mas ele nгo puxa qual a velocidade que o player passou no radar, so mostra quele ele foi pego em alta velocidade.
estava tentando acrescentar esse recurso mas acabei fazendo merda e prejudiquei 9 comandos do server, queria a ajuda de alguйm.
estava tentando acrescentar esse recurso mas acabei fazendo merda e prejudiquei 9 comandos do server, queria a ajuda de alguйm.
PHP Code:
CheckPlayerSpeeding(playerid)
{
// Setup local variables
new Name[24], Msg[128];
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
// 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, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
// Prevent the player being caught multiple times by the same speed-camera
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
// Increase the wanted-level of this player by 1 star
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
// Let the player know he's been caught speeding
SendClientMessage(playerid, 0xFFFFFFFF, "Voce passou a %d KM/H e o limite de velocidade permitido й %d KM/H");
// Get the name of the player
GetPlayerName(playerid, Name, sizeof(Name));
// Also inform all police players that this player is caught speeding
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} foi pego no radar, persiga-o e multe-o", Name);
Police_SendMessage(Msg);
}
}
}
}
}
}
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]--;
}