kevenvz Posted October 30, 2010 Share Posted October 30, 2010 Hello, I am new in scripting and here it is. I don't know how to script a tazer. I want a tazer that if your team is 'Cops' and when you shoot whit a deser eagle that it won't hurt the guy and that it will set the player animation in FALL_front. (Search in wiki by animation list) Please can you make this for me? Link to comment
dzek (varez) Posted October 30, 2010 Share Posted October 30, 2010 https://wiki.multitheftauto.com/wiki/AddEventHandler https://wiki.multitheftauto.com/wiki/OnClientPedDamage (check weapon, then attacker team) https://wiki.multitheftauto.com/wiki/GetPlayerTeam https://wiki.multitheftauto.com/wiki/GetTeamName if it pass all conditions: https://wiki.multitheftauto.com/wiki/SetPedAnimation (if you want it synced you have to do animation server-side: triggerServerEvent and addEvent and of course addEventHandler) Link to comment
kevenvz Posted October 30, 2010 Author Share Posted October 30, 2010 Thanks for the wiki pages. I hope I can make it! EDIT: That team is too hard I think so I did this: function cancelPedDamage ( attacker, weapon ) if (attacker) and (weapon == 24) then setPedAnimation( source, "ped", "FALL_front") cancelEvent() -- cancel any damage done to peds end end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) I don't know or this will work. But I will try it. And if it don't work then please can you make it or 50P? Link to comment
DiSaMe Posted October 30, 2010 Share Posted October 30, 2010 The event must be onClientPlayerDamage. Unlike ped functions, ped events don't work with players. Link to comment
kevenvz Posted October 30, 2010 Author Share Posted October 30, 2010 THanks first it didn't work now I try it! I hope it works!!!! Edit: Still don't work ;( can somebody make it work? Link to comment
dzek (varez) Posted October 30, 2010 Share Posted October 30, 2010 post your current script, read about debugging on wiki https://wiki.multitheftauto.com/wiki/Debugging Link to comment
kevenvz Posted October 30, 2010 Author Share Posted October 30, 2010 Oh guys, In think I got it I got my script server side and that event is client side maybe onPlayerDamage will wokr EDIT: It works! But I wanted that it won't damage people. How do I code that Link to comment
kevenvz Posted October 30, 2010 Author Share Posted October 30, 2010 I did this. Realy wired here is my code: -- server sided function cancelPedDamage ( attacker, weapon ) if (attacker) and (weapon == 24) then setPedAnimation( source, "ped", "FALL_front") cancelEvent() -- cancel any damage done to peds end end addEventHandler ( "onPlayerDamage", getRootElement(), cancelPedDamage ) Link to comment
dzek (varez) Posted October 30, 2010 Share Posted October 30, 2010 looks fine, now add team checking (use functions i gave you) Link to comment
BinSlayer1 Posted October 30, 2010 Share Posted October 30, 2010 https://wiki.multitheftauto.com/wiki/OnPlayerDamage Says here you can't cancel serverside onPlayerDamage so you may have to use clientside onClientPlayerDamage Link to comment
dzek (varez) Posted October 30, 2010 Share Posted October 30, 2010 i was wondering why i told him to use client side event when there is onPlayerDamage.. i forgot it, but still had it on my mind i think ;p thanks BinSlayer1 Link to comment
kevenvz Posted October 30, 2010 Author Share Posted October 30, 2010 Uhm? I already knowed that read ^^^^ Link to comment
DiSaMe Posted October 31, 2010 Share Posted October 31, 2010 I think it's best to use two scripts, one client-side for canceling damage and another server-side for animation. Link to comment
dzek (varez) Posted October 31, 2010 Share Posted October 31, 2010 this is what i suggested in my 1st post Link to comment
kevenvz Posted October 31, 2010 Author Share Posted October 31, 2010 Uhm... I try it. 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