Jump to content

[help] Hitman System


Recommended Posts

The function of this script is for a reward upon a player

example / hitman (nameplayer) (reward)

And so a player kill player chosen it gets the value promised

But it does not work what i did wrong?

HitmanEvent = { 
    reward = 0, 
} 
  
function Hitman( player, ammo, attacker, weapon, bodypart ) 
        if attacker then 
            if ( getElementType ( attacker ) == "player" ) then 
                if ( source == HitmanEvent.element ) then 
                    if HitmanEvent.reward > 0 then 
                        givePlayerMoney(attacker,HitmanEvent.reward) 
                        outputChatBox("O player " .. getPlayerName(source) .. " está morto!",getRootElement(),255,255,255,true) 
                        outputChatBox("Matador: ".. getPlayerName(attacker) .. " ",getRootElement(),255,255,255,true) 
                        outputChatBox("Recompensa: ".. tostring(HitmanEvent.reward) .. " -") 
                        if getWeaponNameFromID(weapon) then 
                            outputChatBox("arma: ".. getWeaponNameFromID(weapon) .. "-- ") 
  
                        HitmanEvent.HitmanOn = false 
                        HitmanEvent.Element = nil 
                        HitmanEvent.reward = 0 
                    else 
                        outputChatBox("A recompensa pela morte é de $0!",attacker) 
                        HitmanEvent.HitmanOn = false 
                        HitmanEvent.playerElement = nil 
                        HitmanEvent.reward = 0 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler("onPlayerWasted",getRootElement(),PlayerWasted) 
  
function startHitman(player, commandName,cReward) 
    if not HitmanEvent.HitmanOn then 
        if cReward and tonumber(cReward) > 0 then 
            HitmanEvent.HitmanOn = true 
            HitmanEvent.reward = cReward 
            player = getPlayerCurtName 
        else 
            outputChatBox("/".. commandName .. " [Reward]",player) 
        end 
    else 
        HitmanEvent.HitmanOn = false 
        HitmanEvent.Element = nil 
        HtmanEvent.reward = 0 
    end 
end 
addCommandHandler("hitman",startHitman) 
  
function isPlayerHitman(thePlayer) 
    if player == HitmanEvent.HitmanElement then 
        return true 
    else 
        return false 
    end 
end 

HELP-ME

Sorry my bad English i'm Brazilian

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