Jump to content

Script Dosen't work


Recommended Posts

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 post
  • Moderators

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 post
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 post
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 post
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 post
  • Moderators
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 post

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

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