zombienation Posted February 3, 2012 Share Posted February 3, 2012 Hello, I got this idea for a team called witches, with skin and weapon mod ( shovel to staff ) But what i try to do is when a witch hit a player with the staff, i want the player to catch fire. I tried to search and take the commandlines of the put player on fire function from c panel resource and i was experimenting with stuff from Legal system, cuz that script got an option that gives a function to a weapon.. But all i tried had no result lol, Is this.possible to do? If yes can anybody help me pls? Grts Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Use onPlayerDamage combined with setPedOnFire. Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 ok thanks i'll see what i can do with those commands, but i start tomorow, its getting late now i'll post a script when i'm done, working or not lol thx Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 hey solidsnake, i tried this --predators function setPedonFire (attacker, attackerweapon, bodypart, loss) if (attackerweapon == 6) and (loss > 1) end end addEventHandler ("onPlayerDamage", getRootElement(), setPedOnFire ) when i choose predatorteam, i get the weapon id6 ( shovel ) when i hit a person he dont catch fire, can you show me where or what i forgot to add or did wrong please? thanks Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Maybe because you haven't used setPedOnFire at all? NEVER CALL A FUNCTION LIKE A NATIVE MTA ONE. --predators function setOnFire(attacker, attackerweapon, bodypart, loss) if (attackerweapon == 6) and (loss > 1) then setPedOnFire(source, true) end end addEventHandler ("onPlayerDamage", getRootElement(), setOnFire) Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 hmm its very usefull for me to see now what u mean with i did not used setpedonfire but i just tested it, and the player dont catch fire, i started with a medic script, i tought that was better to work with then what i tought before to do, it also hae a function to heal, i deleted some lines about healing cuz i tought it would block the fire or something --Medicheals function healFlowers (attacker, attackerweapon, bodypart, loss) theHealth = getElementHealth (source) if (attackerweapon == 14) and (loss > 1) and ( theHealth < 90 ) then setElementHealth ( source, 100 ) takePlayerMoney (source, 1000) givePlayerMoney (attacker, 1000) end end addEventHandler ("onPlayerDamage", getRootElement(), healFlowers ) Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Are you sure it doesn't work? have you set it up as server side? Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 yes i'm sure yes its in server side, its in the lua with the other teamfunctions Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 function setOnFire(attacker, attackerweapon, bodypart, loss) outputChatBox("Damaged ".. getPlayerName(source)) if (attackerweapon == 6) and (loss > 1) setPedOnFire(source, true) end end addEventHandler ("onPlayerDamage", getRootElement(), setOnFire) Use that and tell me if it output's the message. Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 no message.. i just added it in serversite at other teamfunctions, i refreshedd resource and it restarted to, i also reconnected, shud i restart server for it? Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 You're damaging a PLAYER, right? not a PED. I don't know what else could be, that message should output the name of the player you've just attacked. Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 idd, a player, but i also tested it on a ped and a zombie, none of the three got fire or a chatmessage, neither did i.. but it was worth to try, i think it had some fun with it if it worked Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 The only explanation is that you're either editing a wrong resource, or you aren't restarting it at all, are you sure there's no error's in your script? not from that function, but you said that you have some team functions as well. Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 no i dont believe so, the only warnings i find from that lua is some trouble with "teamcolors" after death or chatting in local chat, but not rly something that refers to the lines for that weapon, but to be sure, i'll add the lines in a new lua and as a new resource, maybe it will work then, we'll see i'll let you know Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 now i get this.. [2012-02-05 00:23:16] SCRIPT ERROR: vuurwapen\serve.lua:4: 'then' expected near 'setPedOnFire' [2012-02-05 00:23:16] WARNING: Loading script failed: vuurwapen\serve.lua:4: 'then' expected near 'setPedOnFire' Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Oops , my bad, I couldn't see that your original code had missing "then", here: function setOnFire(attacker, attackerweapon, bodypart, loss) if (attackerweapon == 6) and (loss > 1) then setPedOnFire(source, true) end end addEventHandler ("onPlayerDamage", getRootElement(), setOnFire) Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 no problem haha it works, its so funny ! thx solidsnake there is one thing, when u hit, u also catch fire, cuz the person is close to u when he catch fire, but it stays funny thanks Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 You're welcome. P.S: You can remove the attacker fire with setPedOnFire(attacker, false). Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 (edited) hmm thx for telling me, i think after looking on the wikipage with functions stuff i could make more things like this thanks of u helping me with this working one, now i just need to change the function and weapon for it or not? not that i'll see for new ideas like that now but its good to know already i was trying to change the shovel to a mod, it worked with modloader, but i dont like to use that script, i tried to to this but maye cuz its a weapon it have to be different? function replaceModel() local ID = 29 txd = engineLoadTXD("shovel.txd", 6) engineImportTXD(txd, 6) dff = engineLoadDFF("shovel.dff", 0) -- When you're replacing something else than a vehicle the ID must be 0. engineReplaceModel(dff, 6) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel) addCommandHandler ( "reloadskin", replaceModel ) Edited February 3, 2012 by Guest Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 function replaceModel() local ID = 6 txd = engineLoadTXD("shovel.txd", ID ) engineImportTXD(txd, ID ) dff = engineLoadDFF("shovel.dff", 0 ) engineReplaceModel(dff, ID ) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel) addCommandHandler ( "reloadskin", replaceModel ) Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 thanks man u know everything? hey i dont want talk bad about you work, cuz it isn't bad at all but only i can use the fire function, is it possible to make it able for all players? i tried to do the same lines as client side but it dont work Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 I don't understand what do you mean, onPlayerDamage is server side only, everyone should be able to see the fire. Link to comment
zombienation Posted February 3, 2012 Author Share Posted February 3, 2012 yesyes they are able to see the fire, they also die of it if the fire keeps on long enough lol but i mean the function on the weapon, i guess its normal that only players on serverside can use it, but is it possible to make the function on the weapon able to use by players from client side? Link to comment
Castillo Posted February 4, 2012 Share Posted February 4, 2012 You mean using the event onClientPlayerDamage? Link to comment
zombienation Posted February 4, 2012 Author Share Posted February 4, 2012 i dont know, i mean that when clientplayer take the weapon and hit an other player that the other player start burning, like its now only on server side 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