Jump to content

Help small problem


manve1

Recommended Posts

I have a problem of trying to make an achievement when player dies he unlocks it, but i just don't get how to make it work properly.

Server-side:

function achLog( ) 
local logged1 = getPlayerAccount(source) 
if (logged1) then 
setAccountData(logged1, 'achDamage', 2) 
end 
end 
addEventHandler('onPlayerLogout', getRootElement(), achLog) 
  
addEventHandler('onPlayerWasted', getRootElement(), 
function() 
local logged1 = getPlayerAccount(source) 
local logged = getAccountData(logged1, 'achDamage') 
if (logged == tonumber(0)) then 
triggerClientEvent('needDamage', getRootElement()) 
setAccountData(logged1, 'achDamage', 2) 
outputChatBox('#FF0000[Achievement]: #FFFFFF'.. getPlayerName( source ) ..' just unlocked "Death is here." achievement.', root, 255, 255, 255, true) 
elseif (logged == 2) then 
triggerClientEvent('logDamage', getRootElement()) 
end 
end 
) 

Client-side:

addEvent('needDamage', true) 
addEventHandler('needDamage', getRootElement(), 
function() 
local achDamage = guiCreateStaticImage( 0.4, 0.2, 0.6, 0.2, 'pictures/ach.png', true ) 
local labelDamage = guiCreateLabel( 0.4, 0.6, 0.6, 0.15, 'Death is here  ( Die )', true, achDamage ) 
setTimer( 
function() 
if isElement(achDamage) and isElement(labelDamage) then 
    destroyElement(achDamage) 
    destroyElement(labelDamage) 
end 
end, 2000, 1 
) 
end 
) 
  
addEvent('logDamage', true) 
addEventHandler('logDamage', getRootElement(), 
function() 
guiGridListSetItemText( gridAch, row2, column1, 'Death is here                 Unlocked', false, false ) 
end 
) 
  

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