Jump to content

[HELP] onVehicleExplode


xXGhostXx

Recommended Posts

Hello guys, I am making an script with onVehicleExplode function.

What is problem in my code?

Chat box 2 send for player? and how can i send chat box for intended person ?

function Test ()
    if getElementData(source,"owner") then
        outputChatBox("ID: "..getElementData(source, "vehicleID"))
    end
end
addEventHandler("onVehicleExplode", getRootElement(), Test)

Thanks.

Edited by xXGhostXx
Link to comment
function Test ()
    if getElementData(source, "Owned") then
        outputChatBox("Vehicles: "..getElementData(source, "vehicleID").." been has destroyed",getElementData(source,"owner") ,0,0,0)
    end
end
addEventHandler("onVehicleExplode", getRootElement(), Test)

Add a new data to set the Owner , to playerAccount .

Link to comment
2 hours ago, Network said:

function Test ()
    if getElementData(source, "Owned") then
        outputChatBox("Vehicles: "..getElementData(source, "vehicleID").." been has destroyed",getElementData(source,"owner") ,0,0,0)
    end
end
addEventHandler("onVehicleExplode", getRootElement(), Test)

Add a new data to set the Owner , to playerAccount .

His problem is that message outputs twice.

Link to comment
2 hours ago, Network said:

function Test ()
    if getElementData(source, "Owned") then
        outputChatBox("Vehicles: "..getElementData(source, "vehicleID").." been has destroyed",getElementData(source,"owner") ,0,0,0)
    end
end
addEventHandler("onVehicleExplode", getRootElement(), Test)

Add a new data to set the Owner , to playerAccount .

Please fix it :(

Link to comment
----- WHERE U SET THE CAR owner
if u have a vehicle spawner or what trigger that event with vehicle ID 
addEvent("onPlayerSpawnVehicle",true)
addEventHandler("onPlayerSpawnVehicle",root,function(ID,X,Y,Z,ROT)
veh = createVehicle(ID,X,Y,Z,ROT)
setElementData(veh, "Owned", "yes")
setElementData(veh, "Owner", getAccountName(getPlayerAccount(source)))

addEventHandler("onVehicleExplode", veh, function()
    if getElementData(source, "Owned") == "yes" then
        outputChatBox("Vehicles: Your vehicle has been has destroyed",getElementData(source,"Owner") ,0,0,0)
end
end)
end)

 

Edited by Network
  • Haha 1
Link to comment
  • Moderators
13 hours ago, xXGhostXx said:

Help me

Can you please stop bumping? (3e bump)

If you continue, I will have to lock your topic, not matter the reason.

Bumping is annoying for everybody that wants to keep track of content they have already checked. Please think about that. Normally I would lock a topic after a 2e bump, but for the people that replied I will leave it open for now.

Link to comment
  • IIYAMA locked this topic
  • Moderators
On 05/10/2019 at 18:43, IIYAMA said:

Can you please stop bumping? (3e bump)

If you continue, I will have to lock your topic, not matter the reason.

Bumping is annoying for everybody that wants to keep track of content they have already checked. Please think about that. Normally I would lock a topic after a 2e bump, but for the people that replied I will leave it open for now.

50 minutes ago, xXGhostXx said:

?

 

Locked

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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