Jump to content

give money for kill


Recommended Posts

Can anyone give me or help me create a script that would give money to a player if they get a kill.

I have a zombie server and im trying to make it werew if you killa "zombie bot" you will get 100 or 200 dollars and i went thru wiki mta a couldnt find it. can anyone help.

I also need to know if anyone could help me with a vending machine that sells wepons. ive seen both done on my friends server but he and i arnt friends and he wont talk to me or tell me. any help would be awsome.

my servers name is "Zombies Are Evil".

Link to comment

I beleive I can help with this. normally you would use onPedWasted to detect if a ped gets killed, but doing that would trigger for any type of ped, not just zombies. so here's a solution:

I've recently discovered the usefulness of triggering custom events in my scripts so other resources can take advantage.

if i were to add a "onZombieWasted" event, to the script, you could use it to trigger your script to give a reward.

aaaaaaaaaaaaaand done! go update before reading further

her're how it works:

EVENT NAME: OnZombieWasted

PARAMETERS: element killer, int killerWeapon, int bodypart

SOURCE: the de-animated zombie

any questions or other suggestions, post in the zombie resource thread.

Link to comment
do you think you could show me how to set it up to make the zombies drop money or to give player money on kill.
addEventHandler( "onZombieWasted", getRootElement(),
function( killer )
givePlayerMoney( killer, 100 );
end
)

Link to comment

idk. i cant add it and mta wiki aint helping its got a crappy expanation. im about to just give up.

do you guys see any errors?

this is what my meta.XML says.

<meta>
    <info author="mtafourm" type="include" name="Zombies Are Evil" description="reward for zombies killed" />
    <script src="script.lua" />
</meta>

and this is what my script.LUA says

addEventHandler( "onZombieWasted", getRootElement(),   function( killer )        givePlayerMoney( killer, 100 );    end)

Link to comment

Why is the explanation crappy? Explain little more so we can fix it.

meta.xml is fine although you should change the "type".

type: The type of this resource, that can be "gamemode", "script", "map" or "misc".

These are "supported" types of resource and I'd recommend you stick to those because when you decide to upload your resource on community.multitheftauto.com you will get an error message.

Make sure you start this resource or it in other resource to start automatically.

Link to comment

I finally got it to give me money when i kill a zombie thanks to 50. lol

But of course there is another problem. when i open um my admin panel or the f1 panel it wont let me click on anything.

iIm using the z-day mod by slouthman and everysince i got it f1 panel and admin panel dont work. do you know how to fix this problem.

thankyou

juggalo 101

Link to comment
  • 1 year later...

Well, you shouldn't bump old topics, but such script to give the killer money it's easy to do.

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",getRootElement(), 
function (killer) 
givePlayerMoney(killer,math.random(100,200)) 
end) 

That should work.

Link to comment
addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",getRootElement(), 
function (killer) 
givePlayerMoney(killer,math.random(100,200)) 
end) 

That should work.

Strange, but it doesn't work. :(

Well, you shouldn't bump old topics, but such script to give the killer money it's easy to do.

P.S. Should i create new topic to decide this problem?

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