Jump to content

Get all accounts problem


Tete omar

Recommended Posts

Yes i've discovered that lately and fixed it using

getAccountPlayer 

But my problem is on

getPlayerGangName 

function i made

And here's it's code

local function getPlayerGangName(player) 
    local account=getPlayerAccount(player) -- the error issued here 
    if(account~=false)then 
        return tostring(getAccountData(account,"gangs")) 
    else 
        return false 
    end 
    return true 
end 

Link to comment

ok, now try this:

addEventHandler("onPlayerLogin",root,function(_,acc) 
    if not getPlayerGangName(source)then return end 
    local permission=getAccountData(acc,"permission") 
    if not permissions[permission] then return end 
    triggerClientEvent(source,"ganging",source,permission) 
    outputChatBox("You've joined group ("..getPlayerGangName(source)..") as a ("..permission ..")",source,255,255,0) 
    for _,v in ipairs(getAccounts()) do 
        local player = getAccountPlayer(v) 
        if not getPlayerGangName(player) then return end 
        if isElement(player)then 
            triggerClientEvent(source,"recieveingPlayers",source,"online",getAccountName(v),getPlayerName(player)) 
        else 
            triggerClientEvent(source,"recieveingPlayers",source,"offline",getAccountName(v)) 
        end 
    end 
    for _,v in ipairs(getElementsByType("player")) do 
        if getPlayerGangName(v) then return end 
        outputChatBox("Memeber "..getPlayerName(source).." has joined the group as a " .. permission,v,0,255,0) 
        triggerClientEvent(v,"memberLoggedIn",v,getAccountName(getPlayerAccount(source)),getPlayerName(source)) 
    end 
end) 
  
local function getPlayerGangName(player) 
    local acc=getPlayerAccount(player) 
    if acc then 
        return tostring(getAccountData(acc,"gangs")) 
    end 
    return 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...