Max+ Posted February 26, 2013 Share Posted February 26, 2013 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 addEventHandler('onPlayerWasted', root, function(attacker, bodypart) if(getElementType(attacker) == 'player') then if (bodypart == 9 ) then Link to comment
codeluaeveryday Posted February 26, 2013 Share Posted February 26, 2013 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. Link to comment
Max+ Posted February 26, 2013 Author Share Posted February 26, 2013 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) Link to comment
codeluaeveryday Posted February 27, 2013 Share Posted February 27, 2013 Yes Max, it should be, good job! Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 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 ? Link to comment
codeluaeveryday Posted February 27, 2013 Share Posted February 27, 2013 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. Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 Is it Possble to make timer every pic shows for 2-3 sec and go .. Link to comment
iPrestege Posted February 27, 2013 Share Posted February 27, 2013 guiSetVisible setTimer -- ( = Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 Yes i know but its an Table ? how can i do it with table ? Link to comment
codeluaeveryday Posted February 27, 2013 Share Posted February 27, 2013 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) Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 Thank's Iam Gonig To Try It , Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 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 ) Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 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? Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 Oh ! Dam i didn't look there lol iam going to try . Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 Oh !Dam i didn't look there lol iam going to try . haha sure, I'll wait for your reply. Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 Bad argument @ 'guiCreateStaticImage'[Expetcted string at argument 5 , got nill] Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 wich line, cause it looks good to me. ( the first one ) Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 what you mean he say guicreateImage Expetcted string at argument 5 Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 haha well, wich line does the error say; its normally like; filename:error - error. Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 i'v go to wiki and see argument 5 is the path of image ! Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 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", } Link to comment
Max+ Posted February 27, 2013 Author Share Posted February 27, 2013 i need them images / .. Link to comment
iPrestege Posted February 27, 2013 Share Posted February 27, 2013 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? Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 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. 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