Jump to content

[HELP]


Recommended Posts

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
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 by Shady1
  • Like 1
Link to comment
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
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
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
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 by Shady1
  • Like 1
Link to comment
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)

 

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...