Padul Posted March 8, 2017 Share Posted March 8, 2017 if clientSyrenaState == 1 then syrena = playSound3D ( "shrtvaw.ogg" , x, y, z, true ) setElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena",syrena) attachElements(syrena,playerOccupiedRadiolka) elseif clientSyrenaState == 2 then destroyElement(syrena) triggerServerEvent( "usunDateBoPoChujOna" ,localPlayer) syrena = playSound3D ( "lngvaw.ogg" , x, y, z, true ) setElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena",syrena) attachElements ( syrena, playerOccupiedRadiolka ) elseif clientSyrenaState == 0 then destroyElement(syrena) triggerServerEvent( "usunDateBoPoChujOna" ,localPlayer) end warning @ destroy element ( expetced element, got nill ) Link to comment
Mr_Moose Posted March 8, 2017 Share Posted March 8, 2017 You need to check if the element exist before trying to remove it: if theElement and isElement(theElement) then destroyElement(theElement) end Link to comment
Padul Posted March 8, 2017 Author Share Posted March 8, 2017 now it does not appear in the debugscript but the element still is not destroyed Link to comment
Mr_Moose Posted March 8, 2017 Share Posted March 8, 2017 Are you sure that you're checking and destroying the same element then ( syrena ). Link to comment
Moderators Citizen Posted March 8, 2017 Moderators Share Posted March 8, 2017 Once you have set the element data, you can get it back by using getElementData if clientSyrenaState == 1 then local syrena = playSound3D ( "shrtvaw.ogg" , x, y, z, true ) setElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena",syrena) -- set the element data for syrena attachElements(syrena,playerOccupiedRadiolka) elseif clientSyrenaState == 2 then local syrena = getElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena") -- get the element data for syrena destroyElement(syrena) triggerServerEvent( "usunDateBoPoChujOna" ,localPlayer) syrena = playSound3D ( "lngvaw.ogg" , x, y, z, true ) setElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena",syrena) -- set the element data for syrena attachElements ( syrena, playerOccupiedRadiolka ) elseif clientSyrenaState == 0 then local syrena = getElementData(playerOccupiedRadiolka,"radiolka:syrenaClientSyrena") -- get the element data for syrena destroyElement(syrena) triggerServerEvent( "usunDateBoPoChujOna" ,localPlayer) end Link to comment
Padul Posted March 8, 2017 Author Share Posted March 8, 2017 i have finaly done that local syrena={} if signal=="slow" then syrena[veh]=playSound3D("shrtvaw.ogg",x,y,z,true) attachElements(syrena[veh],veh) elseif signal=="fast" then destroyElement(syrena[veh]) syrena[veh]=playSound3D("lngvaw.ogg",x,y,z,true) attachElements(syrena[veh],veh) else destroyElement(syrena[veh]) end 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