Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. It won't be secure. It will be more secure than "compiling" script.
  2. If you did what I told you to, it would work but if you prefer to ignore people trying to help you then let it be that way.
  3. You can't remove anonymous functions. If you want to remove functions from event you have to create a function outside other functions. The function has to have a name and be created only once. In your case, you create new anonymous function every time you call showInputBox function and when you addEventHandler this will add another function to the list of functions the event should call and you'll end up with code being executed multiple times. Make these functions outside showInputBox and let them have their names which you'll than use in addEventHandler and removeEventHandler, otherwise you keep adding new functions and are not removing any functions at all. I'm pretty sure that removeEventHandler returns false in your code.
  4. If you're total noob, I suggest you have a read at: - https://wiki.multitheftauto.com/wiki/Scr ... troduction - https://wiki.multitheftauto.com/wiki/Main_Page - and https://forum.multitheftauto.com/viewtop ... 91&t=25032
  5. https://wiki.multitheftauto.com/wiki/OnConsole Or add new groups to your acl.xml and add players to it... Same way admin panel works.
  6. capitanazop, READ ENTIRE TOPIC! LEAVE THE COUNTDOWN FUNCTION ALONE! DO NOT MODIFY IT UNLESS YOU KNOW WHAT YOU'RE DOING! From what I see you don't know what you're doing. Your code will not work... What's the purpose of Countdown function? It starts countdown and takes only 1 parameter. I was hoping you can add command handler function yourself easily but it seems to be headache for both of you. addCommandHandler( "countdown", function( _, secs ) secs = tonumber( secs ) if secs then Countdown( secs ) end end )
  7. If you ever use "Search" forum feature you'd find it straight away... https://forum.multitheftauto.com/viewtop ... =countdown
  8. No, this will not cause any issues since there is no "onMarkerHit" client-side event.
  9. Why can't you click anything? Can't you see a cursor that you're showing or buttons are not click-able? You want to use guiBringToFront to make it top most window (make it the first GUI element at "Z axis"). DO NOT use client as a parameter for your function attached to an event that is triggered from client-side script simply because client is another hidden variable (just like source) that is passed to function calls every time client triggers a server-side event and this variable points to the player that triggered the specific event. Just remove the client parameter for spawnlsmarket function. You don't need this for another reason: you don't even pass any arguments when you triggerServerEvent.
  10. I have absolutely no idea what your problem is. Transparent images have border lines which you may or may not want, if your image is stretched or its size is not 1:1 when you create it with script (e.g. 100x50 -> 200x100 -> 300x150, etc.).
  11. If you add vehicles with tag then you can't. You can use your own tag (say, ) and use getElementsByType function to get all the elements of that type (randomVehSpawn in this case) and than create your vehicle at one of those places. This is not ideal because you'll still have to use createVehicle.
  12. The way I test it is testing it on myself. It's not always possible to test script on yourself (e.g. shooting at yourself). Try to script, don't test and see what comes up after a more than 1 thing that you changed. I usually don't test script until I finish 1 or 2 features. Also, I script it to be able to test on myself (e.g. sending messages to myself). If you want to test it with someone, invite him to join your server or upload your script on your dedicated server. I've never tested any script using peds.
  13. How do you think your script tells every player there is an object or a vehicle spawned in that specific place? They "download" (receive) the data which server sends to them to tell them where the vehicles, objects, markers, other players, etc. are located.
  14. It would be easy with metatables but there are main 2 situations where you don't want to use OOP. 1. Calling timers fails, if calling a method from an instance of a class. local a = Class:new(); setTimer( a:method, 100, 1 ); -- this doesn't work setTimer( Class.method, 100, 1, a ); -- AFAIR, this fails too 2. You can't really export classes from resource and that makes no use of OOP in Lua for MTA. MTA has new calling exported functions system (accessing exported functions from "exports" table). exports.myresource:Class:new(); -- Class is a table(class) not exported function and that's why it fails It would be nice. Even though, I use OOP as often as I can since this is good to get used to.
  15. Yeah, no idea why people still use tables for spawn locations and other stuff like markers, vehicles, etc...
  16. You have to tell resource which function you want to export. To do this, you need to add export node in your meta.xml: https://wiki.multitheftauto.com/wiki/Meta.xml If you use MTA:SE you can start typing "exp" and you'll see a list of exported functions from other resources or you can see function list to the right of the window (includes exported functions from every resource).
  17. 50p

    Help Acl admin

    https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI https://forum.multitheftauto.com/viewtop ... 91&t=25032 Read. Nobody is going to make it for you. We help everyone but we don't script for them. As I said, use map files for spawn locations.
  18. 50p

    Help Acl admin

    Use map files and Map Editor. For tebles go here: http://www.lua.org/pil/3.6.html
  19. No. You haven't used Search correctly.
  20. Does anyone know why this returns a bad argument warning, but still executes perfectly? Does getElementType hate tables or something? <_> If your arrElementIndex[eCount] contains a table than you will fail. Though, if it's an MTA element you should be fine (without any error/warning messages). Learn to debug and find out what arrElementIndex[eCount] is before you call getElementType. https://wiki.multitheftauto.com/wiki/Debugging
  21. 50p

    Decimal problem

    But you can get invalid or unexpected results from getElementData since every resource can modify element's data especially such as "Deaths", "Kills", etc. therefore using names such as "myresource.deaths" is more suitable for element data and is safer.
  22. 50p

    Decimal problem

    playerdeaths will never be 0 if he doesn't start out on a negative number (which is unlikely) since he increments it before any dangerous divisions. Not necessarily. I use 1 / playerdeaths, because divide by 0 is impossible. But what you say is also true, the answer would be not what I want. But I changed it: 1/playerdeaths/2 Indeed playerdeaths would be never 0, because this is only called when the player dies. But that doesn't matter. My numbers still won't have 2 decimals. I still don't know what to do. You can NOT divide by 0 but you can divide 0 by anything but 0, which will give you 0.
  23. 50p

    Decimal problem

    What do you want if that's not what you want? Why do you use 1 when playerkills is equal to 0? What if playerdeaths is 0? You will fail.
  24. 50p

    Help Acl admin

    That is outdated. If you add an account manually you will need a md5 hash of your password. To do this, simply run this server side script: print(md5("myVerySecureMd5Password")) Or generate one with any website, for instance: http://www.miraclesalad.com/webtools/md5.php
×
×
  • Create New...