kevincouto6 Posted June 1, 2018 Share Posted June 1, 2018 Help me here hey, somebody could this function but she is not detecting when the veh Blow, somebody could help me Server: function blowveh4 (source) if (veh4[source]) and isElement(veh4[source]) then destroyElement (veh4[source]) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#ff0000Mission failled, your vehicle blow", source ,0,0,0,true) else end end addEventHandler ( "onVehicleExplode", getRootElement(), blowveh4 ) Link to comment
Hoffmann Posted June 1, 2018 Share Posted June 1, 2018 Function attached to event onVehicleExplode has no parameters. And source is an element that the event is originated from and it's predefined. I suppose it's just a fragment of full code. I can't see veh4 table and Bfim4 element declarations. Moreover, using outputChatBox for source element in this case doesn't make sense because source is actually a vehicle. Try this code and reply if it's working. function blowveh4 () --if (veh4[source]) and isElement(veh4[source]) then destroyElement (source) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#ff0000Mission failled, your vehicle blow", root ,0,0,0,true) --else --end end addEventHandler ( "onVehicleExplode", getRootElement(), blowveh4 ) Link to comment
kevincouto6 Posted June 1, 2018 Author Share Posted June 1, 2018 5 minutes ago, NeverUnbeatable said: Function attached to event onVehicleExplode has no parameters. And source is an element that the event is originated from and it's predefined. I suppose it's just a fragment of full code. I can't see veh4 table and Bfim4 element declarations. Moreover, using outputChatBox for source element in this case doesn't make sense because source is actually a vehicle. Try this code and reply if it's working. function blowveh4 () --if (veh4[source]) and isElement(veh4[source]) then destroyElement (source) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#ff0000Mission failled, your vehicle blow", root ,0,0,0,true) --else --end end addEventHandler ( "onVehicleExplode", getRootElement(), blowveh4 ) Mission There are other missions together so I need to specify the vehicle that blows because of this. But it does not work what you suggest. Mfim4 = createMarker ( -1875.0139160156, -1474.5141601563, 1 -1, "ring", 4, 0 ,255 ,0, 255) Bfim4 = createBlipAttachedTo ( Mfim4, 20 ) setElementVisibleTo ( Bfim4, root, false ) veh4 = {} function inicio4 () if isElement (veh4[client]) then -- Client = localPlayer, somente neste caso. destroyElement (veh4[client]) veh4[client] = nil end Trabalho = true veh4[client] = createVehicle (493, -615.03826904297, 1807.0825195313, 0.19021162390709, 0, 0, 76.391845703125) setElementVisibleTo ( Bfim4, client, true ) warpPedIntoVehicle (client, veh4[client]) outputChatBox ("#ffff00Take this Flag Card without leaving the vehicle!", client, 0, 0, 0, true) end addEvent ("iniciaJob4", true) -- Cria o evento "iniciaJob e permite que ele seja chamado pelo client. addEventHandler ("iniciaJob4", getRootElement(), inicio4) -- Executa essa função quando o evento "iniciaJob" for chamado. function fim4 (source) if veh4[source] and isElement(veh4[source]) then destroyElement (veh4[source]) givePlayerMoney(source,200000) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#00ff00você Ganhou $10000 Pela Entrega,Parabéns!",source,0,0,0,true) else end end addEventHandler("onMarkerHit",Mfim4 ,fim4) function sair4 (source) if (veh4[source]) and isElement(veh4[source]) then destroyElement (veh4[source]) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#ff0000Você Perdeu o Trabalho Ao Sair Do Veículo", source ,0,0,0,true) else end end addEventHandler ( "onVehicleExit", getRootElement(), sair4 ) function blowveh4 () if (veh4[source]) and isElement(veh4[source]) then destroyElement (source) setElementVisibleTo ( Bfim4, source, false ) outputChatBox("#ff0000Mission failled, your vehicle blow", root ,0,0,0,true) else end end addEventHandler ( "onVehicleExplode", getRootElement(), blowveh4 ) Link to comment
Hoffmann Posted June 1, 2018 Share Posted June 1, 2018 onVehicleExplode is a serverside event though. Use onClientVehicleExplode instead. Link to comment
kevincouto6 Posted June 1, 2018 Author Share Posted June 1, 2018 1 minute ago, NeverUnbeatable said: onVehicleExplode is a serverside event though. Use onClientVehicleExplode instead. script is serverside 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