Jump to content

Script help


jkub

Recommended Posts

  • Replies 109
  • Created
  • Last Reply

Top Posters In This Topic

I want it to where you shoot someone in there head and you get $1000 dollars. but any other limbs you only get $250 but instead this gives you the combined $1250 anywhere you kill someone?

function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) 
  
        --if there is a killer, and that killer is not the same person as whoever died 
        if ( killer ) and ( killer ~= source ) then  
                givePlayerMoney ( killer, 250 ) --reward the killer with 1000 cash. 
                if ( bodypart ) and ( bodypart ~= "9" ) then 
                givePlayerMoney ( killer, 1000 ) 
        end 
end 
  
end 
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) --attach the rewardOnWasted function to the relevant event.  

Link to comment

In your code:

1. You give killer money if somebody dies not getting hit

2. You give $1000 if player was not killed in the head

3. You give $250 if player is killed

That's why you get $1250 when you kill somebody.

Try this one:

addEventHandler( "onPlayerDamage", getRootElement(), 
    function( attaker, weap, bodypart ) -- attach an anonymous function 
        if attacker and getElementType( attacker ) == "player" then -- check if attacker is player 
            if bodypart == 9 then -- if player hit your head, give him 1000 
                givePlayerMoney( attacker, 1000 ) 
            else -- if any other part, just give him 250 
                givePlayerMoney( attacker, 250 ) 
            end 
        end 
    end 
) 

Link to comment
  • 2 weeks later...

I have had multiple request to get some kind of jailing system in my server. but i guess it could be somthing simple. like I make an enclosed space somewhere in the map with my map editor and when ur arrested have the criminal be warped into the space and able not to use any functions for 1 minute. he will not be able to do any freeroam commands. after that 1 minute is up he is released back at the regular spawn point of the server with all of his functions enabled again.

anyway the way of arresting should be

1 hitting the player with a nightstick ONCE

2 as a alternative to the first way>>> via admin only command

I remember seeing someone with a script similir on the forum.

Link to comment
  • 2 months later...

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