NickRosso Posted May 29, 2012 Share Posted May 29, 2012 Okay Now I've been trying to find the solution but can't. Here it is. I need something like onPlayerDamage but ped. IsPedDead is not good i tried it. I'm trying to make a resource, when you kill a ped you have an output message. Can somebody help me please? Nick Link to comment
Wei Posted May 29, 2012 Share Posted May 29, 2012 (edited) onClientPedDamage ? or onClientPedWasted ? Edited May 29, 2012 by Guest Link to comment
FWCentral Posted May 29, 2012 Share Posted May 29, 2012 function PedDamage() outputChatBox end addEventHandler("onClientPedDamage", getRootElement(), PedDamage) Its client side. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Thank you very much both of you. I'm just new to this. I should start from the beginning but couldn't find a good teaching page. Link to comment
FWCentral Posted May 29, 2012 Share Posted May 29, 2012 No problem we all start somewhere, Best place is the wiki here: https://wiki.multitheftauto.com/wiki/. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) So i've tried this but this did not work. I guess i did some fatal error function PedWasted() setElementHealth ( killer, 0 ) outputChatBox( "Just in the middle", player, 255, 0, 0 ) end addEventHandler("onClientPedWasted", getRootElement(), PedWasted) Edit: It didn't work even. It's for only players. I thought peds are non player npcs in MTA. I've tried this with the citizens resource. function PedDamage() outputChatBox("Just in the middle", player, 255, 0, 0) end addEventHandler("onClientPedDamage", getRootElement(), PedDamage) Edited May 29, 2012 by Guest Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 I see. And would you tell me how to define them? I just know #define but it's not here I guess. Link to comment
Wei Posted May 29, 2012 Share Posted May 29, 2012 function PedDamage(player) -- Look this line ! outputChatBox("Just in the middle", player, 255, 0, 0) end addEventHandler("onClientPedDamage", getRootElement(), PedDamage) Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Thanks. One more thing. In this: function PedWasted(player) --The player definition goes here i think setElementHealth ( killer, 0 ) outputChatBox( "Just in the middle", player, 255, 0, 0 ) end addEventHandler("onClientPedWasted", getRootElement(), PedWasted) But how to define killer in this one? Thank you for helping a beginner EDIT:These are for only player or NPC's too? Cuz' not working. I'm doing something wrong function PedDamage(player) outputChatBox("Just in the middle", player, 255, 0, 0) end addEventHandler("onClientPedDamage", getRootElement(), PedDamage) Link to comment
Wei Posted May 29, 2012 Share Posted May 29, 2012 function PedWasted(player) --The player definition goes here i think setElementHealth ( source, 0 ) outputChatBox( "Just in the middle", player, 255, 0, 0 ) end addEventHandler("onClientPedWasted", getRootElement(), PedWasted) Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 It's working with a player, but not on the NPC. Can i use it on NPC? Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 I mean: It works when i kill a player, i die. But when i kill a ped, an npc(don't know what the difference is) it not works. I'm trying this on the citizens resource:https://community.multitheftauto.com/index.php?p=resources&s=details&id=3390 Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 addEventHandler ( "onPedWasted", root, function ( _, killer ) setElementHealth ( killer, 0 ) outputChatBox ( "Just in the middle", killer, 255, 0, 0 ) end ) That's a server side script. Link to comment
Smart. Posted May 29, 2012 Share Posted May 29, 2012 https://wiki.multitheftauto.com/wiki/OnClientPedWasted should do it.. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) It works thank you so much everyone. But i have an other question: What makes it's serverside? What is the difference between this and above the last script? Edited May 29, 2012 by Guest Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 You couldn't have changed the player health client side if I'm right. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Correct me if i'm wrong: The onClientPedWasted is client side, but the OnPedWasted is server sided? And i can't set the player's health in the client just in the server side? I think i'm starting to understand this. Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 Exactly, onClientPedWasted is a client side event, and onPedWasted is a server side event. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Thanks you for the explaining. Not easy for me. Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 You're welcome. Anything you need, just post, we'll help you as long as you want to learn . Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Just one more thing: addEventHandler ( "onPedWasted", root, function ( _, killer ) setElementHealth ( killer, -50 ) -- It not works outputChatBox ( "Just in the middle", killer, 255, 0, 0 ) end ) In clientside it should be working i think. How can i just decrease hp? Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 You have to get the player health then decrease it. addEventHandler ( "onPedWasted", root, function ( _, killer ) setElementHealth ( killer, ( getElementHealth ( killer ) - 50 ) ) outputChatBox ( "Just in the middle", killer, 255, 0, 0 ) end ) Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 Thank you Solidsnake14, it seems, your are my guardian. 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