Jump to content

Porque no funciona el Joinquit?


Monsthers

Recommended Posts

Hola amigos, tengo un problema uso este joinquit modificado para un server RPG donde antes usaba un sistema de login donde los usuarios quedaban registrado en una base de dato aparte ala de MTA, y el joinquit funcionaba bien, Ahora que cree un RPG distinto y mas facil de usar pues uso la database por defecto de mta y ahora el joinquit no me quiere funcionar el cambiado las funciones y nada. Y por eso estoy aqui haber si me pueden ayudar :/ 

function scriptStart()
    setPlayerBlurLevel ( root, 0)
	setWeather ( 1 )
end
addEventHandler ( "onResourceStart", resourceRoot, scriptStart )


-- from joinquit resource
addEvent( 'onPlayerLogIn',true)
addEventHandler('onPlayerLogIn', root,
	function()
		--outputChatBox('* ' .. getPlayerName(source) .. ' has joined the game [logged in]',root, 255, 100, 100)
		sendLogMessage('* ' .. getPlayerName(source) .. ' has joined the game [logged in]',255,100,100)
	end
)
addEvent( 'onPlayerLogOut',true)
addEventHandler('onPlayerLogOut',root,
	function ()
		--outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [logged out]',root, 255, 100, 100)
		sendLogMessage('* ' .. getPlayerName(source) .. ' has left the game [logged out]',255,100,100)
	end
)

addEventHandler('onPlayerQuit', root,
	function(quitType, reason, responsibleElement)
		if getElementData( source , "loggedIn" ) then
			if quitType == "Kicked" or quitType == "Banned" then
				if responsibleElement then
					if isElement(responsibleElement) then
						responsibleElement = getPlayerName(responsibleElement)
					end
				else
					responsibleElement = "Unknown"
				end
				if not reason then
					reason = "unknown"
				end
				--outputChatBox('* ' .. getPlayerName(source) .. ' was ' .. quitType .. ' by ' .. getPlayerName(responsibleElement) .. ' [' .. reason .. ']',root, 255, 100, 100)
				sendLogMessage('* ' .. getPlayerName(source) .. ' was ' .. quitType .. ' by ' .. responsibleElement .. ' [' .. reason .. ']',255,100,100)
			else
				--outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [' .. quitType .. ']',root, 255, 100, 100)
				sendLogMessage('* ' .. getPlayerName(source) .. ' has left the game [' .. quitType .. ']',255,100,100)
			end
		end
	end
)

function sendLogMessage(msg,r,g,b)
	local players = getElementsByType ( "player" )
	for theKey,thePlayer in ipairs(players) do 
		if (getElementData(thePlayer, "keysPilotBound") == false) then
			triggerClientEvent(thePlayer,"newLogMessage",root,nil,thePlayer,msg,"log",r,g,b)
		end
	end
end

 

Link to comment

Despues de haberle cambiado las funciones, sigue sin mostrar los jugadores que entran y sale pero hay algo curioso si habilito la opcion de que me anuncie quien entra y sale por outputchatbox si funciona pero por el sendLogMessage no funciona el problema seria aqui 

function sendLogMessage(msg,r,g,b)
	local players = getElementsByType ( "player" )
	for theKey,thePlayer in ipairs(players) do 
		if (getElementData(thePlayer, "keysPilotBound") == false) then
			triggerClientEvent(thePlayer,"newLogMessage",root,nil,thePlayer,msg,"log",r,g,b)
		end
	end
end

Pero no se que esta fallando, Asi me quedo el codigo despues de cambiar la funcion

function scriptStart()
    setPlayerBlurLevel ( root, 0)
	setWeather ( 1 )
end
addEventHandler ( "onResourceStart", resourceRoot, scriptStart )


-- from joinquit resource
addEvent( 'onPlayerLogin',true)
addEventHandler('onPlayerLogin', root,
	function()
		--outputChatBox('* ' .. getPlayerName(source) .. ' has joined the game [logged in]',root, 255, 100, 100)
		sendLogMessage('* ' .. getPlayerName(source) .. ' has joined the game [logged in]',255,100,100)
	end
)
addEvent( 'onPlayerLogout',true)
addEventHandler('onPlayerLogout',root,
	function ()
		--outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [logged out]',root, 255, 100, 100)
		sendLogMessage('* ' .. getPlayerName(source) .. ' has left the game [logged out]',255,100,100)
	end
)

addEventHandler('onPlayerQuit', root,
	function(quitType, reason, responsibleElement)
		if getElementData( source , "loggedIn" ) then
			if quitType == "Kicked" or quitType == "Banned" then
				if responsibleElement then
					if isElement(responsibleElement) then
						responsibleElement = getPlayerName(responsibleElement)
					end
				else
					responsibleElement = "Unknown"
				end
				if not reason then
					reason = "unknown"
				end
				--outputChatBox('* ' .. getPlayerName(source) .. ' was ' .. quitType .. ' by ' .. getPlayerName(responsibleElement) .. ' [' .. reason .. ']',root, 255, 100, 100)
				sendLogMessage('* ' .. getPlayerName(source) .. ' was ' .. quitType .. ' by ' .. responsibleElement .. ' [' .. reason .. ']',255,100,100)
			else
				--outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [' .. quitType .. ']',root, 255, 100, 100)
				sendLogMessage('* ' .. getPlayerName(source) .. ' has left the game [' .. quitType .. ']',255,100,100)
			end
		end
	end
)

function sendLogMessage(msg,r,g,b)
	local players = getElementsByType ( "player" )
	for theKey,thePlayer in ipairs(players) do 
		if (getElementData(thePlayer, "keysPilotBound") == false) then
			triggerClientEvent(thePlayer,"newLogMessage",root,nil,thePlayer,msg,"log",r,g,b)
		end
	end
end

 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...