[Ajuda] Sistema de RADAR
#2

PHP Code:
CheckPlayerSpeeding(playerid)
{
    new 
Name[24], Msg[128];
    if (
APlayerData[playerid][PlayerCaughtSpeeding] == 0)
    {
        for (new 
CamIDCamID MAX_CAMERASCamID++)
        {
            
// 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(playerid50.0ACameras[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(playeridGetPlayerWantedLevel(playerid) + 1);
                            
// Let the player know he's been caught speeding
                            
new don[120];
                            
format(donsizeof don,"Voce passou a %d KM/H e o limite de velocidade permitido й %d KM/H",APlayerData[playerid][PlayerSpeed]);
                            
SendClientMessage(playerid0xFFFFFFFFdon);

                            
// Get the name of the player
                            
GetPlayerName(playeridNamesizeof(Name));
                            
// Also inform all police players that this player is caught speeding
                            
format(Msg128"{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]--;

Reply


Messages In This Thread
Sistema de RADAR - by Hades12 - 08.03.2019, 17:53
Re: Sistema de RADAR - by Don_Speed - 08.03.2019, 18:15
Re: Sistema de RADAR - by zHellSync - 08.03.2019, 18:22
Re: Sistema de RADAR - by AutoMatic2 - 08.03.2019, 21:24

Forum Jump:


Users browsing this thread: 1 Guest(s)