Jump to content

Fixing vechile in shooter


Recommended Posts

ok so this get's the killer and stuff :P

function onWasted(killer, weapon, bodypart) 
    if ( killer and getElementType(killer) == "player" and getElementType(source) == "player" ) then 
       givePlayerMoney ( killer, 1000 ) 
        outputChatBox(getPlayerName(killer).." has killed ".. getPlayerName(source) .."!!!") 

now i want it to fix the killer's vechile how to do that?

Link to comment
addEventHandler("onPlayerWasted", root, 
function(_,killer) 
     if killer and getElementType(killer) == "player" then 
          givePlayerMoney(killer, 1000) 
          outputChatBox(getPlayerName(killer).." has killed "..getPlayerName(source).."!!!",root,255,255,255) 
          local veh = getPedOccupiedVehicle(killer) 
          if veh then fixVehicle(veh) end 
     end 
end) 

Link to comment
Show the projectile code.

function rocket() 
    theVehicle = getPedOccupiedVehicle(lplay) 
    if (bindTrigger == 1) and (not isPlayerDead(lplay)) and (isElement(theVehicle)) then 
        bindTrigger = 0 
        local x,y,z = getElementPosition(theVehicle) 
        local rX,rY,rZ = getVehicleRotation(theVehicle) 
        local x = x+4*math.cos(math.rad(rZ+90)) 
        local y = y+4*math.sin(math.rad(rZ+90)) 
        createProjectile(theVehicle, 19, x, y, z, 1.0, nil) 
        setTimer(allowShoots, 3500, 1) 

Link to comment

Try

function rocket() 
    theVehicle = getPedOccupiedVehicle(lplay) 
    if (bindTrigger == 1) and (not isPlayerDead(lplay)) and (isElement(theVehicle)) then 
        bindTrigger = 0 
        local x,y,z = getElementPosition(theVehicle) 
        local rX,rY,rZ = getVehicleRotation(theVehicle) 
        local x = x+4*math.cos(math.rad(rZ+90)) 
        local y = y+4*math.sin(math.rad(rZ+90)) 
        createProjectile(lplay, 19, x, y, z, 1.0, nil) 
        setTimer(allowShoots, 3500, 1) 

Link to comment
Try
function rocket() 
    theVehicle = getPedOccupiedVehicle(lplay) 
    if (bindTrigger == 1) and (not isPlayerDead(lplay)) and (isElement(theVehicle)) then 
        bindTrigger = 0 
        local x,y,z = getElementPosition(theVehicle) 
        local rX,rY,rZ = getVehicleRotation(theVehicle) 
        local x = x+4*math.cos(math.rad(rZ+90)) 
        local y = y+4*math.sin(math.rad(rZ+90)) 
        createProjectile(lplay, 19, x, y, z, 1.0, nil) 
        setTimer(allowShoots, 3500, 1) 

Where is "lplay" defined?

Link to comment
Try
function rocket() 
    theVehicle = getPedOccupiedVehicle(lplay) 
    if (bindTrigger == 1) and (not isPlayerDead(lplay)) and (isElement(theVehicle)) then 
        bindTrigger = 0 
        local x,y,z = getElementPosition(theVehicle) 
        local rX,rY,rZ = getVehicleRotation(theVehicle) 
        local x = x+4*math.cos(math.rad(rZ+90)) 
        local y = y+4*math.sin(math.rad(rZ+90)) 
        createProjectile(lplay, 19, x, y, z, 1.0, nil) 
        setTimer(allowShoots, 3500, 1) 

Where is "lplay" defined?

earlier in the script defined as localplayer

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