Firespider Posted May 15, 2023 Share Posted May 15, 2023 Hello! For some reason, the part that retrieves the car's ID does not work in this code. Can you help? addEventHandler("onClientVehicleEnter", root, function(theVehicle, seat, jacked) id = getVehicleID(theVehicle) skin = getElementModel(localPlayer) if (id == 596) then if (skin == 280) then playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeress belépés", 255, 255, 255, true) PDMenu = true else playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikertelen belépés", 255, 255, 255, true) end end end ) Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 (edited) 36 minutes ago, Firespider said: Hello! For some reason, the part that retrieves the car's ID does not work in this code. Can you help? addEventHandler("onClientVehicleEnter", root, function(theVehicle, seat, jacked) id = getVehicleID(theVehicle) skin = getElementModel(localPlayer) if (id == 596) then if (skin == 280) then playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeress belépés", 255, 255, 255, true) PDMenu = true else playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikertelen belépés", 255, 255, 255, true) end end end ) use https://wiki.multitheftauto.com/wiki/GetElementModel and source addEventHandler("onClientVehicleEnter", root, function(thePed, seat) local vehid = getElementModel(source) local playerskin = getElementModel(localPlayer) if (vehid ~= 596) then return end if (playerskin == 280) then playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeress belépés", 255, 255, 255, true) PDMenu = true else playSound("beep.mp3") outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikertelen belépés", 255, 255, 255, true) end end) Edited May 15, 2023 by Shady1 1 Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 5 minutes ago, Firespider said: Thanks bro! if it worked and you liked my help, you can give a like in the comment. 1 Link to comment
Firespider Posted May 15, 2023 Author Share Posted May 15, 2023 @Shady1 Can you help me with this code as well? setTimer( function() local x, y, z = getElementPosition(localPlayer) sanyi = createBlip(x, y, z, 0) Reset(); end, 2000, 0) function Reset() destroyElement(sanyi) end setTimer(Reset, 3000, 0) Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 2 minutes ago, Firespider said: @Shady1 Can you help me with this code as well? setTimer( function() local x, y, z = getElementPosition(localPlayer) sanyi = createBlip(x, y, z, 0) Reset(); end, 2000, 0) function Reset() destroyElement(sanyi) end setTimer(Reset, 3000, 0) tell me exactly what the problem is, or tell me what you want it to be Link to comment
Firespider Posted May 15, 2023 Author Share Posted May 15, 2023 (edited) The problem is that for some reason it doesn't detect myBlip and delete it. Edited May 15, 2023 by Firespider Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 7 minutes ago, Firespider said: @Shady1 Can you help me with this code as well? setTimer( function() local x, y, z = getElementPosition(localPlayer) sanyi = createBlip(x, y, z, 0) Reset(); end, 2000, 0) function Reset() destroyElement(sanyi) end setTimer(Reset, 3000, 0) i don't understand what you are trying to do in the code, but i did as you asked, i didn't test it, try it and message back. local sanyi function Reset() destroyElement(sanyi) end setTimer( function() local x, y, z = getElementPosition(localPlayer) sanyi = createBlip(x, y, z, 0) end, 2000, 0) setTimer(Reset, 3000, 0) Link to comment
Firespider Posted May 15, 2023 Author Share Posted May 15, 2023 So the problem would be that it doesn't delete the blip. I would like to make sure that the blip follows the player, indicating that a police unit is going there. However, in order not to be ugly, I would always like to delete the previous blip so that the map is full of blips. Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 (edited) 6 minutes ago, Firespider said: So the problem would be that it doesn't delete the blip. I would like to make sure that the blip follows the player, indicating that a police unit is going there. However, in order not to be ugly, I would always like to delete the previous blip so that the map is full of blips. Do you want to always show the player or do something like a trace so it can't know its original position but it knows its previous position use https://wiki.multitheftauto.com/wiki/CreateBlipAttachedTo Edited May 15, 2023 by Shady1 1 Link to comment
Firespider Posted May 15, 2023 Author Share Posted May 15, 2023 @Shady1 And Shady, how can I solve it, for example by entering /setunit [Unit number] and the chat displays the unit number that the player entered? Link to comment
Shady1 Posted May 15, 2023 Share Posted May 15, 2023 27 minutes ago, Firespider said: @Shady1 And Shady, how can I solve it, for example by entering /setunit [Unit number] and the chat displays the unit number that the player entered? -- Client-side script addCommandHandler("setunit", function(command, unitNumber) -- Check if the unit number is valid (must be a number) if not tonumber(unitNumber) then outputChatBox("Invalid unit number! Please enter a valid number.", 255, 0, 0) return end unitNumber = math.floor(tonumber(unitNumber)) outputChatBox("You have set your unit number to: " .. unitNumber, 0, 255, 0) end) 1 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