triplesnake Posted August 3, 2012 Posted August 3, 2012 ok so this get's the killer and stuff 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?
TAPL Posted August 3, 2012 Posted August 3, 2012 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)
triplesnake Posted August 3, 2012 Author Posted August 3, 2012 mmm i am facing another little (ok not little ) problem well as i said it's for shooter so it won't get the killer cuz the rocket is a projectile anyway i can fix that?
TAPL Posted August 3, 2012 Posted August 3, 2012 projectile have creator check wiki https://wiki.multitheftauto.com/wiki/CreateProjectile creator: The element representing creator of the projectile. In case you want the projectile to be synced for everybody creator must be getLocalPlayer().
triplesnake Posted August 3, 2012 Author Posted August 3, 2012 projectile have creatorcheck wiki https://wiki.multitheftauto.com/wiki/CreateProjectile creator: The element representing creator of the projectile. In case you want the projectile to be synced for everybody creator must be getLocalPlayer(). but killer param doesn't exists on a death caused by an explosion
triplesnake Posted August 3, 2012 Author Posted August 3, 2012 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)
TAPL Posted August 3, 2012 Posted August 3, 2012 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)
triplesnake Posted August 3, 2012 Author Posted August 3, 2012 now it's shooting at me i think bec it's shooting down so i am killing myself
Anderl Posted August 3, 2012 Posted August 3, 2012 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?
triplesnake Posted August 3, 2012 Author Posted August 3, 2012 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
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