Jump to content

[HELP] getMapName on client


rockstar35

Recommended Posts

Posted

Hello i wanna make a tray notification when new map launchs.  You know creatin tray notification is client sided thing and i need get maps name on notification.

I tried make a bridge with triggering events but i couldn't do it. Thanks.

Posted
-- CLIENT
mapName = ""

function requestMapName()
	triggerServerEvent("requestMapName", localPlayer)
end

addEvent("getMapName", true)
function getMapName(name)
	mapName = name
end
addEventHandler("getMapName", getRootElement(), getMapName)
--SERVER
addEvent("requestMapName", true)
function requestMapName()
	local mapName = getMapName()
	if mapName and mapName ~= "None" then
		triggerClientEvent(source, "getMapName", source, mapName)
    end
end
addEventHandler("requestMapName", getRootElement(), requestMapName)

 

when using the "requestMapName" function, the "mapName" variable will equal the name of the current map

  • Like 1
Posted
On 24/01/2020 at 21:34, Motar2k said:

-- CLIENT
mapName = ""

function requestMapName()
	triggerServerEvent("requestMapName", localPlayer)
end

addEvent("getMapName", true)
function getMapName(name)
	mapName = name
end
addEventHandler("getMapName", getRootElement(), getMapName)

--SERVER
addEvent("requestMapName", true)
function requestMapName()
	local mapName = getMapName()
	if mapName and mapName ~= "None" then
		triggerClientEvent(source, "getMapName", source, mapName)
    end
end
addEventHandler("requestMapName", getRootElement(), requestMapName)

 

when using the "requestMapName" function, the "mapName" variable will equal the name of the current map

didn't test it yet but thanks for effort

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