Jump to content

help with dark magic function


zombienation

Recommended Posts

Posted

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

Posted

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

Posted

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) 

Posted

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 )

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

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted

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'

Posted

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) 

Posted

no problem :)

haha it works, its so funny ! :D

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

thanks

Posted (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 by Guest
Posted
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 ) 

Posted

thanks man :) u know everything? :D

hey i dont want talk bad about you work, cuz it isn't bad at all :D

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

Posted

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?

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