Jump to content

Problem with this script.


WolfPire

Recommended Posts

So, hello guys, once again!

This is WolfPire here, and i'm making a script that consist on giving the player a certain ammount of money depending in which part of the body this player kills the other player!

So... For some reason it doesn't work... Can you guys please help me? (No errors in debug nor console)

CLIENT

function getWhere( killer ) 
    if source == "player" then 
    if getBodyPartName ( bodyPartID ) == 3 then 
        triggerServerEvent("hitonTorso", root, killer ) 
            else if getBodyPartName ( bodyPartID ) == 4 then 
                triggerServerEvent("hitonAss", root, killer ) 
                    else if getBodyPartName ( bodyPartID ) == 5 then 
                        triggerServerEvent("hitonRightArm", root, killer ) 
                            else if getBodyPartName ( bodyPartID ) == 6 then 
                                triggerServerEvent("hitonLeftArm", root, killer ) 
                                    else if getBodyPartName ( bodyPartID ) == 7 then 
                                        triggerServerEvent("hitonRightLeg", root, killer ) 
                                            else if getBodyPartName ( bodyPartID ) == 8 then 
                                                triggerServerEvent("hitonLeftLeg", root, killer ) 
                                                    else if getBodyPartName ( bodyPartID ) == 9 then 
                                                        triggerServerEvent("hitonHead", root, killer ) 
                                                        end 
                                                    end 
                                                end 
                                            end 
                                        end 
                                    end 
                                end 
                            end 
                        end 
  
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), getWhere ) 

SERVER

addEvent("hitonTorso", true) 
addEventHandler("hitonTorso",root, 
function( killer ) 
    givePlayerMoney ( killer, 500 ) 
end 
) 
  
addEvent("hitonAss", true) 
addEventHandler("hitonLeftArm",root, 
function( killer ) 
    givePlayerMoney ( killer, 100 ) 
end 
) 
  
addEvent("hitonLefttArm", true) 
addEventHandler("hitonLeftArm",root, 
function( killer ) 
    givePlayerMoney ( killer, 100 ) 
end 
) 
  
addEvent("hitonRightArm", true) 
addEventHandler("hitonRightArm",root, 
function( killer ) 
    givePlayerMoney ( killer, 100 ) 
end 
) 
  
addEvent("hitonLeftLeg", true) 
addEventHandler("hitonLeftArm",root, 
function( killer ) 
    givePlayerMoney ( killer, 100 ) 
end 
) 
  
addEvent("hitonRightLeg", true) 
addEventHandler("hitonRightArm",root, 
function( killer ) 
    givePlayerMoney ( killer, 100 ) 
end 
) 
  
addEvent("hitonHead", true) 
addEventHandler("hitonHead",root, 
function( killer ) 
    givePlayerMoney ( killer, 1000 ) 
end 
) 

If you guys could please help me once again, you would be getting this little guy out of a big whole =)

Thanks in advance! =)

Link to comment
function getWhere( ammo, killer, weapon, bodyPartID ) 
    if (killer and killer ~= source) then 
        if (bodyPartID == 3) then 
            givePlayerMoney(killer, 500) 
        elseif (bodyPartID == 4) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 5) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 6) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 7) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID ==  then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 9) then 
            givePlayerMoney(killer, 1000) 
        end 
    end 
end  
addEventHandler ( "onPlayerWasted", root, getWhere ) 

Link to comment
function getWhere( ammo, killer, weapon, bodyPartID ) 
    if (killer and killer ~= source) then 
        if (bodyPartID == 3) then 
            givePlayerMoney(killer, 500) 
        elseif (bodyPartID == 4) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 5) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 6) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 7) then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID ==  then 
            givePlayerMoney(killer, 100) 
        elseif (bodyPartID == 9) then 
            givePlayerMoney(killer, 1000) 
        end 
    end 
end  
addEventHandler ( "onPlayerWasted", root, getWhere ) 

You solved my life in 1 life lol

Nice job, solid =)

Once again, thank you! You are amazing =)

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