Jump to content

setPedStat


-.Paradox.-

Recommended Posts

Posted (edited)

Hello, can somebody help me fixing this no errors in debug, this suppose to add +1 point for every weapon stat when you kill a player, like example when i kill somebody with m4 i earn 1 point to m4 etc

here is the code and thanks

addEventHandler("onZombieWasted", root, 
function (killer, weapon ,bodypart) 
    if (killer and getElementType(killer) == "player" and killer ~= source) then 
    local Acc = getAccountName ( acc ) 
        for i = 21 , 25 do 
        getPedStat(source,i,getAccountData(Acc, "stat."..i)) 
        end 
        for i = 69 , 79 do 
        getPedStat(source,i,getAccountData(Acc, "stat."..i)) 
        end 
        for i = 21 , 25 do 
        setPedStat(source,i,+1) 
        end 
        for i = 69 , 79 do 
        setPedStat(source,i,+1) 
        end 
    end 
end) 

Edited by Guest

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

You must get the current stat, then set it + 1.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Can you fix it to me please? Sorry for annoying :S

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
addEventHandler ( "onPlayerWasted", root, 
    function ( killer, weapon ,bodypart ) 
        if ( killer and getElementType ( killer ) == "player" and killer ~= source ) then 
            for i = 21, 25 do 
                setPedStat ( source, i, getPedStat ( source, i ) + 1 ) 
            end 
            for i = 69 , 79 do 
                setPedStat ( source, i, getPedStat ( source, i ) + 1 ) 
            end 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thank you, i will try it C:

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

Oh, I forgot about something at getPedStat, copy the code again.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Still not working :/ i tried with onZombieWasted too and nothing happened

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

Nothing on debug

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 debugging the script, add chat box outputs to help spot the error.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Idk where is the error it should work and it's server side. :|

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
addEventHandler ( "onPlayerWasted", root, 
    function ( killer, weapon, bodypart ) 
        if killer then 
            if getElementType ( killer ) == "player" then 
                if killer ~= source then 
                    for i = 21, 25 do 
                        setPedStat ( killer, i, getPedStat ( killer, i ) + 1 ) 
                    end 
                    for i = 69 , 79 do 
                        setPedStat ( killer, i, getPedStat ( killer, i ) + 1 ) 
                    end 
                end 
            end 
        end 
    end 
) 

Posted

This add +1 for all stats, and i want to add only for the weapon i killed with the player/zombie

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
Stats = {  
    [22] = { 69 }; 
    [23] = { 70 }; 
    [24] = { 71 }; 
    [25] = { 72 }; 
    [26] = { 73 }; 
    [27] = { 74 }; 
    [28] = { 75 }; 
    [29] = { 76 }; 
    [30] = { 77 }; 
    [31] = { 78 }; 
    [34] = { 79 }; 
}; 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ammo, killer, weapon, bodypart ) 
        if killer then 
            if getElementType ( killer ) == "player" then 
                if killer ~= source then 
                    if Stats[tonumber(weapon)] then 
                        setPedStat ( killer, Stats[tonumber(weapon)][1], getPedStat ( killer, Stats[tonumber(weapon)][1] ) + 1 ) 
                    end 
                end 
            end 
        end 
    end 
) 

Posted

Thanks working perfect

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.

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