Jump to content

Remove vehicles and jetpack ?


Recommended Posts

Posted

Hello .

i create a col shape .

local tempCol = createColCuboid ( 2360.6469726563,-1803.5179443359,1442.5999755859, 500, 120, 10.0 ) 

and when i hit this col shape only .I want to toggle vehicles and jetpack off there .

and toggle them back on when i exit col shape .

Posted

what do you mean by toggel them off ?

you want to destory vehilces & JetPacks in the col Shape if you enter

and create them back if you exit ?

Posted
what do you mean by toggel them off ?

you want to destory vehilces & JetPacks in the col Shape if you enter

and create them back if you exit ?

if someone entred the colshape with car , his car destroyed or something , and jetpack . he can't use them in the colshape

Posted (edited)

Try this --- ServerSide

local tempCol = createColCuboid ( 2360.6469726563,-1803.5179443359,1442.5999755859, 500, 120, 10.0 ) 
addEventHandler("onColShapeHit",resourceRoot, 
function ( player ) 
 if ( isElementWithinColShape ( player, tempCol ) ) then 
 if ( doesPedHaveJetPack ( player ) ) and ( isPedInVehicle ( player )) then 
    removePedJetPack ( player ) 
    removePedFromVehicle ( player ) 
    outputChatBox ( ' You Cant Use JetPack Or Vehicle in Here ',player, 255, 0, 0 ) 
     end 
    end 
end 
) 

Edited #

Edited by Guest
Posted
Try this --- ClientSide

local tempCol = createColCuboid ( 2360.6469726563,-1803.5179443359,1442.5999755859, 500, 120, 10.0 ) 
addEventHandler("onClientColShapeHit",tempCol, 
function ( theElement )  
if ( theElement == localPlayer ) then 
if ( doesPedHaveJetPack ( theElement ) ) then 
   removePedJetPack ( theElement )  
    vehicles = getElementsByType("vehicle") 
    for _,v in ipairs(vehicles) do 
    destroyElement ( v ) 
    outputChatBox ( ' You Cant Use JetPack Or Vehicle in Here ', 255, 0, 0 ) 
     end 
    end 
  end 
end 
) 

