MetaGamer Posted October 30, 2011 Share Posted October 30, 2011 So this is the code main_client.lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} function giveWeapon(wID, wAmmo) triggerServerEvent("giveW", getLocalPlayer(), wID, ammo) end function showWelcomeMessage() GUIEditor_Window[1] = guiCreateWindow(208,274,343,289,"Stanopolo",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(68,40,203,40,"images/logo.png",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(13,78,316,169,"Welcome to the Stanopolo server.\n\n\nCurrent Version: [Alpha 1.0]",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(122,260,92,20,"OK",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", GUIEditor_Button[1], btnOK_Click, false) end function btnOK_Click() guiSetVisible(GUIEditor_Window[1], false) end main_server.lua function PlayerLogin() local x = 1949 local y = -3223 local z = 5 local name = getPlayerName(source) spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) setElementModel(source, 288) gW(8, 1) outputChatBox("Welcome to the Stanopolo " .. name, source) showMessage() end addEventHandler("onPlayerLogin", getRootElement(), PlayerLogin) function gW(gid, gammo) giveWeapon( source, tostring(gid), tostring(gammo) ) end addEvent("giveW", true) addEventHandler("giveW", getRootElement(), gW) The error is attempt to call global 'showWelcomeMessage' (a nil value) Link to comment
BinSlayer1 Posted October 30, 2011 Share Posted October 30, 2011 function PlayerLogin() local x = 1949 local y = -3223 local z = 5 local name = getPlayerName(source) spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) setElementModel(source, 288) gW(8, 1) outputChatBox("Welcome to the Stanopolo " .. name, source) triggerClientEvent(source, "showMessage", source) end addEventHandler("onPlayerLogin", getRootElement(), PlayerLogin) function gW(gid, gammo) giveWeapon( source, tostring(gid), tostring(gammo) ) end addEvent("giveW", true) addEventHandler("giveW", getRootElement(), gW) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} function giveWeapon(wID, wAmmo) triggerServerEvent("giveW", getLocalPlayer(), wID, ammo) end function showWelcomeMessage() GUIEditor_Window[1] = guiCreateWindow(208,274,343,289,"Stanopolo",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(68,40,203,40,"images/logo.png",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(13,78,316,169,"Welcome to the Stanopolo server.\n\n\nCurrent Version: [Alpha 1.0]",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(122,260,92,20,"OK",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", GUIEditor_Button[1], btnOK_Click, false) end addEvent('showMessage', true) addEventHandler('showMessage', getRootElement(), showWelcomeMessage) function btnOK_Click() guiSetVisible(GUIEditor_Window[1], false) end Assuming by "attempt to call global 'showWelcomeMessage' (a nil value)" you meant "attempt to call global 'showMessage' (a nil value)" it happend because you tried to call a client function from serverside (and misspelled the function name too as showMessage ~= showWelcomeMessage) instead, call a client event from serverside and attach the event to the clientside function like in the above code Link to comment
MetaGamer Posted October 30, 2011 Author Share Posted October 30, 2011 thanks for helping me out! 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