Jump to content

help levelup


Recommended Posts

what is the problem :(

function levelup() 
    local x,y,z = getElementPosition(localplayer) 
    local player = getLocalPlayer() 
    local sound = playSound3D ( "levelup.ogg",x,y,z ) 
    attachElements (sound, player) 
    setElementHealth ( player, getElementHealth(player) + 100 ) 
    end 
addEventHandler( "onPlayerLevelUP", getRootElement(), levelup ) 

Link to comment
  • Moderators
I don't see a
addEvent 

in your script

Also, the variable "player" isn't defined.

It is on my screen :shock:

By the way he is using localPlayer and then uses a new temp variable to store getLocalPlayer() and uses that new variable (player) instead of localPlayer.

Also some one asked you about errors but you didn't reply ... So please do.

3 possible reasons:

1 - The event isn't created (use addEvent like Controlled said).

2 - There is an error somewhere in this file so it is not loaded.

3 - The event onPlayerLevelUP is never triggered.

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