Perfect Posted April 17, 2014 Posted April 17, 2014 Hi all, I am back to MTA after long time. I am trying to refresh my scripting skills. I make a simple script which will create an explosion at player, which will not damage him/her. But Somehow Players are getting damage. Here is my script, function des ( player ) local pX, pY, pZ = getElementPosition ( player ) createExplosion ( pX, pY, pZ, 6, true, -1.0, false ) end addCommandHandler ( "Boom", des ) Multi Theft Auto Player since middle of 2011. Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.
tosfera Posted April 17, 2014 Posted April 17, 2014 Using the function will damage the player, if you don't want them to get damaged you should cancel the onPlayerDamage or onClientPlayerDamage whenever it is an explosion. Please note that exploding vehicles, grenades, RPG's and such will not work anymore too. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Castillo Posted April 17, 2014 Posted April 17, 2014 The damage argument only works for client side explosions. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Perfect Posted April 17, 2014 Author Posted April 17, 2014 Using the function will damage the player, if you don't want them to get damaged you should cancel the onPlayerDamage or onClientPlayerDamage whenever it is an explosion. Please note that exploding vehicles, grenades, RPG's and such will not work anymore too. I can't get an idea on how to do that! The damage argument only works for client side explosions. Well, I changed my script to client (in meta) but when i did that there is no explosion at all. Multi Theft Auto Player since middle of 2011. Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.
tosfera Posted April 17, 2014 Posted April 17, 2014 addEventHandler ( "onClientPlayerDamage", root, function ( theWeapon ) if ( theWeapon == 16 ) then -- if it's an grenade, just for an example. cancelEvent(); end end ); After that, change the 6 in your explosion to 0 If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Castillo Posted April 17, 2014 Posted April 17, 2014 If you are using that same code in the client side, it won't work, because addCommandHandler has no player argument client side, use "localPlayer" instead at getElementPosition. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted April 17, 2014 Posted April 17, 2014 Try this: function des() local x,y,z = getElementPosition ( source ) createExplosion ( x, y, z - 0.2, 2, false, true, false ) end addCommandHandler ( "Boom", des ) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted April 17, 2014 Posted April 17, 2014 'source' is not defined. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted April 17, 2014 Posted April 17, 2014 function des() local x,y,z = getElementPosition ( localPlayer ) createExplosion(x, y, z, 0, true, -1.0, false) end addCommandHandler ( "Boom", des ) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Perfect Posted April 17, 2014 Author Posted April 17, 2014 Thanks Solidsnake, got it working! And Tosfera and Niko, I also really appreciate you both guys Help!! Multi Theft Auto Player since middle of 2011. Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.
Castillo Posted April 17, 2014 Posted April 17, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted April 17, 2014 Posted April 17, 2014 No problem. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
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