Kenix Posted May 28, 2011 Share Posted May 28, 2011 playername = getPlayerName(source) function newLogin(user,pass) local userAccount = getAccount(user) local accountname = user if (client) then local tryToLogin = logIn(client,userAccount,pass) if (tryToLogin) then fadeCamera(client,true) if (getElementData(source,"Lang") == "Rus") then triggerClientEvent ( "OnPlayerLoginFromServerrus", root) elseif getElementData(source,"Lang") == "Eng" then triggerClientEvent ( "OnPlayerLoginFromServer", root) elseif getElementData(source,"Lang") == "Pl" then triggerClientEvent ( "OnPlayerLoginFromServerPl", root) elseif getElementData(source,"Lang") == "Sp" then triggerClientEvent ( "OnPlayerLoginFromServerSp", root) end if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Moderator" ) ) then if getElementData(source,"Lang") == "Rus" then outputChatBox("[СЕРВЕР] "..playername.." вошел как Модератор.",root,255,204,51) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("[sERV] "..playername.." came as an Moderator.",root,255,204,51) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("[sERV] "..playername.." przyszedl jako moderator.",root,255,204,51) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("[sERV] "..playername.." vino como un moderador.",root,255,204,51) end elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "SuperModerator" ) ) then if getElementData(source,"Lang") == "Rus" then outputChatBox("[СЕРВЕР] "..playername.." вошел как Супер Модератор.",root,255,102,0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("[sERV] "..playername.." came as an Super Moderator.",root,255,102,0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("[sERV] "..playername.." przyszedl jako Super Moderator.",root,255,102,0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("[sERV] "..playername.." vino como un Super Moderator.",root,255,102,0) end elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Admin" ) ) then if getElementData(source,"Lang") == "Rus" then outputChatBox("[СЕРВЕР] "..playername.." вошел как Администратор.",root,255,0,0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("[sERV] "..playername.." came as an Administrator.",root,255,0,0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("[sERV] "..playername.." przyszedl jako Administrator.",root,255,0,0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("[sERV] "..playername.." vino como un Administrator.",root,255,0,0) end end else if getElementData(source,"Lang") == "Rus" then outputChatBox("[СЕРВЕР] Неправильный пароль,попробуйте ещё.",source, 255, 255, 0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("[sERV] Invalid password, try again.",source, 255, 255, 0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("[sERV] Nieprawidlowe haslo, sprobuj ponownie.",source, 255, 255, 0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("[sERV] contrasena no valida, intentelo de nuevo.",source, 255, 255, 0) end end end end addEvent("newLogin",true) addEventHandler("newLogin",root,newLogin) function newRegister(user,pass) if (pass ~= nil and pass ~= "") then addAccount(user,pass) local userAccount = getAccount(user) if (client and userAccount ~= false and userAccount ~= nil) then local tryToLog = logIn(client,userAccount,pass) if (tryToLog) then fadeCamera(client,true) if getElementData(client,"Lang") == "Rus" then outputChatBox("[СЕРВЕР] Спасибо " .. playername .. ", за регистрацию на нашем сервере, вы автоматически вошли.", client,102,204,153) triggerClientEvent ( "OnPlayerLoginFromServerrus", client) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("[sERV] Thank you " .. playername .. ", for registering on our server, you are automatically entered.", source,102,204,153) triggerClientEvent ( "OnPlayerLoginFromServer", root) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("[sERV] Dziękuję " .. playername .. ", za zarejestrowanie się na naszym serwerze, automatycznie wpisane.", source,102,204,153) triggerClientEvent ( "OnPlayerLoginFromServerPl", root) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("[sERV] Gracias " .. playername .. ", para su registro en nuestro servidor, que se introducen automáticamente.", source,102,204,153) triggerClientEvent ( "OnPlayerLoginFromServerSp", root) end else if getElementData(source,"Lang") == "Rus" then outputChatBox("Невозможно залогиниться, попробуйте ещё.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("Unable to login, try again.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("Nie mozna sie zalogowac, sprobuj ponownie.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("No se puede acceder, intentalo de nuevo.",source,255, 255, 0) end end else if getElementData(source,"Lang") == "Rus" then outputChatBox("Невозможно создать аккаунт, попробуйте ещё.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("Unable to login, try again.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("Nie mozna sie zalogowac, sprobuj ponownie.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("No se puede acceder, intentalo de nuevo.",source,255, 255, 0) end end else if getElementData(source,"Lang") == "Rus" then outputChatBox("Пожалуйста создайте пароль для аккаунта.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Eng" then outputChatBox("Please create a password for your account.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Pl" then outputChatBox("Utworz haslo dla swojego konta.",source,255, 255, 0) elseif getElementData(source,"Lang") == "Sp" then outputChatBox("Por favor, cree una contrasena para su cuenta.",source,255, 255, 0) end end end addEvent("newRegister",true) addEventHandler("newRegister",root,newRegister) Link to comment
Timic Posted June 2, 2011 Share Posted June 2, 2011 Did you even try to add root = getRootElement()? Link to comment
karlis Posted June 2, 2011 Share Posted June 2, 2011 Did you even try to add root = getRootElement()? root should be defined by default, unless wiki is corrupted Link to comment
Castillo Posted June 3, 2011 Share Posted June 3, 2011 karlis, I had the problem in one of my scripts with outputChatBox("Hello world",root,r,g,b), it wasn't working since root wasn't defined, so I think it's not defined or it won't work for this function. Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 this issue was fixed on IRC, basically playername = getPlayerName(source) was outside any handler function, so "source" was nil. just for people to know. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now