Jump to content

Stat system


Recommended Posts

Posted

Hello all, i maked this stat system, 1pt for each kill, but sadly it wont work here is the lua

addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 9 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 8 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 7 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 6 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 5 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 4 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 
  
addEvent( "onPlayerWasted", true ); 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 3 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); 
            end 
        end 
    end 
); 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted (edited)

Why not using elseif?

addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if bodypart == 9 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 8 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 7 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 6 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 5 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 4 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 3 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        end 
    end 
); 

Edited by Guest

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Remove

addEvent( "onPlayerWasted", true ); 

local bodyparts = { [9] = 2, [8] = 1, [7] = 1, [6] = 1, [5] = 1, [4] = 1, [3] = 1 } 
addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
        if killer and killer ~= source then 
            if weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + bodyparts[bodypart] ); 
            end 
        end 
    end 
); 
  

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

I'm trying to add Points for every weapon not only for Pistol, like using a table.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Try this:

addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
    local weapon = getPedWeapon( source ) 
        if killer and killer ~= source then 
            if bodypart == 9 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 8 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 7 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 6 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 5 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 4 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 3 and weapon == 22 then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        end 
    end 
); 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Same code...you didn't changed the id of weapons its still 22 and this id for pistol.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I did but it add only for pistol not for other weapons.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Yes i want it for all weapons. and thanks for helping me.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted (edited)

I'm not sure this will works

addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
    local weapon = getElementType ( "weapon" ) 
        if killer and killer ~= source then 
            if bodypart == 9 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 8 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 7 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 6 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 5 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 4 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 3 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        end 
    end 
); 

EDITED

Edited by Guest

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Not working, i guess because removed weapon type, anyway thanks for help i will try to do my self just give me some functions i could use like creating a table.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

still 0 i tried with all weapons

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

i tried reconnect neither

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

try this then :wink:

addEventHandler( "onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart ) 
    local weapon = getElementType ( "weapon" ) 
        if killer and killer ~= source then 
            if bodypart == 9 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 2 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 8 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 7 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 6 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 5 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 4 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        elseif killer and killer ~= source then 
            if bodypart == 3 and weapon then 
                setPedStat( killer, 69, getPedStat( killer, 69 ) + 1 ); end 
        end 
    end 
); 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Not working too :( , ill try to make it by myself.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

@StevyDK: Will only work with the pistol because it will check if weapon ID is 22, if you want to it for all weapons then remove it.

Please do not PM me with scripting related question nor support, use the forums instead.

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