Jump to content

ERRO Id System


Recommended Posts

E ai galera, tudo bem?

Botei um sistema de ID no meu Servidor, porém ele não funciona.

olhei o debug script 3 e Apareceu a o Erro na linha 25

Danilin_S.Lua:25: attempt to call global "getAccountID" (a nil value)
function Start_Id ( _, acc )
	if eventName == "onPlayerLogin" then
		setElementData ( source, "ID", getAccountID(acc) or "N/A" )
	elseif eventName == "onPlayerLogout" then
		removeElementData( source, "ID" )
	elseif eventName == "onResourceStart" then
		for _, player in pairs(getElementsByType("player")) do
			local acc = getPlayerAccount(player)
			if not isGuestAccount(acc) then
				setElementData( source, "ID", getAccountID(acc) or "N/A" )    <<<< Essa é a linha d erro
			end
		end
	end
end
addEventHandler("onResourceStart", resourceRoot, Start_Id)
addEventHandler("onPlayerLogout", root, Start_Id)
addEventHandler("onPlayerLogin", root, Start_Id)

function getPlayerID(id)
	v = false
	for i, player in ipairs (getElementsByType("player")) do
		if getElementData(player, "ID") == id then
			v = player
			break
		end
	end
	return v
end
--============================================================================================================================--
                                   --=============================--
                                   ----------- ID PLAYER ------------
                                   --=============================--
function getnick(player, command, id, ...)
    if(id) then
        local playerID = tonumber(id)
		if(playerID) then
			local Player2 = getPlayerID(playerID)
			if(Player2) then	
				outputChatBox ( "#106FE7 #ffffffINFO #106FE7➺ #ffffff Nome do Jogador #106FE7" .. getPlayerName(Player2) .."", player, 255,255,255,true)
			else
				outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffff O Jogador(a) de ID: #106FE7( " .. id .. " ) #ffffffNão Foi Encontrado!", player, 255,255,255,true)
			end 
		else
			outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffff ID: #106FE7( " .. id .. " ) #ffffffInválido!", player, 255,255,255,true)
		end
	else
		outputChatBox ( "#106FE7 #ffffffERRO #106FE7➺ #ffffffUse /id #106FE7[#ffffffID#106FE7]", player, 255,255,255,true)
	end
end
addCommandHandler("id", getnick)

Help-me

Link to comment
run getAccountID
[00:20:05] Console executed command: getAccountID
[00:20:05] Command results: function: 054FC8F8 [function]
sver
[00:20:08] MTA:SA Server v1.5.7-release-20447

Aqui a função funciona. Faça o mesmo que fiz, no seu Console para ver os resultados.

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