Jump to content

Get players account


Xeno

Recommended Posts

function checkRank(player) 
local account = getPlayerAccount(player) 
  
    if (account) then 
        if (isGuestAccount(account)) then 
outputChatBox("hello") 
end 

This gives me a bad arguement at "getPlayerAccount"..

Please help me,

Thanks, Xeno.

Link to comment

This is how I execute it:

function checkRank(player) 
local account = getPlayerAccount(player) 
    if (account and isGuestAccount(account)) then 
  
setElementData(player, "Rank","Login") 
local kills = tonumber(getElementData(player,"Zombie kills")) 
    elseif (kills >= 25 and kills <= 49) then 
setElementData(player, "Rank","Rookie") 
end 
end 
addEventHandler("onPlayerLogout", getRootElement(), checkRank) 
addEventHandler("onPlayerLogin", getRootElement(), checkRank) 
addEventHandler("onPlayerJoin", getRootElement(), checkRank) 

I ran into some problems:

12:attempted to compare number with nil 

and...

Bad argument at getPlayerAccount 

Link to comment
function checkRank() 
local account = getPlayerAccount(source) 
    if (account and isGuestAccount(account)) then 
        setElementData(source, "Rank","Login") 
        return 
    end 
    local kills = tonumber(getElementData(source,"Zombie kills")) 
    if (kills >= 25 and kills <= 49) then 
        setElementData(source, "Rank","Rookie") 
    end 
end 
addEventHandler("onPlayerLogout", getRootElement(), checkRank) 
addEventHandler("onPlayerLogin", getRootElement(), checkRank) 

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