Jump to content

What's wrong in this script?


Recommended Posts

Hey guys I got this error when I start my script and my player doesn't spawn:

 attempt to concatenate local 'accName' (a boolean value) 

Here a screenshot:

2lc1o21.png

http://tinypic.com/r/2lc1o21/5

And here is my code:

function joinHandler( thePlayer ) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        fadeCamera( source, true) 
        setCameraTarget( source, source) 
        spawnPlayer( source, 1580, -1634, 13, 0, 23) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    else 
        fadeCamera( source, true) 
        setCameraTarget( source, source) 
        local spawnX, spawnY, spawnZ = 1570.9791259766, -1628.7496337891, 13.3828125 
        spawnPlayer( source, spawnX, spawnY, spawnZ, 0, math.random (0,288), 0, 0) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 
addEventHandler("onResourceStart", getRootElement(), joinHandler) 

Edited by Guest
Link to comment

try

function joinHandler( thePlayer ) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        fadeCamera( thePlayer, true) 
        setCameraTarget( thePlayer, thePlayer) 
        spawnPlayer( thePlayer, 1580, -1634, 13, 0, 23) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    else 
        fadeCamera( thePlayer, true) 
        setCameraTarget( thePlayer, thePlayer) 
        local spawnX, spawnY, spawnZ = 1570.9791259766, -1628.7496337891, 13.3828125 
        spawnPlayer( thePlayer, spawnX, spawnY, spawnZ, 0, math.random (0,288), 0, 0) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), joinHandler) 

Link to comment

Thanks, I solved! I used:

function joinHandler() 
    local accName = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        fadeCamera( source, true) 
        setCameraTarget( source, source) 
        spawnPlayer( source, 1580, -1634, 13, 0, 23) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    else 
        fadeCamera( source, true) 
        setCameraTarget( source, source) 
        local spawnX, spawnY, spawnZ = 1570.9791259766, -1628.7496337891, 13.3828125 
        spawnPlayer( source, spawnX, spawnY, spawnZ, 0, math.random (0,288), 0, 0) -- (source,x,y,z,rotation,skin,interior,dimension,team) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), joinHandler) 

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