PeeQ. Posted April 10, 2020 Share Posted April 10, 2020 started = false timeExist = false currentMarker = 0 function tipob() if started == false then takePlayerMoney(source, 2500) outputChatBox("O teste foi iniciado! Você irá se responsabilizar pela integralidade do veículo, dirija atentamente!", getRootElement(), 0, 255, 0) --the drive test has been started iniciar() started = true else outputChatBox("O teste já foi inciado.", getRootElement(), 255, 0, 0) --the drive test has already started end end addEvent("habilitacao.tipob.iniciar", true) addEventHandler("habilitacao.tipob.iniciar", root, tipob) function iniciar() -->> inciar = start car = createVehicle (555, -2064.5, -83, 35) addEventHandler("onVehicleExplode", car, check) setVehicleColor (car, 255, 255, 255) warpPedIntoVehicle (source, car) setElementInterior(source, 0) markerb1() end function check() destroyElement(car) takePlayerMoney(getRootElement(), 25000) started = false if timeExist == true then killTimer(timer) end outputChatBox("O veículo foi explodido ou abandonado, você irá arcar com o prejuízo!", getRootElement(), 255, 0, 0)-- the car has exploded if CurrentMarker >= 1 then destroyElement(mk) destroyElement(b) CurrentMarker = 0 end end markersb = { {-2058, -97, 35}, {-2048.9013671875, -77.568359375, 35.171875}, {-2059.20, -67.70, 35}, {-2083.30, -68, 35}, {-2083, -31, 35}, {-2093.50, 33.40, 35}, {-2153.365234375, 33.380859375, 35.171875}, {-2157.673828125, 96.2412109375, 35.171875}, {-2144.2060546875, 195.67578125, 35.212448120117}, {-2168.69140625, 211.060546875, 35.171875}, {-2248.9111328125, 219.6123046875, 35.1640625}, {-2265.2607421875, 323.0166015625, 35.455764770508}, {-2369.2841796875, 290.861328125, 35.114284515381}, {-2495.7900390625, 172.275390625, 6.3510932922363}, {-2594.630859375, 160.13671875, 4.1759071350098}, {-2606.0966796875, 120.9931640625, 4.1796875}, {-2619.3984375, 41.658203125, 4.1796875}, {-2708.158203125, 27.4619140625, 4.1796875}, {-2708.2568359375, -195.2109375, 4.1796875}, -- {-2733.0078125, -208.111328125, 7.0317420959473}, {-2669.1015625, -212.5810546875, 4.1796875}, {-2688.7587890625, -269.09765625, 7.0390625}, {-2818.72265625, -337.8154296875, 7.03125}, {-2811.447265625, -469.8564453125, 7.1255831718445}, {-2673.7734375, -520.1796875, 17.830480575562}, {-2570.7138671875, -370.2158203125, 49.504898071289}, {-2365.0419921875, -396.923828125, 78.278594970703}, {-2375.4443359375, -431.3271484375, 82.007827758789}, {-2474.5595703125, -432.8857421875, 80.774749755859}, {-2615.68359375, -506.1259765625, 71.738357543945}, {-2470.60546875, -493.2841796875, 103.46114349365}, {-2411.701171875, -625.908203125, 132.40286254883}, {-2345.806640625, -700.7392578125, 112.21072387695}, {-2309.025390625, -782.34375, 90.427505493164}, {-2242.375, -710.5224609375, 65.92414855957}, {-2189.2841796875, -486.458984375, 48.398128509521}, {-2251.1337890625, -357.2529296875, 50.8671875}, {-2251.3291015625, -205.080078125, 35.308410644531}, {-2178.77734375, -186.2490234375, 35.179664611816}, {-2164.572265625, -84.9814453125, 35.171875}, {-2130.400390625, -72.94921875, 35.171875}, {-2047.533203125, -83.7236328125, 35.1640625}, } function markerb1() CurrentMarker = CurrentMarker + 1 if CurrentMarker >= 2 then destroyElement(marker) destroyElement(blip) end if CurrentMarker == 42 then --42 = the last marker outputChatBox("Você terminou", getRootElement(), 0, 255, 0) --you has been fineshed started = false if (getElementHealth(car) >= 900) then account = getPlayerAccount(source) setAccountData(account, "habilitacao.tipob", true) --license = true outputChatBox("Você aprovado, agora você possui habilitação tipo B.", getRootElement(), 0, 255, 0)--you has been aprovate destroyElement(car) else outputChatBox("Você foi reprovado, tente novamente.", getRootElement(), 255, 0, 0)--you has reprobate destroyElement(car) end else marker = createMarker(markersb[m][1], markersb[m][2], markersb[m][3], "checkpoint", 5.0, 255, 0, 0, 90, getRootElement()) blip = createBlipAttachedTo(mk, _, _, _, _, _, _, _, _, getRootElement()) end addEventHandler("onMarkerHit", marker, markerb1) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), function(theVehicle, seat, jacked ) if (getElementModel(theVehicle) == 555) then outputChatBox("Você tem 30 segundos para voltar ao veículo, caso contrário, o teste será cancelado.", getRootElement(), 255, 0, 0) --go back to car in 30 seconds timer = setTimer(check, 30000, 1) timeExist = true end end) addEventHandler ( "onPlayerVehicleEnter", getRootElement(), function(theVehicle, seat, jacked) if timeExist == true then if (getElementModel(theVehicle) == 555) then killTimer(timer) timeExist = false end end end) I made this script myself, I'm not very experienced, so forgive the mistakes. Well, I have two errors, I can't set the value in "setAccountData", and for some reason, the script always skips a checkpoint when creating the marker. pllzzz, help me Leon Link to comment
PeeQ. Posted April 10, 2020 Author Share Posted April 10, 2020 (edited) started = false timeExist = false currentMarker = 0 function tipob() if started == false then takePlayerMoney(source, 2500) outputChatBox("O teste foi iniciado! Você irá se responsabilizar pela integralidade do veículo, dirija atentamente!", getRootElement(), 0, 255, 0) --the drive test has been started iniciar() started = true else outputChatBox("O teste já foi inciado.", getRootElement(), 255, 0, 0) --the drive test has already started end end addEvent("habilitacao.tipob.iniciar", true) addEventHandler("habilitacao.tipob.iniciar", root, tipob) function iniciar() -->> inciar = start car = createVehicle (555, -2064.5, -83, 35) addEventHandler("onVehicleExplode", car, check) setVehicleColor (car, 255, 255, 255) warpPedIntoVehicle (source, car) setElementInterior(source, 0) markerb1() end function check() destroyElement(car) takePlayerMoney(getRootElement(), 25000) started = false if timeExist == true then killTimer(timer) end outputChatBox("O veículo foi explodido ou abandonado, você irá arcar com o prejuízo!", getRootElement(), 255, 0, 0)-- the car has exploded if CurrentMarker >= 1 then destroyElement(marker) destroyElement(blip) CurrentMarker = 0 end end markersb = { {-2058, -97, 35}, {-2048.9013671875, -77.568359375, 35.171875}, {-2059.20, -67.70, 35}, {-2083.30, -68, 35}, {-2083, -31, 35}, {-2093.50, 33.40, 35}, {-2153.365234375, 33.380859375, 35.171875}, {-2157.673828125, 96.2412109375, 35.171875}, {-2144.2060546875, 195.67578125, 35.212448120117}, {-2168.69140625, 211.060546875, 35.171875}, {-2248.9111328125, 219.6123046875, 35.1640625}, {-2265.2607421875, 323.0166015625, 35.455764770508}, {-2369.2841796875, 290.861328125, 35.114284515381}, {-2495.7900390625, 172.275390625, 6.3510932922363}, {-2594.630859375, 160.13671875, 4.1759071350098}, {-2606.0966796875, 120.9931640625, 4.1796875}, {-2619.3984375, 41.658203125, 4.1796875}, {-2708.158203125, 27.4619140625, 4.1796875}, {-2708.2568359375, -195.2109375, 4.1796875}, -- {-2733.0078125, -208.111328125, 7.0317420959473}, {-2669.1015625, -212.5810546875, 4.1796875}, {-2688.7587890625, -269.09765625, 7.0390625}, {-2818.72265625, -337.8154296875, 7.03125}, {-2811.447265625, -469.8564453125, 7.1255831718445}, {-2673.7734375, -520.1796875, 17.830480575562}, {-2570.7138671875, -370.2158203125, 49.504898071289}, {-2365.0419921875, -396.923828125, 78.278594970703}, {-2375.4443359375, -431.3271484375, 82.007827758789}, {-2474.5595703125, -432.8857421875, 80.774749755859}, {-2615.68359375, -506.1259765625, 71.738357543945}, {-2470.60546875, -493.2841796875, 103.46114349365}, {-2411.701171875, -625.908203125, 132.40286254883}, {-2345.806640625, -700.7392578125, 112.21072387695}, {-2309.025390625, -782.34375, 90.427505493164}, {-2242.375, -710.5224609375, 65.92414855957}, {-2189.2841796875, -486.458984375, 48.398128509521}, {-2251.1337890625, -357.2529296875, 50.8671875}, {-2251.3291015625, -205.080078125, 35.308410644531}, {-2178.77734375, -186.2490234375, 35.179664611816}, {-2164.572265625, -84.9814453125, 35.171875}, {-2130.400390625, -72.94921875, 35.171875}, {-2047.533203125, -83.7236328125, 35.1640625}, } function markerb1() CurrentMarker = CurrentMarker + 1 if CurrentMarker >= 2 then destroyElement(marker) destroyElement(blip) end if CurrentMarker == 42 then --42 = the last marker outputChatBox("Você terminou", getRootElement(), 0, 255, 0) --you has been fineshed started = false if (getElementHealth(car) >= 900) then account = getPlayerAccount(source) setAccountData(account, "habilitacao.tipob", true) --license = true outputChatBox("Você aprovado, agora você possui habilitação tipo B.", getRootElement(), 0, 255, 0)--you has been aprovate destroyElement(car) else outputChatBox("Você foi reprovado, tente novamente.", getRootElement(), 255, 0, 0)--you has reprobate destroyElement(car) end else marker = createMarker(markersb[CurrentMarker][1], markersb[CurrentMarker][2], markersb[CurrentMarker][3], "checkpoint", 5.0, 255, 0, 0, 90, getRootElement()) blip = createBlipAttachedTo(marker, _, _, _, _, _, _, _, _, getRootElement()) end addEventHandler("onMarkerHit", marker, markerb1) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), function(theVehicle, seat, jacked ) if (getElementModel(theVehicle) == 555) then outputChatBox("Você tem 30 segundos para voltar ao veículo, caso contrário, o teste será cancelado.", getRootElement(), 255, 0, 0) --go back to car in 30 seconds timer = setTimer(check, 30000, 1) timeExist = true end end) addEventHandler ( "onPlayerVehicleEnter", getRootElement(), function(theVehicle, seat, jacked) if timeExist == true then if (getElementModel(theVehicle) == 555) then killTimer(timer) timeExist = false end end end) Sorry, this is the correctly script, but i can't edit the post i do not know why Edited April 10, 2020 by PeeQ. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now