Jump to content

I need help


AlphaMark

Recommended Posts

I have this atm. (Im not an good scripter)

function checkforVehicle ( thePlayer ) 
local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
if theVehicle then 
    function createExplosionForPlayer ( thePlayer, command ) 
        timer = setTimer ( createJihadForPlayer, 2500, 1, thePlayer, x, y, z ) 
        triggerClientEvent ( "playTheSound", getRootElement(), thePlayer ) 
        setPedAnimation ( thePlayer, "BOMBER","BOM_Plant" ) 
    function createJihadForPlayer ( thePlayer, x, y, z ) 
        local x, y, z = getElementPosition ( thePlayer ) 
        local createdExplosion = createExplosion ( x, y, z, 2 ) 
        local createdExplosion = createExplosion ( x, y, z, 3 ) 
        local createdExplosion = createExplosion ( x, y, z, 10 ) 
        if ( createdExplosion == true ) then 
            outputChatBox ( getPlayerName ( thePlayer ) .." comitted a Jihad!" ) 
    else 
        outputChatBox ("You cant commit a Jihad in a vehicle!") 
        end 
    end 
end 
addCommandHandler ( "Jihad", createExplosionForPlayer ) 
addCommandHandler ( "jihad", createExplosionForPlayer ) 

Link to comment
I have this atm. (Im not an good scripter)
function checkforVehicle ( thePlayer ) 
local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
if theVehicle then 
    function createExplosionForPlayer ( thePlayer, command ) 
        timer = setTimer ( createJihadForPlayer, 2500, 1, thePlayer, x, y, z ) 
        triggerClientEvent ( "playTheSound", getRootElement(), thePlayer ) 
        setPedAnimation ( thePlayer, "BOMBER","BOM_Plant" ) 
    function createJihadForPlayer ( thePlayer, x, y, z ) 
        local x, y, z = getElementPosition ( thePlayer ) 
        local createdExplosion = createExplosion ( x, y, z, 2 ) 
        local createdExplosion = createExplosion ( x, y, z, 3 ) 
        local createdExplosion = createExplosion ( x, y, z, 10 ) 
        if ( createdExplosion == true ) then 
            outputChatBox ( getPlayerName ( thePlayer ) .." comitted a Jihad!" ) 
    else 
        outputChatBox ("You cant commit a Jihad in a vehicle!") 
        end 
    end 
end 
addCommandHandler ( "Jihad", createExplosionForPlayer ) 
addCommandHandler ( "jihad", createExplosionForPlayer ) 

    function createExplosionForPlayer ( thePlayer, command ) 
  
    local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
  
   if theVehicle then 
    
   return 
    
   else 
        timer = setTimer ( createJihadForPlayer, 2500, 1, thePlayer, x, y, z ) 
  
        triggerClientEvent ( "playTheSound", getRootElement(), thePlayer ) 
  
        setPedAnimation ( thePlayer, "BOMBER","BOM_Plant" ) 
    end 
end  
addCommandHandler ( "c1", createExplosionForPlayer ) 
  
    function createJihadForPlayer ( thePlayer, x, y, z ) 
     
        local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
  
   if theVehicle then 
    
   return 
    
   else 
  
        local x, y, z = getElementPosition ( thePlayer ) 
  
        local createdExplosion = createExplosion ( x, y, z, 2 ) 
  
        local createdExplosion = createExplosion ( x, y, z, 3 ) 
  
        local createdExplosion = createExplosion ( x, y, z, 10 ) 
  
        if ( createdExplosion == true ) then 
  
            outputChatBox ( getPlayerName ( thePlayer ) .." comitted a Jihad!" ) 
  
    else 
  
        outputChatBox ("You cant commit a Jihad in a vehicle!") 
  
        end 
  
    end 
end 
addCommandHandler ( "c2", createJihadForPlayer ) 

Link to comment
Its working but it doesnt show the "You cant commit a Jihad in a vehicle!"
   function createExplosionForPlayer ( thePlayer, command ) 
  
  
  
    local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
  
  
  
   if theVehicle then 
  
    
  
   return 
  
    
  
   else 
  
        timer = setTimer ( createJihadForPlayer, 2500, 1, thePlayer, x, y, z ) 
  
  
  
        triggerClientEvent ( "playTheSound", getRootElement(), thePlayer ) 
  
  
  
        setPedAnimation ( thePlayer, "BOMBER","BOM_Plant" ) 
  
    end 
  
end  
  
addCommandHandler ( "c1", createExplosionForPlayer ) 
  
  
  
    function createJihadForPlayer ( thePlayer, x, y, z ) 
  
     
  
        local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
  
  
  
   if theVehicle then 
  
    
  
   return 
  
    
  
   else 
  
  
  
        local x, y, z = getElementPosition ( thePlayer ) 
  
  
  
        local createdExplosion = createExplosion ( x, y, z, 2 ) 
  
  
  
        local createdExplosion = createExplosion ( x, y, z, 3 ) 
  
  
  
        local createdExplosion = createExplosion ( x, y, z, 10 ) 
  
  
  
        if not ( createdExplosion == true ) then 
  
         outputChatBox ("You cant commit a Jihad in a vehicle!") 
          
        else 
  
            outputChatBox ( getPlayerName ( thePlayer ) .." comitted a Jihad!" ) 
  
  
  
  
  
        end 
  
  
  
    end 
  
end 
  
addCommandHandler ( "c2", createJihadForPlayer ) 

Link to comment

The output was in the wrong place.

function createExplosionForPlayer(thePlayer, command) 
 if (isPedInVehicle(thePlayer)) then 
  outputChatBox("You can't commit a Jihad in a vehicle!", thePlayer) 
  return 
 end 
 setTimer(createJihadForPlayer, 2500, 1, thePlayer, x, y, z) 
 triggerClientEvent("playTheSound", root, thePlayer) 
 setPedAnimation(thePlayer, "BOMBER", "BOM_Plant") 
end 
addCommandHandler("c1", createExplosionForPlayer) 
  
function createJihadForPlayer(thePlayer, x, y, z) 
 if (isPedInVehicle(thePlayer)) then 
  outputChatBox("You can't commit a Jihad in a vehicle!", thePlayer) 
  return 
 end 
 local x, y, z = getElementPosition(thePlayer) 
 createExplosion(x, y, z, 2) 
 createExplosion(x, y, z, 3) 
 createExplosion(x, y, z, 10) 
 outputChatBox(getPlayerName(thePlayer) .. " committed a Jihad!", root) 
end 
addCommandHandler("c2", createJihadForPlayer) 

Edited by Guest
Link to comment
Hey, isn't it easier to use isPedInVehicle function?

Not that much of a difference as both do the same thing, except isPedInVehicle returns only a boolean while getPedOccupiedVehicle returns a boolean or element. Either way works, but as there is a function for isPedInVehicle I edited it to that.

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