rikimaru263 Posted March 24, 2010 Share Posted March 24, 2010 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
Slothman Posted March 24, 2010 Share Posted March 24, 2010 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
rikimaru263 Posted March 24, 2010 Author Share Posted March 24, 2010 thank you so much. im runing your script right now on my server. Link to comment
rikimaru263 Posted March 25, 2010 Author Share Posted March 25, 2010 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. Link to comment
50p Posted March 25, 2010 Share Posted March 25, 2010 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
rikimaru263 Posted March 25, 2010 Author Share Posted March 25, 2010 thank you. im going to try to add it. you helped me alot. lol Link to comment
karlis Posted March 25, 2010 Share Posted March 25, 2010 isn't addEvent() needed for custom events? Link to comment
50p Posted March 25, 2010 Share Posted March 25, 2010 isn't addEvent() needed for custom events? No reason for this.. It's never disappointed me and always worked without adding it if it already exists. Link to comment
rikimaru263 Posted March 25, 2010 Author Share Posted March 25, 2010 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
50p Posted March 25, 2010 Share Posted March 25, 2010 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
rikimaru263 Posted March 25, 2010 Author Share Posted March 25, 2010 what more do you need to know? thank you for helping. Link to comment
rikimaru263 Posted March 25, 2010 Author Share Posted March 25, 2010 Were am i suposta put the file. i tried to make a new resource with it and it wont work. please help Link to comment
50p Posted March 26, 2010 Share Posted March 26, 2010 Have you tried to put addEvent( "onZombieWasted" ); Above addEventHandler? Make sure resource starts without any error/warning messages (it should). Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 `yea but when i do this the zombies wont spawn. im going to keep researching it. if you know the error please tell me. Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 THank you. i was useing the same thing you gave me but with like 8 more lines. i got it off of mta wiki Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 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
karlis Posted March 26, 2010 Share Posted March 26, 2010 restart admin and freeroam resources after starting zday Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 im not even shure how to do that. im a noob. this is my first server and im learning slowly. Link to comment
Andre9977 Posted March 26, 2010 Share Posted March 26, 2010 Write into the console: stop resourcename start resourcename ... for both, the freeroam and admin resources to restart them. And in your case it probably needs to be mentioned that you need to replace "resourcename" with your resource's name! Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 lol thank you and im not that noobish. lol Link to comment
rikimaru263 Posted March 26, 2010 Author Share Posted March 26, 2010 thank you. it worked for the f1 menu but not the admin menu. could it be anything else? Link to comment
rafull6 Posted June 16, 2011 Share Posted June 16, 2011 rikimaru263 can you upload your script, please!? I can't make my zombies giving money Link to comment
Castillo Posted June 16, 2011 Share Posted June 16, 2011 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
rafull6 Posted June 16, 2011 Share Posted June 16, 2011 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
JR10 Posted June 16, 2011 Share Posted June 16, 2011 If you are using it in the zombie GM then it should work Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now