Jump to content

[HELP] onVehicleExplode


xXGhostXx

Recommended Posts

Posted (edited)

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
Posted
2 minutes ago, Emix said:

Who is your INTENDED person? You should provide player as 2nd arg so it wont be visible to everyone.

Intended for example : thePlayer or ...

My main problem : chat box in my script 2 times send but i want 1 times send chat box!

Posted (edited)
8 minutes ago, xXGhostXx said:

Intended for example : thePlayer or ...

player who owns that vehicle or player who was in a vehicle or smth... if you want to make it global use getRootElement()

Sry i dont understand what do ya want

 

Edited by Emix
Posted
2 minutes ago, Emix said:

player who owns that vehicle or player who was in a vehicle or smth... if you want to make it global use getRootElement()

Sry i dont understand what do ya want

 

Dear, i want when vehicle exploding 1 chat box sended no 2 chat box. 

Posted
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 .

Posted
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.

Posted
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 :(

Posted (edited)
----- 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
Posted

Guys what is problem in my code ?

function onVehicleRespawn ( exploded )
  if ( exploded == true ) then 
    outputChatBox("1")
  end
end
addEventHandler ( "onVehicleRespawn", getRootElement(), onVehicleRespawn )

 

Posted

Guys i want healthy function for make Insurance system.

Guys please see a my problems :

function BimeKamKon ()
	outputChatBox("ee")
end
addEventHandler("onVehicleExplode", getRootElement(), BimeKamKon)

2 Chat box sended :(

  • Moderators
Posted
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.

Posted
On 04/10/2019 at 11:08, xXGhostXx said:

Guys i want healthy function for make Insurance system.

Guys please see a my problems :


function BimeKamKon ()
	outputChatBox("ee")
end
addEventHandler("onVehicleExplode", getRootElement(), BimeKamKon)

2 Chat box sended :(

?

  • IIYAMA locked this topic
  • Moderators
Posted
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

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

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