LiOneLMeSsIShoT Posted July 14, 2013 Share Posted July 14, 2013 This script i use to give me 1 Point every zombie Head shot..and 0.5 Every Zombie Any Body Part Kill....But the problem...the script only score the Head shot Point...The another body parts not score it Server side: addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif killer and killer ~= source then if bodypart == 8 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); elseif killer and killer ~= source then if bodypart == 7 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); elseif killer and killer ~= source then if bodypart == 6 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); elseif killer and killer ~= source then if bodypart == 5 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); elseif killer and killer ~= source then if bodypart == 4 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); elseif killer and killer ~= source then if bodypart == 3 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end end end end end end end end end end end ); Client Side: function LiOneLMeSsI() local LiOneLMeSsI = getPedStat( localPlayer, 69 ); guiSetText( GUIEditor.label[2],"Points: "..LiOneLMeSsI ); end addEventHandler( "onClientRender", root, LiOneLMeSsI ); also there's no any Problem in CMD screen or in Debug... Link to comment
DNL291 Posted July 14, 2013 Share Posted July 14, 2013 Try this: Server addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif bodypart ~= 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end ); Link to comment
LiOneLMeSsIShoT Posted July 14, 2013 Author Share Posted July 14, 2013 Try this:Server addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif bodypart ~= 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end ); Okay gonna try it Link to comment
LiOneLMeSsIShoT Posted July 14, 2013 Author Share Posted July 14, 2013 Try this:Server addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif bodypart ~= 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end ); Okay gonna try it and what ~= mean? Link to comment
LiOneLMeSsIShoT Posted July 14, 2013 Author Share Posted July 14, 2013 Try this:Server addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif bodypart ~= 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end ); Okay gonna try it and what ~= mean? Still dosen't work Link to comment
DNL291 Posted July 14, 2013 Share Posted July 14, 2013 Try this:Server addEvent( "onZombieWasted", true ); addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); elseif bodypart ~= 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ); end end end ); Okay gonna try it and what ~= mean? ==: Equality ~=: Difference You did not triggered the onZombieWasted event and not sending the parameters: killer, weapon, bodypart. You must use the onZombieWasted event of your zombie resource/gamemode. Link to comment
LiOneLMeSsIShoT Posted July 14, 2013 Author Share Posted July 14, 2013 I'm already Added addEventHandler and addEvent in the script...you may check it. and if something not in the script must be...just tell me please...and it's resource...not gamemode Link to comment
DNL291 Posted July 14, 2013 Share Posted July 14, 2013 You did not understand what i said. You need not use addEvent because onZombieWasted is a custom event of the zombie resource. Link to comment
LiOneLMeSsIShoT Posted July 15, 2013 Author Share Posted July 15, 2013 You did not understand what i said. You need not use addEvent because onZombieWasted is a custom event of the zombie resource. okay..tell me what should i add and i'm gonna add it..or just edit the script if you want...and thanks Link to comment
DNL291 Posted July 15, 2013 Share Posted July 15, 2013 Try removing: addEvent( "onZombieWasted", true ); Link to comment
LiOneLMeSsIShoT Posted July 15, 2013 Author Share Posted July 15, 2013 Try removing: addEvent( "onZombieWasted", true ); Sure gonna try Link to comment
LiOneLMeSsIShoT Posted July 15, 2013 Author Share Posted July 15, 2013 Try removing: addEvent( "onZombieWasted", true ); Sure gonna try Look still working with HeadShot...but with any another bodypart shot not work..i used debugscript to know what's the error i got NO ERROR Link to comment
itoko Posted July 15, 2013 Share Posted July 15, 2013 The conditions were kinda weird, try this: addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if killer and killer ~= source then if bodypart == 9 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ) elseif bodypart == 8 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) elseif bodypart == 7 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) elseif bodypart == 6 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) elseif bodypart == 5 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) elseif bodypart == 4 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) elseif bodypart == 3 and weapon == 22 then setPedStat( killer, 69, getPedStat( killer, 69 ) + 0.5 ) end end end ) Link to comment
WASSIm. Posted July 15, 2013 Share Posted July 15, 2013 addEvent( "onZombieWasted", true ) addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if getElementType ( killer ) == "player" if killer and killer ~= source then local stat = getPedStat(killer, 69 ) if (bodypart == 9) and (weapon == 22) then setPedStat( killer, 69, stat+1) elseif (weapon == 22) then setPedStat( killer, 69, stat+0.5) end end end end ) Link to comment
iPrestege Posted July 15, 2013 Share Posted July 15, 2013 Use tables would be more easier ? Link to comment
WASSIm. Posted July 15, 2013 Share Posted July 15, 2013 Use tables would be more easier ? why need table ? he is want if kill zombie with pistol in head win 1 point stat pistol and if kill zombie in other body win 0.5 stat pistol Link to comment
LiOneLMeSsIShoT Posted July 15, 2013 Author Share Posted July 15, 2013 addEvent( "onZombieWasted", true ) addEventHandler( "onZombieWasted", root, function ( killer, weapon, bodypart ) if getElementType ( killer ) == "player" if killer and killer ~= source then local stat = getPedStat(killer, 69 ) if (bodypart == 9) and (weapon == 22) then setPedStat( killer, 69, stat+1) elseif (weapon == 22) then setPedStat( killer, 69, stat+0.5) end end end end ) ERROR: Failed:WeaponPoints.lua:5: 'then' expected near 'if' 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