Jump to content

TheDZetko

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by TheDZetko

  1. Hello all, I have been working on this script using some GUI elements for some time now and I just bumped into one problem. I have set the function to show the window each time a player joins (onPlayerJoin). But when I connect or reconnect, nothing happens (no window shows). What is the problem? This is my script.lua (client). window = guiCreateWindow(0.4,0.35,0.25,0.25,"D'n'T Servers | Welcome on my server.", true) btnpolice = guiCreateButton(0.03,0.4,0.45,0.55,"Police", true, window) btnterrorists = guiCreateButton(0.53,0.4,0.45,0.55,"Terrorists", true, window) labelchoose = guiCreateLabel(0.3,0.1,0.5,0.3,"Choose a team to connect to.", true, window) guiWindowSetMovable(window,false) guiWindowSetSizable(window, false) guiSetVisible(window, false) showCursor(false) addEventHandler("onPlayerJoin", getResourceRootElement ( getThisResource ()), function() guiSetVisible(window, true) showCursor(true) end ) -- function buttonclicked(localPlayer, button) -- if button == "left" and state == "up" then -- setPlayerTeam (localPlayer, "Police") -- else -- setPlayerTeam (localPlayer, "Terrorists") -- end -- guiSetVisible(window, not guiGetVisible(window)) -- showCursor(not isCursorShowing()) -- end -- addEventHandler("onClientGUIClick", buttonred, redteam, false) function policeteam(localPlayer, button) local policeteam = getTeamFromName("Police") if button == "left" and state == "up" then if (policeteam) then setPlayerTeam(localPlayer, policeteam) else outputChatBox("We cannot assign you to Police team.", localPlayer) end guiSetVisible(window, false) showCursor(false) end end addEventHandler("onClientGUIClick", btnpolice, policeteam, false) function terroriststeam(localPlayer, button) local terroriststeam = getTeamFromName("Terrorists") if button == "left" and state == "up" then if (terroriststeam) then setPlayerTeam(localPlayer, terroriststeam) else outputChatBox("We cannot assign you to Terrorists team.", localPlayer) end guiSetVisible(window, false) showCursor(false) end end addEventHandler("onClientGUIClick", btnterrorists, terroriststeam, false) And here is my meta.xml file. <meta> <script src="script.lua" type="client" /> </meta> Where is the problem? Please help (me). Thank you all so much in advance, TheDZetko
  2. Hello all, I am a newbie to Ubuntu and Linux in general. I followed this tutorial on MTASA.com wiki. https://wiki.multitheftauto.com/wiki/In ... _GNU_Linux And after doing basically all what is needed to run the server properly, it doesn't work. When I run the server through terminal, it says: "No such file or directory". When I tried to run the server using the file explorer, it doesn't do anything either. On the forums I found out, that I will need 64-bit packages for my "Ubuntu 14.04.1 LTS 64-bit" OS version. But I can't find these packages. So here is my question. Where can I download the packages? Or are they available yet? Thank you a lot, TheDZetko
  3. Hello all, I have a problem with my script which is using a local SQLite database (internal.db file in MTA San Andreas 1.4\server\mods\deathmatch). The server.lua looks like this: function onResourceStart() executeSQLCreateTable("accounts", "id INTEGER, name TEXT, password TEXT, ip TEXT, serial TEXT, cash INTEGER") end addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()), onResourceStart) function plrSetCash() sourcename = getPlayerName (source) result = executeSQLSelect ("accounts", "*", "name = '" .. sourcename .. "'" ) outputChatBox ("Ok") if (type(result) == "table" and result[1].cash == 0) or not result then outputChatBox ("This is your first time here. You don't have any cash. Welcome " .. sourcename .. "!", source) else outputChatBox ("Welcome back " .. sourcename .. "!", source ) executeSQLUpdate ( "accounts", "cash = cash + 100" ) end result = executeSQLSelect ("accounts", "id", "name", "password", "ip", "serial", "cash" ) outputChatBox ("Your ammount of money is: " .. result[1].cash ) end addEventHandler ("onPlayerSpawn", getRootElement(), plrSetCash) Everytime I connect to my server, it says this error - ERROR: plrcashshowmsgonstart\server.lua:19: attempt to index field '?' (a nil value) - in the console. The user is in the database, but the error above is still showing up. Where is the problem? And question #2 - Do I need a client.lua file for this type of script? Please help. Thank you all, TheDZetko
  4. Et-win: I knew that it was a database, but I was wondering where to find that .db file. But thanks anyway. Chaos: I found that file after I posted this topic. But also thank you for your reply.
  5. Hello all, I have one question. Where are all player information (username, password, cash) stored by default? Thank you all for replies, TheDZetko
  6. Hello all, I have a little problem with my script. Here is the code. function test(source) outputChatBox("Hello World!", source, 255,100,10, true); end addCommandHandler("test",test) And here is my meta.xml file. <meta> <script src="test.lua" type="server"> </meta> Here is the problem. I have both files in one folder named "test". I placed the folder to my "resources" folder. When I start the server, it says all resources started (0 failed). When I connect to my server with an account with admin rights, start the resource and type /test, it doesn't do anything.
×
×
  • Create New...