Jump to content

Check for element


isa_Khamdan

Recommended Posts

show your full code.

sorry forgot to post the code xD

function Destroy( element ) 
  
  
  
    local Speed = getElementSpeed( element ) 
  
   if getElementType ( element ) == "vehicle" then 
  
   if Speed == 0 then    
  
       destroyElement( element ) 
  
  
  
  end 
  
 end 
  
end 

Link to comment
if isElement(element) and getElementType ( element ) == "vehicle" then 

Thanks it works but I have little problem with this code it doesn't work and there are no errors in debug :S

function Destroy2( element ) 
  
  
    if ( isElement(element) and getElementType (element) == "vehicle" ) then 
    local x,y,z = getElementRotation ( element ) 
     
        outputChatBox ( "Target player rotation: " .. z ) 
  
   if z == (z < 90) or z == (z > 270) then 
  
       destroyElement( element ) 
  
  
  
  end 
  
 end 
  
end 

Link to comment

Then your problem from line 9.

Why you need to do it like this?

if z == (z < 90) or z == (z > 270) then 

Try

if (z < 90) or (z > 270) then 

Because compare < or > will return true/false and z will be a number you can't compare it with bool,

Link to comment
Then your problem from line 9.

Why you need to do it like this?

if z == (z < 90) or z == (z > 270) then 

Try

if (z < 90) or (z > 270) then 

Because compare < or > will return true/false and z will be a number you can't compare it with bool,

It works perfectly now and thanks to you :D

else I have one more question how can I compare a number with a number between two numbers like 90 to 270?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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