Jump to content

'getMapName()' Problem


FSXTim

Recommended Posts

Hello,

I want that the name of the actual running map is in a label.

clientside, (this happens, when the player open the GUI):

triggerServerEvent("MapName", getRootElement(), localp) 

(localp is defined!)

-- triggers the event to the following serverside function --

serverside, (gets the name of the map):

function MapName () 
    local MapN = getMapName() 
    triggerClientEvent("SetText", getRootElement(), MapN)  
end 
addEvent ( "MapName", true ) 
addEventHandler ( "MapName", getRootElement(), MapName ) 

-- triggers the name of the map to the following clientside script --

clientside, (puts the name of the map in a label):

function SetText()   
    guiSetText(mapText, "Map: "..MapN.."") 
end 
addEvent ( "SetText", true ) 
addEventHandler ( "SetText", getRootElement(), SetText ) 

Error (clientside): attempt to concatenate global 'MapN' (a nil value)

Greets

Link to comment
Guest Guest4401

Change

function SetText()  
    guiSetText(mapText, "Map: "..MapN.."") 
end 
addEvent ( "SetText", true ) 
addEventHandler ( "SetText", getRootElement(), SetText ) 

to

function SetText(MapN)  
    guiSetText(mapText, "Map: "..MapN.."") 
end 
addEvent ( "SetText", true ) 
addEventHandler ( "SetText", getRootElement(), SetText ) 

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