Jump to content

Simple Help Request


Recommended Posts

Hi all

i tried to make script thats your vehicle fixed auto when you kill anyone for shooter servers but i dont know what the problem if anyone can help me please

function rewardOnWasted ( ammo, attacker, killerweapon, bodypart )

if ( attacker ) and ( attacker ~= source ) then

local veh = getPedOccupiedVehicle(attacker)

fixVehicle(veh)

end

end

addEventHandler ( "onPlayerWasted"

Link to comment

The function you gave is incomplete:

function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
    if ( attacker ) and ( attacker ~= source ) then 
        local veh = getPedOccupiedVehicle(attacker) 
        fixVehicle(veh) 
    end 
end 
addEventHandler ( "onPlayerWasted" 

I wrapped the code you sent into LUA tags so it's easier for you to read.

From first glance everything looks fine except from the event handler which is incomplete, try changing it to:

addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) 

Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler

Link to comment
The function you gave is incomplete:
function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
    if ( attacker ) and ( attacker ~= source ) then 
        local veh = getPedOccupiedVehicle(attacker) 
        fixVehicle(veh) 
    end 
end 
addEventHandler ( "onPlayerWasted" 

I wrapped the code you sent into LUA tags so it's easier for you to read.

From first glance everything looks fine except from the event handler which is incomplete, try changing it to:

addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) 

Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler

Thanks so much i will try it now

Link to comment
The function you gave is incomplete:
function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
    if ( attacker ) and ( attacker ~= source ) then 
        local veh = getPedOccupiedVehicle(attacker) 
        fixVehicle(veh) 
    end 
end 
addEventHandler ( "onPlayerWasted" 

I wrapped the code you sent into LUA tags so it's easier for you to read.

From first glance everything looks fine except from the event handler which is incomplete, try changing it to:

addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) 

Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler

it didnt work :(

Link to comment

Should work just fine

    function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
        if attacker and attacker ~= source then 
            local veh = getPedOccupiedVehicle(attacker) 
            fixVehicle(veh) 
        end 
    end 
    addEventHandler("onPlayerWasted",root, rewardOnWasted) 

Link to comment
Should work just fine
    function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
        if attacker and attacker ~= source then 
            local veh = getPedOccupiedVehicle(attacker) 
            fixVehicle(veh) 
        end 
    end 
    addEventHandler("onPlayerWasted",root, rewardOnWasted) 

it didnt work :/

Link to comment
 function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
        if attacker and attacker ~= source then 
            local veh = getPedOccupiedVehicle(attacker) 
            if veh then 
                fixVehicle(veh) 
            else 
                outputChatBox("The player you killed was not in a vehicle.", attacker, 255, 0, 0) 
            end 
        end 
    end 
addEventHandler("onPlayerWasted",root, rewardOnWasted) 

This should help determine why it isn't working. Remember as Karim said this is triggered when the player dies.

Link to comment
 function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) 
        if attacker and attacker ~= source then 
            local veh = getPedOccupiedVehicle(attacker) 
            if veh then 
                fixVehicle(veh) 
            else 
                outputChatBox("The player you killed was not in a vehicle.", attacker, 255, 0, 0) 
            end 
        end 
    end 
addEventHandler("onPlayerWasted",root, rewardOnWasted) 

This should help determine why it isn't working. Remember as Karim said this is triggered when the player dies.

thanks i will test it now , do you have skype ?

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