Jump to content

me needz helpz


Stylez

Recommended Posts

Heyo, so i spent an hour on trying to figure out whats the problem in this little script

function meAdminAllTheTime(user, pass) 
local acc = getAccount(user, pass) 
    if (acc ~= false) then 
        outputChatBox("volia") 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), meAdminAllTheTime) 

It says : bad arg @ getAccount expected string at arg. 1 got nil.

i tryed to fix it in many different ways. but i couldnt :D

Link to post
Heyo, so i spent an hour on trying to figure out whats the problem in this little script
function meAdminAllTheTime(user, pass) 
local acc = getAccount(user, pass) 
    if (acc ~= false) then 
        outputChatBox("volia") 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), meAdminAllTheTime) 

It says : bad arg @ getAccount expected string at arg. 1 got nil.

i tryed to fix it in many different ways. but i couldnt :D

Perhaps he's not logged in?

oh oh oh also, you're trying to get the user and pass when a player joins the server. mhm?

Link to post
Yea, i tried to make simple auto login script when player joins server and this was begining of it..

You do know that there is an auto-login option in the mtaserver config file?

You do now.

EDIT: I wrote this piece of shat for you, perhaps you could learn something out of it.

  
function admin_check ( p ) 
    if not isGuestAccount ( getPlayerAccount ( p ) ) then 
        local account = getPlayerAccount ( p ) 
        local name = getAccountName ( account ) 
         
        if name == "accountnamehere" then 
            outputChatBox ( "* Hai " .. name .. "!", p, 0, 255, 0, false ) 
        else 
            outputChatBox ( "* You're not an admin.", p, 255, 0, 0, false ) 
        end 
    else 
        outputChatBox ( "* Yo you ain't logged in.", p, 255, 0, 0, false ) 
    end 
end 
  
addCommandHandler ( "admin", admin_check ) 
  

Link to post

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