Jump to content

help with dark magic function


zombienation

Recommended Posts

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

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

Maybe because you haven't used setPedOnFire at all? :roll:

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

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
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

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

Oops :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

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 by Guest
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...