Jump to content

Why doesn't this work?


Recommended Posts

function equi ( ) 
    setPedStat ( source, 75, 500 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 

Link to comment
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
function playerDeath(ammo, killer) 
    if (killer) then 
        if (getElementType(killer) == "player") then 
            local old = getPedStat(killer, 75) 
            local new = oldstat + 100 
            setPedStat(killer, 75, new) 
        end 
    end 
end 
addEventHandler("onPlayerWasted", root, playerDeath) 

Try this...

oldstat = ?

Ups... At the first I wrote "oldstat" and "newstat", but then rewrote them to "old" and "new". Sorry my fault, it's supposed to be "old" (oldstat -> old).

It doesn't work.
addEventHandler ( "onZombieWasted", root, 
    function ( _, killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 
addEvent ("onZombieWasted" 

addEventHandler ( "onZombieWasted", root, 
    function ( _, killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 
addEvent ("onZombieWasted", true) 

Link to comment
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
function playerDeath(ammo, killer) 
    if (killer) then 
        if (getElementType(killer) == "player") then 
            local old = getPedStat(killer, 75) 
            local new = oldstat + 100 
            setPedStat(killer, 75, new) 
        end 
    end 
end 
addEventHandler("onPlayerWasted", root, playerDeath) 

Try this...

oldstat = ?

Ups... At the first I wrote "oldstat" and "newstat", but then rewrote them to "old" and "new". Sorry my fault, it's supposed to be "old" (oldstat -> old).

It doesn't work.
addEventHandler ( "onZombieWasted", root, 
    function ( _, killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 
addEvent ("onZombieWasted" 

addEventHandler ( "onZombieWasted", root, 
    function ( _, killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 
addEvent ("onZombieWasted", true) 

the attacker is the first parameter!

Link to comment
function equi ( ) 
    setPedStat ( source, 75, 500 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 

It says error in the getElementType

Link to comment
function equi ( ) 
    setPedStat ( source, 75, 500 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        end 
    end 
) 

Link to comment

Thanks but it doesn't work I think. Or is it my fault?

function equi ( ) 
    setPedStat ( source, 75, 500 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 1000 ) ) 
        end 
    end 
) 

I put +1000 for get double weapon in Uzi

Dual wield capability (At stat level 1000, you receive a 2nd gun and dual wield is enabled)

But I haven't double Uzi. Is it wrong?

Link to comment
function equi ( ) 
    setPedStat( source, 75, 500 ) 
end 
addEventHandler( "onPlayerJoin", root, equi ) 
  
addEvent( "onZombieWasted",true ) 
addEventHandler( "onZombieWasted", root, 
    function( killer ) 
        if isElement( killer ) and getElementType( killer ) == "player" then 
            setPedStat ( killer, 75, 999 ) 
        end 
    end 
) 

And if it didn't work replace "999" with "1000" .

Link to comment

It didn't work

addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 999 ) ) 
        end 
    end 
) 

Link to comment

In your code, when the player join the stat will be set to 500, and when he kills a zombie, If you but "current + 999" then it will be 500 + 900 = 1400, which is not allowed !

So if you want to set it to 1000, just but 1000 in it ( i told that in my replay ! ) .

Link to comment
function equi ( ) 
    setPedStat ( source, 75, 0 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEvent ( "onZombieWasted",true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        if ( isElement ( killer ) and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 999 ) ) 
        end 
    end 
) 

this will work?

Link to comment

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