Not working :[

Posted
@Max+ : Your Code For Hit In Marker Not With In Marker ..

Try To Use setTimer ..

?

onClientColShapeHit

it's for col shapes !

Posted

local colshape = createColCuboid ( .... ) 
local Timer = {   }; 
  
addEventHandler( "onColShapeHit", resourceRoot, function ( element ) 
  if ( source == colshape ) then 
   if ( getElementType ( element ) == "player" ) then 
    if ( isTimer ( Timer[ element ] ) ) then killTimer ( Timer[ element ] ) end 
       Timer[ element ] = setTimer ( function ( element ) 
        if ( isElementWithinColShape ( element, colshape ) ) then 
          if ( doesPedHaveJetPack ( element ) ) then 
              removePedJetPack ( element ) 
          end 
          if ( getPedOccupiedVehicle( element ) ) then 
              destroyElement ( getPedOccupiedVehicle( element ) ) 
         end 
      else 
           killTimer ( Timer[ element ] ) 
       end, 100, 0, element ) 
     end 
   end 
end )    
  
  
addEventHandler( "onColShapeLeave", resourceRoot, function ( element ) 
   if ( source == colshape ) then 
     if ( getElementType ( element ) == "player" ) then 
        if ( isTimer ( Timer[ element ] ) ) then  
            killTimer ( Timer[ element ] ) 
            Timer[ element ] = nil 
         end 
      end 
   end 
end ) 
Posted
local colshape = createColCuboid ( .... ) 
local Timer = {   }; 
  
addEventHandler( "onColShapeHit", resourceRoot, function ( element ) 
  if ( source == colshape ) then 
   if ( getElementType ( element ) == "player" ) then 
    if ( isTimer ( Timer[ element ] ) ) then killTimer ( Timer[ element ] ) end 
       Timer[ element ] = setTimer ( function ( element ) 
        if ( isElementWithinColShape ( element, colshape ) ) then 
          if ( doesPedHaveJetPack ( element ) ) then 
              removePedJetPack ( element ) 
          end 
          if ( getPedOccupiedVehicle( element ) ) then 
              destroyElement ( getPedOccupiedVehicle( element ) ) 
         end 
      else 
           killTimer ( Timer[ element ] ) 
       end, 100, 0, element ) 
     end 
   end 
end )    
  
  
addEventHandler( "onColShapeLeave", resourceRoot, function ( element ) 
   if ( source == colshape ) then 
     if ( getElementType ( element ) == "player" ) then 
        if ( isTimer ( Timer[ element ] ) ) then  
            killTimer ( Timer[ element ] ) 
            Timer[ element ] = nil 
         end 
      end 
   end 
end ) 

why the timer is needed here ?

Posted
if u hit the colshape and with Jet or Vehicle it destroyed .. then ? But if I take a jet or vehicle again !!

but it's when he enter the col every time he get in it's get destroyed .

  • Like 1
Posted
Try this --- ServerSide

local tempCol = createColCuboid ( 2360.6469726563,-1803.5179443359,1442.5999755859, 500, 120, 10.0 ) 
addEventHandler("onColShapeHit",resourceRoot, 
function ( player ) 
 if ( isElementWithinColShape ( player, tempCol ) ) then 
 if ( doesPedHaveJetPack ( player ) ) and ( isPedInVehicle ( player )) then 
    removePedJetPack ( player ) 
    removePedFromVehicle ( player ) 
    outputChatBox ( ' You Cant Use JetPack Or Vehicle in Here ',player, 255, 0, 0 ) 
     end 
    end 
end 
) 

Edited #

well , not working :/

local colshape = createColCuboid ( .... ) 
local Timer = {   }; 
  
addEventHandler( "onColShapeHit", resourceRoot, function ( element ) 
  if ( source == colshape ) then 
   if ( getElementType ( element ) == "player" ) then 
    if ( isTimer ( Timer[ element ] ) ) then killTimer ( Timer[ element ] ) end 
       Timer[ element ] = setTimer ( function ( element ) 
        if ( isElementWithinColShape ( element, colshape ) ) then 
          if ( doesPedHaveJetPack ( element ) ) then 
              removePedJetPack ( element ) 
          end 
          if ( getPedOccupiedVehicle( element ) ) then 
              destroyElement ( getPedOccupiedVehicle( element ) ) 
         end 
      else 
           killTimer ( Timer[ element ] ) 
       end, 100, 0, element ) 
     end 
   end 
end )    
  
  
addEventHandler( "onColShapeLeave", resourceRoot, function ( element ) 
   if ( source == colshape ) then 
     if ( getElementType ( element ) == "player" ) then 
        if ( isTimer ( Timer[ element ] ) ) then  
            killTimer ( Timer[ element ] ) 
            Timer[ element ] = nil 
         end 
      end 
   end 
end ) 

not working also :/

Posted

"It doesn't work, help!", "It doesn't work, fix it!", "It do"... Tell us what DOESN'T work, tell us what DEBUGSCRIPT 3 gives... Saying "It doesn't work" doesn't help us at ALL to help you.......

Posted
"It doesn't work, help!", "It doesn't work, fix it!", "It do"... Tell us what DOESN'T work, tell us what DEBUGSCRIPT 3 gives... Saying "It doesn't work" doesn't help us at ALL to help you.......

well i gave you the col shape code ,thats what i can do , itried what they gave me and its not working , if you don't like to help don't help me .

Posted
Maybe I'd want to help, but it's easier for us if you tell us what doesn't work.

ok .

i tried this and i don't know why its not working ? any idea ?

local hayMarker2 = createMarker (2614.2666015625,-1754.1813964844,1442.5999755859, "cylinder", 290, 2500, 0, 0, 100, getRootElement()) 
setElementVisibleTo (hayMarker2,root,false  ) 
  
function jetpackremove (player) 
  if doesPedHaveJetPack( player )  then 
   removePedJetPack ( player )    
end 
end 
addEventHandler ("onMarkerHit", hayMarker2, jetpackremove) 

Posted

i forget end ... try this

and don't forget remove .... and put your colshape args

local colshape = createColCuboid ( .... ) 
local Timer = {   }; 
  
addEventHandler( "onColShapeHit", resourceRoot, function ( element ) 
  if ( source == colshape ) then 
   if ( getElementType ( element ) == "player" ) then 
    if ( isTimer ( Timer[ element ] ) ) then killTimer ( Timer[ element ] ) end 
       Timer[ element ] = setTimer ( function ( element ) 
        if ( isElementWithinColShape ( element, colshape ) ) then 
          if ( doesPedHaveJetPack ( element ) ) then 
              removePedJetPack ( element ) 
          end 
          if ( getPedOccupiedVehicle( element ) ) then 
              destroyElement ( getPedOccupiedVehicle( element ) ) 
         end 
      else 
           killTimer ( Timer[ element ] ) 
         end   
       end, 100, 0, element ) 
     end 
   end 
end )   
  
  
addEventHandler( "onColShapeLeave", resourceRoot, function ( element ) 
   if ( source == colshape ) then 
     if ( getElementType ( element ) == "player" ) then 
        if ( isTimer ( Timer[ element ] ) ) then 
            killTimer ( Timer[ element ] ) 
            Timer[ element ] = nil 
         end 
      end 
   end 
end ) 
  • 2 years later...

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...