Jump to content

Why doesn't this work?


Recommended Posts

Posted
Source

The source of this event is the player who joined.

Use "source"

function equi ( ) 
local p = getPedStat ( source, 75 ) 
setPedStat ( source, 75, p + 500 ) 
end 
addEventHandler("onPlayerJoin", root, equi) 

Sometimes I dream about cheese

Posted

I don't think that the script makes much sens, The stat of the player will allways be 0 on join !!

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

It doesn't work yet. the debugscript gave "arithmetic attempt" or something like that with the old script. In line 3. Now , with source, it doesn't work and it dont give Debugscript 3

Posted
It doesn't work like this?
function equi() 
 setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 

Yes now it works thanks.

Oh and how to give the player + 100 stats per Kill?

Posted
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
addEventHandler ( "onPlayerWasted", root, function ( _, source ) 
    if ( source ) then 
        local current = getPedStat ( source, 75 ) 
        setPedStat ( source, 75, current + 100 ) 
    else return end 
end ) 

Posted
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
addEventHandler ( "onPlayerWasted", root, function ( _, source ) 
    if ( source ) then 
        local current = getPedStat ( source, 75 ) 
        setPedStat ( source, 75, current + 100 ) 
    else return end 
end ) 

The "else return" part is unnecessary since that side of the code is never being executed and would automatically return end if source wasn't true.

If I helped you, please click the like button on the right ;) Thanks!

Posted
@MADEXX It says attempt to perform arithmetic in the line 9. and it says is bad the line 8 too
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
addEventHandler ( "onPlayerWasted", root, function ( _, source ) 
    if ( source ) then 
        local current = getPedStat ( source, 75 ) 
        local new = current + 100 
        setPedStat ( source, 75, new ) 
    else return end 
end ) 

try this.

Posted
I don't think that the script makes much sens, The stat of the player will allways be 0 on join !!

Yeah, he will have to

getAccountData 

then

setAccountData 

!

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
@MADEXX It says attempt to perform arithmetic in the line 9. and it says is bad the line 8 too
function equi() 
    setPedStat(source, 75, 500) 
end 
addEventHandler("onPlayerJoin", root, equi) 
  
addEventHandler ( "onPlayerWasted", root, function ( _, source ) 
    if ( source ) then 
        local current = getPedStat ( source, 75 ) 
        local new = current + 100 
        setPedStat ( source, 75, new ) 
    else return end 
end ) 

try this.

It doesn't work yet it gives error in the line of "local current" and "local new". Local new error is arithmetic.

Posted
function equi ( ) 
    setPedStat ( source, 75, 500 ) 
end 
addEventHandler ( "onPlayerJoin", root, equi ) 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( _, killer ) 
        if ( killer and getElementType ( killer ) == "player" ) then 
            local current = getPedStat ( killer, 75 ) 
            setPedStat ( killer, 75, ( current + 100 ) ) 
        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
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...

Posted
It doesn't work yet. This is what debugscript 3 said me:

Bad argument @ 'getElementType' [Expected element at argument 1, got number '28']

My script has to work, copy it exactly like I posted.

@V.Krumins: That's the same thing as my script.

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
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 = ?

  

Posted
It doesn't work yet. This is what debugscript 3 said me:

Bad argument @ 'getElementType' [Expected element at argument 1, got number '28']

My script has to work, copy it exactly like I posted.

@V.Krumins: That's the same thing as my script.

Thanks it works! Oh and u know it how to do it also when u kill zombies?

Posted

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" 

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