hemen Posted July 1, 2010 Posted July 1, 2010 Client-side script not loaded, because one command don't work. Also, server doesn't return any errors. File meta.xml: <meta> <info author="hemen" description="Hemen's LVDM" version="1" type="gamemode" /> <script src="gm_server.lua"/> <script src="gm_client.lua" type="client"/> <map src="gm.map"/> </meta> When i did set type of "gm_client.lua" to "server", server returned me all errors! p.s. sorry for my bad english
Spider Pork Posted July 1, 2010 Posted July 1, 2010 There's something wrong in gm_client. Show us your code.
hemen Posted July 1, 2010 Author Posted July 1, 2010 var0 = 0 gMe = getLocalPlayer() function helpfunc(player,commandName) if var0 == 0 then local mainGui = guiCreateWindow(450.0,450.0, 50.0, 50.0, "Hemen's LVDM help.", true) guiWindowSetMovable(mainGui,false) guiWindowSetSizeable(mainGui,false) rulesLabel = guiCreateLabel(455.0,455.0,40.0,40.0,[[ Hemen's LVDM 1. Author: hemen. This is the mode-moneygrub. You can do that you like. You can earn money on Pirate Ship. You can ]],true,mainGui) guiSetVisible(mainGui, true) var0 = 1 return else var0 = 0 guiSetVisible(mainGui, false) return end end addCommandHandler("help",helpfunc);
MaddDogg Posted July 1, 2010 Posted July 1, 2010 Omg, how about indentation? Several mistakes or unneeded lines: 1. The "relative" coords at guiCreateLabel do not have a relative value. 2. A "guiSetVisible(mainGui, true)" is not needed after the creation, because any gui element created is visible by default. 3. The returns are not necessary, because first you don't return any value, second you don't need to end the function at this point, because there won't be anything executed within the function after this point anyways. 4. If your var0 holds 1, you just hide the gui window. At the next call of the function, it is still existing, but you create a new one. You should either check at showing, whether it is already created or not, or destroy the gui elements at hiding. 5. Your function arguments are incorrect. When you are working clientside, addCommandHandler won't pass on the player argument, because it is always the local player, who will trigger this command. Also, you don't even use both of them, so you can just get rid of them (by just writing "function helpfunc()"). This may fix it, but perhaps it won't. If not, also publish your serverside script.
hemen Posted July 1, 2010 Author Posted July 1, 2010 Omg, how about indentation?Several mistakes or unneeded lines: 1. The "relative" coords at guiCreateLabel do not have a relative value. 2. A "guiSetVisible(mainGui, true)" is not needed after the creation, because any gui element created is visible by default. 3. The returns are not necessary, because first you don't return any value, second you don't need to end the function at this point, because there won't be anything executed within the function after this point anyways. 4. If your var0 holds 1, you just hide the gui window. At the next call of the function, it is still existing, but you create a new one. You should either check at showing, whether it is already created or not, or destroy the gui elements at hiding. 5. Your function arguments are incorrect. When you are working clientside, addCommandHandler won't pass on the player argument, because it is always the local player, who will trigger this command. Also, you don't even use both of them, so you can just get rid of them (by just writing "function helpfunc()"). This may fix it, but perhaps it won't. If not, also publish your serverside script. Thank you, but why, when i wrote simply text (blablabla) in gm_client.lua , server didn't returned any errors? Command doesn't works.
Lordy Posted July 1, 2010 Posted July 1, 2010 Well to think of it, server never returns clientside errors. How on earth should the server know what's happening in your client? That's where debugscript comes in, so you can see the clientside errors in your MTA client. Check the debugging article at wiki if you're not familiar with debugscript.
hemen Posted July 2, 2010 Author Posted July 2, 2010 Thanks all, i found log of client-side script bugs in folder MTA.
Lordy Posted July 2, 2010 Posted July 2, 2010 Yes, debugscript logs also, but it's much easier to look ingame. Just have full access and write /debugscript 3
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