|H|TiTanium Posted August 11, 2013 Share Posted August 11, 2013 I have already created the Ped, using slothbot and an argument like this local cachorro2 = blablablabla setPedStat( cachorro2, 24, 999 ) So basically I'm trying to increase Ped's health using setPedStat, so ID is 247 and max_health should be set to 999 ( As I think it's the maximum ... ) But it doesn't work, it's the same ease to kill the Ped ;(((. Please may someone teach me how do I do it ? Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 The max health of a ped/player is 200% using the stat, you'll have to use my resource "extra_health". https://community.multitheftauto.com/in ... ls&id=5195 So you can do this: exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 Is there a way to prevent Ped getting killed easily ? If maximum health is 200%, I wanna know if it's possible to make him more invencible, like reducing damage, etc. Also, is 200% = 999 ? Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 With the resource I gave you the link for you can do what you want, you can give the ped/player as much health as you want. Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 What is better ? Making Ped invencible ( making a setTimer function to increase Ped's health every x seconds ) or making him with a big life ? Also , I was trying to add what you told me to. I got no result, I don't know if I'm making it rightly. I tested on server-side, no result: addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) end ) Also tried on Client-side, but doesn't work at all. please teach me how. Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 If that's a server side script, then you are using the wrong event, is "onResourceStart" for server side. Also, post your whole script. Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 Ped is created on server-side, so I thought it should be also created on server-side. local cachorro2 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end addCommandHandler( "cachorro2", petCao) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) end ) All arguments are already created, so it's not needed to show them all Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 local cachorro2 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) exports [ "extra_health" ]:setElementExtraHealth ( cachorro2, 999 ) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end addCommandHandler( "cachorro2", petCao) By the way, if you want to make it invulnerable, then you can use this function from my "extra_health": exports [ "extra_health" ]:setElementInvulnerable ( cachorro2, true ) Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 Yeah, it's working better now, but there is a bug, after you keep shooting at Ped, he doesn't lose life, and suddenly he just gets a very low HP, and then you can kill him easily again Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 Use "setElementInvulnerable" to make him invulnerable. Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 Is it possible to add your script to mine, because they will already have to download slothbot, and so it could look like this: local tigre1 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setElementData ( tigre1, "pet", cachorro ) setElementExtraHealth ( tigre1, 999 ) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end addCommandHandler( "tigre", petTigre ) I'm getting an error, which says the client side couldn't be found... Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 You can add the scripts inside "extra_health" to your resource, but won't really make much difference. 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