Jump to content

Lpsd

Administrators
  • Posts

    317
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lpsd

  1. My avatar is rare pun intended
  2. First of all, you should be using debugscript to check for errors. I'm more than certain this code would produce some errors. To do this type "debugscript 3" into the console then try using your script, errors appear at the bottom of your screen. Now to the code itself, check out the addCommandHandler wiki page & look at the arguments; Required Arguments commandName: This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function. handlerFunction: This is the function that you want the command to trigger, which has to be defined before you add the handler. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command (see below). These are all optional. addCommandHandler ("vip", Window, painel, myWindow) --your code. "painel" and "myWindow" have no use addCommandHandler ("vip", Window) --fixed code Same again with guiSetVisible Required Arguments guiElement: the GUI element whose visibility is to be changed state: the new visibility state if ( guiGetVisible ( Window ) == true ) then --Window is a function, not a GUI element guiSetVisible ( painel,Window, false ) --2nd arg expected boolean (true/false) got function showCursor ( false ) else guiSetVisible ( painel,Window, true ) --same here showCursor ( true ) end if ( guiGetVisible ( painel ) == true ) then --Checking for GUI element, not function guiSetVisible ( painel, false ) --Fixed args showCursor ( false ) else guiSetVisible ( painel, true ) showCursor ( true ) end All good, right? No - you're still making a big mistake. Since you're using the Window function to toggle the GUI visible/hidden, there's no need to keep creating (or overwriting) the GUI elements. painel = guiCreateWindow(286, 231, 454, 345, "VIP BSA", true) guiWindowSetSizable(painel, true) myWindow = guiCreateStaticImage(9, 19, 435, 316, "123.png", false, painel) button1 = guiCreateButton(0, 229, 140, 49, "Skin VIP", false, myWindow) button2 = guiCreateButton(150, 229, 140, 49, "Carro VIP", false, myWindow) button3 = guiCreateButton(295, 229, 140, 49, "Habilidades", false, myWindow) button4 = guiCreateButton(347, 46, 78, 32, "Fechar", false, myWindow) guiSetAlpha(button1, 0.20) guiSetAlpha(button2, 0.20) guiSetAlpha(button3, 0.20) guiSetAlpha(button4, 0.20) All of the above code (taken from the Window function) should be put into a seperate function which is attached to an OnClientResourceStart event handler. Should be pretty easy to do. The Wiki is your best friend. Use it
  3. Now I'm almost certain this is a problem with the MTA server nmap when server is running (even when players cant connect) [root@server ~]# nmap -sU localhost -p22003 Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 16:55 UTC Nmap scan report for localhost (127.0.0.1) Host is up. Other addresses for localhost (not scanned): 127.0.0.1 rDNS record for 127.0.0.1: localhost.localdomain PORT STATE SERVICE 22003/udp open|filtered unknown Nmap done: 1 IP address (1 host up) scanned in 2.06 seconds main thing here being the filtered... Nmap when server off [root@server ~]# nmap -sU localhost -p22003 Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 17:02 UTC Nmap scan report for localhost (127.0.0.1) Host is up (0.000032s latency). Other addresses for localhost (not scanned): 127.0.0.1 rDNS record for 127.0.0.1: localhost.localdomain PORT STATE SERVICE 22003/udp closed unknown I can't see how this could be anything other than an MTA issue, if it was a problem with my firewall or network it wouldn't just be coincidentally affecting MTA ports. Anyone?
  4. % is modulo. It gives you the remainder from a division 2 % 1 = 0 3 % 2 = 1 50 % 23 = 4 and so on
  5. Not sure, it might be outdated. Don't know too much about it if I'm being honest
  6. No problem. Good luck
  7. Take a look at https://wiki.multitheftauto.com/wiki/Modules/FileSystem - I haven't used it myself so can't say whether it works or not.
  8. It's not possible without creating your own server module (I think) Just out of interest why would you need to create a folder there?
  9. Well, that wasn't what you asked for You can create a folder in another resource, by doing fileCreate(":resourceName/path/file.lua") Some examples of your code would help, too
  10. https://wiki.multitheftauto.com/wiki/FileCreate fileCreate You need to create a file along with it, but that will create directory if it doesn't exist, ie fileCreate("directory/file.lua")
  11. Check out https://wiki.multitheftauto.com/wiki/SetElementData More specifically, the synchronize argument
  12. So drawing upon @SuperCroz's idea, it'd be pretty simple. addEventHandler("onClientRender",root,function() for i,player in pairs(getElementsByType("player")) do if getElementData(player,"typing") == true then if not getElementData(player,"showtyping") then setElementData(player,"showtyping",true,true) end --here is your dxDrawImage3D chat bubble or such else if getElementData(player,"showtyping") then setElementData(player,"showtyping",false,true) end end end end) Well, I think that'd work. I don't use element data too often
  13. no. you won't find any support for doing so on these forums.
  14. Lpsd

    im new

    For a start you're quoting the wrong line number from the code example, you mean line 17 Secondly, are you using default dayz resource?
  15. If your recent posts are anything to go by, you're probably using this resource incorrectly. Care to share a better explanation or provide screenshots yourself of the problem you're having?
  16. So what's the point blocking it for clients but not for the server itself? So much for the trust of community resources Besides, I can't see any benefits - there are quite a few restrictions in Lua, however it doesn't matter due to the MTA functions provided to us.
  17. Not that simple. You're aware of client side right?
  18. @TrickyTommy as I explained in reply, that's bad practice and you shouldn't do it. What if on the off-chance the clientside didn't load in 2500ms? Then you're screwed. Do it the way I suggested by having an onClientResourceStart which makes a call to the serverside - then you know that the clientside is definitely loaded.
  19. @#,+( _xiRoc[K]; > That's bad practice. If you use onResourceStart to trigger it, should create an onClientResourceStart event on the clientside which then calls to the serverside. This ensures the clientside is loaded properly.
  20. setVehicleNitroCount https://wiki.multitheftauto.com/wiki/SetVehicleNitroCount
  21. Lpsd

    im new

    What? You added a space between the arguments to addCommandHandler... that won't change anything. Anyway, what the OP is trying to explain is that he already has a 'bounty' system and he wants to create a chatbox message when someone reaches 'x' score on the bounty script. @MaTrix2 you'll need to edit the bounty script, search through the code and find where a bounty is set on a player. Here you'll be able to add the outputChatBox line. If you need any further help then you should post some code from your bounty script, at the part where a bounty is set on a player.
  22. Lpsd

    Login problem

    Because there is either 0 results in rows or more than 1. So there are either 0 accounts in the database, or duplicate accounts
  23. So, I'm having a problem with UDP ports 22003 and 22126 on my MTA server and not sure where else to turn. I'm running CentOS 7 Linux release 7.3.1611, 3.10.0-514.26.2.el7.x86_64 These ports have definitely been opened fine. Players are able to connect & play, then randomly they'll all get timed out and no-one will be able to connect for a random length of time, usually lasting between 5-30 mins, sometimes longer. This has been happening since the MTA server was setup on my machine, maybe a week ago? During this time, https://nightly.multitheftauto.com/ports/ reports that the ports 22126 and 22003 UDP are closed. 22005 (TCP) is fine. To confirm this I type 'openports' into the MTA server console and it shows 22003/22126 are closed and 22005 open (the MTA server is still running) Running "netstat -anp | grep 22003/22126" in SSH shows udp 0 0 0.0.0.0:22003 0.0.0.0:* 35501/./mta-server64 udp 0 0 0.0.0.0:22126 0.0.0.0:* 35501/./mta-server64 So, it's listening. Next I do "nmap -sT -sU -p- xx.xx.xx.xx" to check which ports are open. PORT STATE SERVICE 22003/udp open|filtered unknown 22126/udp open|filtered unknown I spoke to my host just recently, they checked everything out and suggested that it could be a problem with the service running on these ports - they didn't find any problems with firewall config or my network. Furthermore these are the only ports effected by this problem, all my other ports are completely fine which have been configured in exactly the same way. I've tried all the obvious steps, restarting my machine, stopping all custom resources/scripts on my server. So, I'm wondering if there's a possibility this could be a problem with the MTA server? Running out of ideas. Any help appreciated.
×
×
  • Create New...