02.07.2017, 14:46
I need to disable speed cam for police vehicles.
Код HTML:
//===================================================================================================
// Timers
//===================================================================================================
forward UpdateCameras();
public UpdateCameras()
{
for(new a = 0;a<MAX_PLAYERS;a++)
{
if(!IsPlayerConnected(a)) continue;
if(!IsPlayerInAnyVehicle(a)) continue;
if(GetPVarInt(a,"PlayerHasBeenFlashed") == 1)
{
continue;
} else if (GetPVarInt(a,"PlayerHasBeenFlashed") == 2)
{
DeletePVar(a,"PlayerHasBeenFlashed");
continue;
}
for(new b = 0;b<loaded_cameras +1;b++)
{
if(SpeedCameras[b][_active] == false) continue;
if(IsPlayerInRangeOfPoint(a,SpeedCameras[b][_range],SpeedCameras[b][_x],SpeedCameras[b][_y],SpeedCameras[b][_z]))
{
new speed = floatround(GetVehicleSpeed(GetPlayerVehicleID(a),SpeedCameras[b][_usemph]));
new limit = SpeedCameras[b][_limit];
if(speed > limit)
{
TextDrawShowForPlayer(a,flash);
#if CAMERA_PERSPECTIVE == true
SetPlayerCameraPos(a,SpeedCameras[b][_x],SpeedCameras[b][_y],SpeedCameras[b][_z] + 5);
new Float:x,Float:y,Float:z;GetPlayerPos(a,x,y,z);
SetPlayerCameraLookAt(a,x,y,z);
#endif
SetPVarInt(a,"PlayerHasBeenFlashed",1);
SetTimerEx("RemoveFlash",CAMERA_FLASH_TIME,false,"i",a);
if(GetPlayerState(a) == PLAYER_STATE_DRIVER)
{
if(SpeedCameras[b][_usemph] == 0)
{
SendClientMessageEx(a,0xFF1E00FF,"sisis","You are driving too fast! you got busted driving ",speed,"kmh where you were allowed to drive ",limit, "kmh.");
SendClientMessageEx(a,0xFF1E00FF,"sis","You got yourself a fine of $",SpeedCameras[b][_fine],".");
} else {
SendClientMessageEx(a,0xFF1E00FF,"sisis","You are driving too fast! you got busted driving ",speed,"mph where you were allowed to drive ",limit, "mph.");
SendClientMessageEx(a,0xFF1E00FF,"sis","You got yourself a fine of $",SpeedCameras[b][_fine],".");
}
GivePlayerMoney(a, - SpeedCameras[b][_fine]);
}
}
}
}
}
}
forward RemoveFlash(playerid);
public RemoveFlash(playerid)
{
TextDrawHideForPlayer(playerid,flash);
SetPVarInt(playerid,"PlayerHasBeenFlashed",2);
#if CAMERA_PERSPECTIVE == true
SetCameraBehindPlayer(playerid);
#endif
}