ksTakor Posted April 23, 2013 Share Posted April 23, 2013 I am trying to make an script that when some types of vehicle fall in the water after 30 seconds it explode. How can i make the function blowVehicle only explode the vehicles id's that i want? And how to set a timer to only explode after 30 seconds when fall in water? Searching in the forum I find this script: function blow() for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if isElementInWater ( vehicle ) then blowVehicle ( vehicle, true ) outputChatBox(getPlayerName(source).." #0099FFToco el agua y exploto!",getRootElement(), 255, 255, 255, true) end end end addEventHandler ( "onClientPlayerWasted",getRootElement(), blow) Can you help me modificate this? Link to comment
ksTakor Posted April 23, 2013 Author Share Posted April 23, 2013 Like this? function blow() for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if isElementInWater ( vehicle ) then local id = getElementModel ( vehicle ) if id == 470 or id == 422 or id == 437 or id == 433 or id == 497 or id == 487 or id == 468 then setTimer (blowater, 30000, 1) else end end end addEventHandler ( "onVehicleDrown",getRootElement(), blow) function blowater () blowVehicle (vehicle, true) end Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 Try this ; server ; VehiclesID = { [470]=true,[422]=true,[437]=true,[433]=true,[497]=true,[478]=true,[468]=true } addEventHandler("onResourceStart",resourceRoot, function ( ) setTimer( function ( ) for _,v in pairs ( getElementsByType("player") ) do local vehicle = getPedOccupiedVehicle(v) if not vehicle then return end if isElementInWater ( vehicle ) then if ( VehiclesID[getElementModel(vehicle)] ) then setTimer( function( ) blowVehicle( vehicle ) end,3000,1) end end end end,250,0,v) end ) Link to comment
ksTakor Posted April 23, 2013 Author Share Posted April 23, 2013 But that only work if the ped stay the 30 seconds or if the ped hit the water with the car? Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 This will check if the vehicle if it is in the water after 3 sec the vehicle blowed ;p . Link to comment
ksTakor Posted April 23, 2013 Author Share Posted April 23, 2013 It has other way? Because its a dayz gamemode and I don't want my player dead, I only want blow the vehicle to respawn. The event isElementInWater bug in server sided, can I make this script client side? Because if the player is killed he loses his itens. Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 Try this ; VehiclesID = { [470]=true,[422]=true,[437]=true,[433]=true,[497]=true,[478]=true,[468]=true } addEventHandler("onClientResourceStart",resourceRoot, function ( ) setTimer( function ( ) local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end if isElementInWater ( vehicle ) then if ( VehiclesID[getElementModel(vehicle)] ) then setTimer( function( ) blowVehicle( vehicle ) end,1000,1) end end end,250,0) end ) Link to comment
ksTakor Posted April 23, 2013 Author Share Posted April 23, 2013 It works Thank you very much Now a question it has an way to output to a admin when a vehicles is blow? Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 Didn't understand what you said about output admin line ? Can you explain more! Link to comment
ksTakor Posted April 23, 2013 Author Share Posted April 23, 2013 when a vehicle blow. output a message that only admin can see? Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 Ah witch group you want to see it? Group Name = ? Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 If Will Try this ; client ; VehiclesID = { [470]=true,[422]=true,[437]=true,[433]=true,[497]=true,[478]=true,[468]=true } local allow = nil addEventHandler("onClientResourceStart",resourceRoot, function ( ) setTimer( function ( ) if allow then return end local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end if isElementInWater ( vehicle ) then if ( VehiclesID[getElementModel(vehicle)] ) then setTimer( function( ) allow = true triggerServerEvent("Data",localPlayer,vehicle) end,1000,1) end end end,250,0) end ) addEvent("allow",true) addEventHandler("allow",root, function () allow = nil end ) server ; addEvent("Data",true) addEventHandler("Data",root, function ( vehicle ) if not isPedInVehicle(source) then return end blowVehicle( vehicle ) if isObjectInACLGroup ("user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then outputChatBox("* The Player ; "..getPlayerName(source).." Vehicle Has Been Blowed!",getRootElement(),0,255,255,true) end triggerClientEvent(source,"allow",source) end ) And tell me what happened . Link to comment
iPrestege Posted April 23, 2013 Share Posted April 23, 2013 You're welcome Good luck . 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