waqaarali Posted April 18, 2014 Share Posted April 18, 2014 I really want to learn to script, but I don't really understand what I do wrong and how to script, I understand how to fix scripts but I don't know how to script. I tried to make a simple spawn script but I failed to even make the GUI to work. spawn.lua rootElement = getRootElement() function showMain() mainwindow = guiCreateWindow(236, 197, 405, 296, "", true) guiWindowSetSizable(mainwindow, false) hospital = guiCreateButton(18, 42, 117, 43, "Hospital", true, mainwindow) police = guiCreateButton(18, 104, 117, 43, "Police Department", true, mainwindow) cityhall = guiCreateButton(18, 168, 117, 43, "City Hall", true, mainwindow) ammunation = guiCreateButton(18, 234, 117, 43, "Ammunation", true, mainwindow) memo = guiCreateMemo(143, 43, 252, 234, "Welcome to Gangsta's Paradise Roleplay Server. Before you can start playing please select one of the positions you would like to spawn. Remember once you have spawned you cannot then come back to this window unless you die. So make a wise choice before you spawn.\n\n\n\n\nSpawn Script By Gangsta v1 ", true, mainwindow) guiMemoSetReadOnly(memo, true) end addEventHandler("onClientPlayerJoin", rootElement, showMain) meta.xml <meta> <info author="Gangsta" type="script" description="Spawn" /> <script src="spawn.lua" /> </meta> Link to comment
Castillo Posted April 18, 2014 Share Posted April 18, 2014 onClientPlayerJoin is triggered only by remote players, you must use onClientResourceStart. And, replace "rootElement" in your event handler with "resourceRoot", else it'll be triggered when any resource starts. 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