Jump to content

setAccountData and getAccountData


golanu21

Recommended Posts

addEvent ( "onZombieWasted", true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        local kills = getElementData ( killer, "Zombie kills" ) 
        if ( kills == 3 ) then 
            givePlayerMoney(source, 100) 
            triggerClientEvent("mis1", getRootElement()) 
        end 
    end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
local kills = getElementData ( killer, "Zombie kills" ) 
setAccountData (source, "kills", kills) 
end) 
  
addEventHandler("onPlayerLogin", root, 
function(killer) 
kills = getAccountData(source, "kills") 
if ( kills == 3) then 
triggerClientEvent("mis1", getRootElement()) 
end 
end) 

Q1: i want to save the zombie kills in setAccountData when zombieKills reach 3, and when player is login, to start the triggerClientEvent again

Q2 : i can make that?

if  3 >= kills >= 6 then 

... kills is including between 3 an 6

Link to comment
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        local kills = getElementData ( killer, "Zombie kills" ) 
        if (kills >= 3 and kills <= 6) then 
            givePlayerMoney(killer, 100) 
            triggerClientEvent("mis1", getRootElement()) 
        end 
    end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
local kills = getElementData ( source, "Zombie kills" ) 
setAccountData( getPlayerAccount(source), "kills", kills ) 
end) 
  
addEventHandler("onPlayerLogin", root, 
function(_, account) 
local kills = getAccountData(account, "kills") 
    if (kills >= 3 and kills <= 6) then 
        triggerClientEvent("mis1", getRootElement()) 
    end 
end) 

Q2 : i can make that?

if  3 >= kills >= 6 then 

... kills is including between 3 an 6

Must be:

if (kills >= 3 and kills <= 6) then 

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