Jump to content

onPlayerWasted :D


Max+

Recommended Posts

Posted

Hello

i got isuue with this event

i have images for every bodypart

what i want make is

if (bodypart == 9 ) then

drawimage for the victim

else if (bodypart == 7 )

...

etc ?

iam just starting making it

but iam not good in images :D

addEventHandler('onPlayerWasted', root, 
function(attacker, bodypart) 
    if(getElementType(attacker) == 'player') then 
    if (bodypart == 9 ) then 
     

Posted

Max, you cannot make images in serverside, I assume you want the bodypart image to appear when they die.

CLIENT:

bodypartImage = { 
[3] = 'IMAGE.PNG', 
[4] = 'IMAGE.PNG', 
[5] = 'IMAGE.PNG', 
[6] = 'IMAGE.PNG', 
[7] = 'IMAGE.PNG', 
[8] = 'IMAGE.PNG', 
[9] = 'IMAGE.PNG', 
} 
  
addEventHandler('onClientPlayerWasted', getRootElement(), 
function(killer, weapon, bodypart) 
    screenX, screenY = guiGetScreenSize() 
    width = 300 
    height = 300 
    guiCreateStaticImage((screenX/2)-(width/2), (screenY/2)-(height/2), width, height, bodypartImage[bodypart], false) 
end ) 

Very simple just edit the table and replace the images for the different ID's, and replace the width and height variables with the correct size.

Posted

so it well be like this ?

bodypartImage = { 
[3] = 'torso.png', 
[4] = 'ass.png', 
[5] = 'leftarm.png', 
[6] = 'rightarm.png', 
[7] = 'leftleg.png', 
[8] = 'rightleg.png', 
[9] = 'head.png', 
} 
  
addEventHandler('onClientPlayerWasted', getRootElement(), 
function(killer, weapon, bodypart) 
    if(getElementType(attacker) == 'player') then 
    screenX, screenY = guiGetScreenSize() 
    width = 350 
    height = 348 
    guiCreateStaticImage((screenX/2)-(width/2), (screenY/2)-(height/2), width, height, bodypartImage[bodypart], false) 
  end 
end) 

Posted

Csmit195

i didn't test the script yes

iam making a damage script

i have sound like tactis gamemod if hit player play sound for the attacker and victm

how can i make that ?

Posted

I made the same for my BaseMode server.

Client:

weaponDING = 'ding.mp3' 
  
addEventHandler('onClientPlayerDamage', getRootElement(), 
function(attacker, weapon, bodypart) 
    if attacker == localPlayer then 
        playSound(weaponDING) 
    end 
end ) 

Replace line 1 with your damage sound.

Posted
bodypartImage = { 
[3] = 'torso.png', 
[4] = 'ass.png', 
[5] = 'leftarm.png', 
[6] = 'rightarm.png', 
[7] = 'leftleg.png', 
[8] = 'rightleg.png', 
[9] = 'head.png', 
} 
  
addEventHandler('onClientPlayerWasted', getRootElement(), 
function(killer, weapon, bodypart) 
    if(getElementType(attacker) == 'player') then 
    screenX, screenY = guiGetScreenSize() 
    width = 350 
    height = 348 
    image = guiCreateStaticImage((screenX/2)-(width/2), (screenY/2)-(height/2), width, height, bodypartImage[bodypart], false) 
    setTimer(destroyElement, 3000, 1, image) 
  end 
end) 

Posted

sound for both of them lol ?

i need it for attacker only

and images not shown :(

Lua --Client

----The Images Script 
bodypartImage = { 
[3] = 'images/torso.png', 
[4] = 'images/ass.png', 
[5] = 'images/leftarm.png', 
[6] = 'images/rightarm.png', 
[7] = 'images/leftleg.png', 
[8] = 'images/rightleg.png', 
[9] = 'images/head.png', 
} 
  
addEventHandler('onClientPlayerWasted', getRootElement(), 
function(killer, weapon, bodypart) 
    if ( attacker ) and ( attacker ~= source ) then 
    screenX, screenY = guiGetScreenSize() 
    width = 350 
    height = 348 
    guiCreateStaticImage((screenX/1184)-(width/635), (screenY/172)-(height/109), width, height, bodypartImage[bodypart], false) 
    setTimer(destroyElement, 3000, 1, image) 
  end 
end) 
  
---Sound Script  
ding = 'sounds/hit.wav' 
addEventHandler('onClientPlayerDamage', root, 
function(attacker) 
    if ( attacker ) and ( attacker ~= source ) then 
    playSound(ding) 
  end 
end 
) 
  
  
----Rights  
addEventHandler('onClientResourceStart', resourceRoot, 
function() 
    triggerServerEvent('rights', localPlayer) 
end 
) 

Posted
sound for both of them lol ?

i need it for attacker only

and images not shown :(

Lua --Client

----The Images Script 
bodypartImage = { 
[3] = 'images/torso.png', 
[4] = 'images/ass.png', 
[5] = 'images/leftarm.png', 
[6] = 'images/rightarm.png', 
[7] = 'images/leftleg.png', 
[8] = 'images/rightleg.png', 
[9] = 'images/head.png', 
} 
  
addEventHandler('onClientPlayerWasted', getRootElement(), 
function(killer, weapon, bodypart) 
    if ( attacker ) and ( attacker ~= source ) then 
    screenX, screenY = guiGetScreenSize() 
    width = 350 
    height = 348 
    guiCreateStaticImage((screenX/1184)-(width/635), (screenY/172)-(height/109), width, height, bodypartImage[bodypart], false) 
    setTimer(destroyElement, 3000, 1, image) 
  end 
end) 
  
---Sound Script  
ding = 'sounds/hit.wav' 
addEventHandler('onClientPlayerDamage', root, 
function(attacker) 
    if ( attacker ) and ( attacker ~= source ) then 
    playSound(ding) 
  end 
end 
) 
  
  
----Rights  
addEventHandler('onClientResourceStart', resourceRoot, 
function() 
    triggerServerEvent('rights', localPlayer) 
end 
) 

hmmm,,,

function(killer, weapon, bodypart) 

and

if ( attacker ) and ( attacker ~= source ) then 

Can you see your own mistake now?:P

Posted
i'v go to wiki and see

argument 5 is the path of image !

try this;

bodypartImage = { 
[3] = "torso.png", 
[4] = "ass.png", 
[5] = "leftarm.png", 
[6] = "rightarm.png", 
[7] = "leftleg.png", 
[8] = "rightleg.png", 
[9] = "head.png", 
} 

Posted
i'v go to wiki and see

argument 5 is the path of image !

try this;

bodypartImage = { 
[3] = "torso.png", 
[4] = "ass.png", 
[5] = "leftarm.png", 
[6] = "rightarm.png", 
[7] = "leftleg.png", 
[8] = "rightleg.png", 
[9] = "head.png", 
} 

LoooooL?

Posted
i'v go to wiki and see

argument 5 is the path of image !

try this;

bodypartImage = { 
[3] = "torso.png", 
[4] = "ass.png", 
[5] = "leftarm.png", 
[6] = "rightarm.png", 
[7] = "leftleg.png", 
[8] = "rightleg.png", 
[9] = "head.png", 
} 

LoooooL?

I'm not into this script at all, but single and double qoutes are important in alot of language's. ;)

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