Padul Posted March 8, 2017 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 )
Mr_Moose Posted March 8, 2017 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
Padul Posted March 8, 2017 Author Posted March 8, 2017 now it does not appear in the debugscript but the element still is not destroyed
Mr_Moose Posted March 8, 2017 Posted March 8, 2017 Are you sure that you're checking and destroying the same element then ( syrena ).
Moderators Citizen Posted March 8, 2017 Moderators 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
Padul Posted March 8, 2017 Author 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
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