// This function creates a speedcamera (store data and create the objects) SetupSpeedCamera(CamID, Float ![]() { // Store all the given values ACameras[CamID][CamX] = x; ACameras[CamID][CamY] = y; ACameras[CamID][CamZ] = z; ACameras[CamID][CamAngle] = rot; ACameras[CamID][CamSpeed] = MaxSpeed; // Create both camera objects and store their reference new JS_TEXTO[256]; format(JS_TEXTO, sizeof(JS_TEXTO), "{FF0000}[RADAR] \nVel. Mбxima {FFFF00}%i {FF0000}Km/h ",MaxSpeed); ACameras[CamID][Cam3DText] = CreateDynamic3DTextLabel(JS_TEXTO,-1,x,y,z +5.0,100.0); ACameras[CamID][CamObj1] = CreateObject(18880, x, y, z, 0.0, 0.0, rot); ACameras[CamID][CamObj2] = CreateObject(18880, x, y, z, 0.0, 0.0, rot + 180.0); ACameras[CamID][CamObj3] = CreateDynamicMapIcon(x, y, z, 34, 0, 0, 0, -1, 300.0); } |
SetupSpeedCamera(CamID, Float ![]() { new String[128]; ACameras[CamID][CamX] = x; ACameras[CamID][CamY] = y; ACameras[CamID][CamZ] = z; ACameras[CamID][CamAngle] = rot; ACameras[CamID][CamSpeed] = MaxSpeed; ACameras[CamID][CamObj1] = CreateObject(18880, x, y, z, 0.0, 0.0, rot); ACameras[CamID][CamObj2] = CreateObject(18880, x, y, z, 0.0, 0.0, rot + 180.0); ACameras[CamID][CamObj3] = CreateDynamicMapIcon(x, y, z, 34, 0, 0, 0, -1, 300.0); format(String, sizeof(String), "{FF0000}Vel. Max\n{FFFFFF}%i {FF0000}Km/h", MaxSpeed); ACameras[CamID][CamObj4] = Create3DTextLabel(String, -1, x, y, z + 4.2, 150.0, 0, 0); } |
Isso ai sу define as variaveis, vб em PPC_Speedometer em CheckPlayerSpeeding(playerid) e poste-o aqui.
|
// This function checks if the player is speeding near a speedcamera CheckPlayerSpeeding(playerid) { // Setup local variables new Name[24], Msg[128]; new Msg2[128]; if (APlayerData[playerid][PlayerCaughtSpeeding] == 0) { for (new CamID; CamID < MAX_CAMERAS; CamID++) { if (ACameras[CamID][CamSpeed] != 0) { /*if (IsPlayerInRangeOfPoint(playerid, 100.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ])) { TextDrawShowForPlayer(playerid, RadarRadar[playerid]); SetTimer("DestruirTextRadar", 3000, false); }*/ if (GetPlayerVehicleSeat(playerid) == 0) { if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed]) { if (IsPlayerInRangeOfPoint(playerid, 30.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ])) { GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME); APlayerData[playerid][PlayerCaughtSpeeding] = 20; SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1); SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding); GetPlayerName(playerid, Name, sizeof(Name)); format(Msg, 128, "{FFFF00}[INFO] {009D4F}Player %s estб dirigindo em alta velocidade, pare-o e multe-o", Name); Police_SendMessage(Msg); format(Msg2, sizeof(Msg2), "{009D4F}Visto pela ъltima vez nas redondezas de: {AFAFAF}%s", zone); Police_SendMessage(Msg2); } } } } } } 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]--; } |
// Check if the player is not in any plane or helicopter (those cannot be caught by speedcamera's) if (IsVehicleAirVehicle(vehicleid) == 0) if (APlayerData[playerid][PlayerClass] != ClassPolice && APlayerData[playerid][PlayerClass] != ClassBombeiro) // Check if the player isn't speeding (cops won't get caught) CheckPlayerSpeeding(playerid); } else { // If the player is not inside a vehicle, display an empty string (looks like the speedometer is gone) //TextDrawSetString(APlayerData[playerid][SpeedometerText], " "); TextDrawSetString(APlayerData[playerid][FuelGauge], " "); TextDrawSetString(APlayerData[playerid][MotorDraw], " "); TextDrawSetString(APlayerData[playerid][FarolDraw], " "); TextDrawSetString(APlayerData[playerid][AtreladoDraw], " "); TextDrawSetString(APlayerData[playerid][TextRadar], " "); //TextDrawSetString(APlayerData[playerid][KmhV], " "); // Set the speed of the player to 0 APlayerData[playerid][PlayerSpeed] = 0; } } // This timer-function is called when a player picks up a refuelpickup public RefuelVehicle(playerid) { new RefuelMsg[128]; // Get the vehicle-id of the player's vehicle new vID = GetPlayerVehicleID(playerid); // Calculate the amount of fuel that needs to be refuelled new Amount = MaxFuel - AVehicleData[vID][Fuel]; // Calculate the price to refuel new RefuelPrice = (Amount * RefuelMaxPrice) / MaxFuel; // Check if the player has enough cash if (APlayerData[playerid][PlayerMoney] >= RefuelPrice) { // Refuel the vehicle AVehicleData[vID][Fuel] = MaxFuel; // Withdraw the money from the player RewardPlayer(playerid, -RefuelPrice, 0); // Let the player know he refuelled his vehicle format(RefuelMsg, 128, TXT_RefuelledVehicle, RefuelPrice); SendClientMessage(playerid, 0xFFFFFFFF, RefuelMsg); } else SendClientMessage(playerid, 0xFFFFFFFF, TXT_CannotRefuelVehicle); // Allow the player to move again TogglePlayerControllable(playerid, 1); return 1; } |
Isso nгo й uma segunda funзгo, ai a funзгo estб sendo usada, por esses codes ai, notei que vocк pegou gm da net, te aconselho a pegar um gm mais Simples se for pegar. Sobre o problema, no cуdigo estб para setar 1 estrela a mais, alguma coisa estб burlando o cуdigo, tente fazer um debug.
|