03.11.2013, 14:27
Quote:
Basta usar as duas funзхes.
Para mostrar quando estiver perto: TextDrawShowForPlayer Para esconder quando estiver longe dela: TextDrawHideForPlayer Espero ter ajudado ^_^ |
Quote:
o.O Vai mostrar a TextDraw quando cria o Radar? wtf AUEHAUHE
Rapaz, tudo й questгo de lуgica. Se tu quer que mostra a TextDraw quando passa, tu vai mecher na parte onde passa pelo radar. Sу procurar pela mensagem que й exibida e pхe pra exibir. |
pawn Код:
// This function checks if the player is speeding near a speedcamera
CheckPlayerSpeeding(playerid)
{
// Setup local variables
new Name[28], Msg[128], Msgg[128], location[MAX_ZONE_NAME], targetid;
// 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, 40.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
new Ha[128];
// 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
format(Ha, sizeof(Ha), "[Radar] {FF0000}Vocк foi flagrado a: {FFFFFF}%i Km/h {FF0000}[Permitido: {FFFFFF}%i{FF0000}].", APlayerData[playerid][PlayerSpeed], ACameras[CamID][CamSpeed]);
SendClientMessage(playerid, -1, Ha);
// Get the name of the player
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayer2DZonea(targetid, location, MAX_ZONE_NAME);
// Also inform all police players that this player is caught speeding
format(Msg, 128, "[Radar] %s {FF0000}foi flagrado em alta velocidade pelo {FFFFFF}radar!", Name);
format(Msgg, 128, "[Local] {FF0000}Visto pela ultima vez proximo de: {FFFFFF}%s", location);
Police_SendMessage(Msg);
Police_SendMessage(Msgg);
}
}
}
}
}
}
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]--;
}