Jump to content

Some Help in PlayerWasted!


^Dev-PoinT^

Recommended Posts

Hi all i made this but i want killer kill a player got 1 if he kill another player give second start ... 6 starts

addEventHandler("onPlayerWasted", getRootElement(), 
function(ammo, killer, weapon, bodypart) 
    if source then 
        if (bodypart == 4) then 
            outputChatBox("#Outch ! " ..getPlayerName(killer).. " has shot in your ass !", source, 255, 255, 0, true) 
        elseif (bodypart == 9)then 
            outputChatBox("#OWNED ! "..getPlayerName(killer).." has shot in your head !", source, 255, 255, 0, true) 
        else 
            outputChatBox(getPlayerName(killer).."# has kill you ! Now Kill him Noob -_-'", source, 255, 255, 0, true) 
        end 
    end 
end) 
  
addEventHandler("onPlayerWasted", getRootElement(), 
function(ammo, killer, weapon, bodypart) 
    if killer then 
        local stars = getPlayerWantedLevel(killer) 
        setPlayerWantedLevel(killer, stars+1) 
        else if WantedLevel = 1 then 
        setPlayerWantedLevel(killer, stars+2) 
        else if WantedLevel = 3 then 
        setPlayerWantedLevel(killer, stars+3) 
        outputChatBox(getPlayerName(killer) .. "Has Now 6 Wanted Start Watch out! ", 255, 255, 0, true) 
    end 
end) 

sry for bad english :)

Link to comment
addEventHandler("onPlayerWasted", getRootElement(), 
function(ammo, killer, weapon, bodypart) 
    if source then 
        if (bodypart == 4) then 
            outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) 
        elseif (bodypart == 9)then 
            outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) 
        else 
            outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) 
        end 
    end 
end) 
  
addEventHandler("onPlayerWasted", getRootElement(), 
function(ammo, killer, weapon, bodypart) 
    if killer then 
        local stars = getPlayerWantedLevel(killer) 
        if stars == 0 then 
            setPlayerWantedLevel(killer, stars+1) 
        else if stars == 1 then 
            setPlayerWantedLevel(killer, stars+2) 
        else if stars == 3 then 
           setPlayerWantedLevel(killer, stars+3) 
           outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) 
        end 
    end 
end) 

Fixed the whole thing (including the grammar), should work now

Link to comment
addEventHandler("onPlayerWasted", getRootElement(), 
function(ammo, killer, weapon, bodypart) 
    if (killer) then 
        if (bodypart == 4) then 
            outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) 
        elseif (bodypart == 9)then 
            outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) 
        else 
            outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) 
    end 
    if (killer ~= source) then 
        local stars = getPlayerWantedLevel(killer) 
        if (stars == 0) then 
            setPlayerWantedLevel(killer, stars+1) 
        elseif (stars == 1) then 
            setPlayerWantedLevel(killer, stars+2) 
        elseif (stars == 3) then 
           setPlayerWantedLevel(killer, stars+3) 
           outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) 
           end 
        end 
    end 
end) 

Edited by Guest
Link to comment

"if (source) then" -- is useless and wrong. source always exists, or there wouldnt be an event otherwise.

you need to check if killer exists, because if it's not, getPlayerName(killer) will cause an error.

addEventHandler("onPlayerWasted", root, 
function(ammo, killer, weapon, bodypart) 
    if (killer) then  
        if (bodypart == 4) then 
            outputChatBox("#Ouch ! " ..getPlayerName(killer).. " shot you in your ass!", source, 255, 255, 0, true) 
        elseif (bodypart == 9) then 
            outputChatBox("#OWNED ! "..getPlayerName(killer).." shot you in your head!", source, 255, 255, 0, true) 
        else 
            outputChatBox("# "..getPlayerName(killer).." killed you! Now kill him, noob! -_-'", source, 255, 255, 0, true) 
        end 
        if (killer ~= source) then 
            local stars = getPlayerWantedLevel(killer) 
            if (stars == 0) then 
                setPlayerWantedLevel(killer, stars+1) 
            elseif (stars == 1) then 
                setPlayerWantedLevel(killer, stars+2) 
            elseif (stars == 3) then 
                setPlayerWantedLevel(killer, stars+3) 
                outputChatBox(getPlayerName(killer) .. " now has 6 wanted stars! Watch out!", 255, 255, 0, true) 
            end 
        end 
    end   
end) 

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