Jump to content

adminlevel


Recommended Posts

Posted

Somebody can help me? I don't know why it isn't work.

local account1 = {} 
local account2 = {} 
local account3 = {} 
local account3 = {} 
local account4 = {Trilon,Skitz} 
  
function staff (source) 
    if (getPlayerAccount(source) == account1) then 
    setElementData(source,"adminlevel",1) 
    elseif (getPlayerAccount(source) == account2) then 
    setElementData(source,"adminlevel",2) 
    elseif (getPlayerAccount(source) == account3) then 
    setElementData(source,"adminlevel",3) 
    elseif (getPlayerAccount(source) == account4) then 
    setElementData(source,"adminlevel",4) 
end 
    local alvl = getElementData(source,"adminlevel") 
    outputChatBox("Az adminszinted : "..alvl,source,255,255,255,true) 
end 
addEventHandler("onPlayerLogin", getRootElement(), staff) 
  
local vipaccount = {} 
  
function vip (source) 
    if (getElementData(source, "accountname") == vipaccount) then 
    setElementData(source,"vip",1) 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), vip) 
  
  
function onQuit(source) 
local account = getPlayerAccount() 
if account and not isGuestAccount(account) then 
local adminlevel = getElementData(source, "adminlevel") 
local viplevel = getElementData(source, "vip") 
  
setAccountData(account,"adminlevel",adminlevel) 
setAccountData(account,"vip",viplevel) 
end 
end 
addEventHandler("onPlayerQuit",root,onQuit) 
  
function onLogin(before,currentAcc) 
if currentAcc and not isGuestAccount(currentAcc) then 
local loadadminlevel = getAccountData(currentAcc,"adminlevel") or 0 
local loadviplevel = getAccountData(currentAcc,"vip") or 0 
setElementData(source,"adminlevel",loadadminlevel) 
setPlayerExp(source,"vip",loadviplevel) 
end 
end 
addEventHandler("onPlayerLogin",root,onLogin) 
  
function adminver (source) 
    if (getElementData(source,"adminlevel")==4) then 
        setElementData(source,"blood",500000) 
        outputChatBox("Kaptál 500000 vért",source,255,255,255,true) 
    else 
    outputChatBox("Nincs elég nagy rangod hozzá!",source,255,255,255,true) 
end 
end 
addCommandHandler("adminver",adminver) 
  
function adminlevel (source) 
    local alvl = getElementData(source,"adminlevel") 
    outputChatBox("Az adminszinted : "..alvl,source,255,255,255,true) 
end 
addCommandHandler("adminlevel",adminlevel) 

Posted

i don't know what you want exactly i just fixed your code.

local accounts = { 
    {"acountName here","elementData", "level"} -- example1 {"test","adminlevel",1} 
    {"acountName here","elementData", "level"} -- example2 {"test","vip",1} 
} 
  
function staff (_,acc) 
    for i,v in pairs (accounts) do 
        if (getAccountName(acc) == v[1]) then 
            setElementData(source,v[2],v[3]) 
        end  
   end  
end 
addEventHandler("onPlayerLogin", getRootElement(), staff) 
  
  
function onQuit() 
    local account = getPlayerAccount(source) 
        if account and not isGuestAccount(account) then 
        local adminlevel = getElementData(source, "adminlevel") 
        local viplevel = getElementData(source, "vip") 
        if adminlevel then setAccountData(account,"adminlevel",adminlevel) end  
        if viplevel then setAccountData(account,"vip",viplevel) end  
    end 
end 
addEventHandler("onPlayerQuit",root,onQuit) 
  
function onLogin(_,currentAcc) 
    if currentAcc and not isGuestAccount(currentAcc) then 
        local loadadminlevel = getAccountData(currentAcc,"adminlevel") or 0 
        local loadviplevel = getAccountData(currentAcc,"vip") or 0 
        setElementData(source,"adminlevel",loadadminlevel) 
        setPlayerExp(source,"vip",loadviplevel) 
    end 
end 
addEventHandler("onPlayerLogin",root,onLogin) 
  
function adminver (player) 
    if player and isElement(player) then  
        if (getElementData(player,"adminlevel") == 4) then 
            setElementData(source,"blood",500000) 
            outputChatBox("Kaptál 500000 vért",player,255,255,255,true) 
        else 
            outputChatBox("Nincs elég nagy rangod hozzá!",player,255,255,255,true) 
        end  
    end 
end 
addCommandHandler("adminver",adminver) 
  
function adminlevel (player) 
    if player and isElement(player) then  
        local alvl = getElementData(source,"adminlevel") 
        if alvl then  
            outputChatBox("Az adminszinted : "..alvl,player,255,255,255,true) 
        end  
    end  
end 
addCommandHandler("adminlevel",adminlevel) 
  

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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