Jump to content

Admins Spawn


homar

Recommended Posts

Admins Spawn , so i want this one when i login i be in Desert base (A69)

but aren't work too

function adminSpawn (player) 
local theAccount = getPlayerAccount(player) 
    if theAccount then 
    local accountName = getAccountName(theAccount) 
        if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
        spawnPlayer (source, 218, 1867, 13, 0, math.random (211,217), 0, 0, ) 
        end  
    end 
end  
addEventHandler ("onPlayerLogin" getElementRoot(), adminspawn)   

Link to comment
  • Discord Moderators

onPlayerLogin returns account thePreviousAccount, account theCurrentAccount, bool autoLogin and source as player element.

Also you have adminspawn in your addEventHandler, and the function name adminSpawn which doesn't work because LUA is case-sensitive

You have an extra comma at line 6 in spawnPlayer too, which is not needed for last arguments. But you got a missing one at line 10 in addEventHandler :P

Its getRootElement() (but use 'root') btw :)

how about this:

  
function adminSpawn (_, acc) 
    local accountName = getAccountName(acc) 
        if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
            spawnPlayer (source, 218, 1867, 13, 0, math.random (211,217), 0, 0 ) 
        end 
end 
addEventHandler ("onPlayerLogin", root, adminSpawn) 

Link to comment
function adminRespawn () 
local account = getPlayerAccount(source) 
if account then 
    local accountName = getAccountName(account) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
            spawnPlayer (source, 218, 1867, 13, 0, math.random (211,217), 0, 0 ) 
              end 
        end 
end 
addEventHandler ("onPlayerWasted", root, adminRespawn) 

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