• Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About 12g

  • Rank
    Foot Soldier
  • Birthday 17/04/1996


  • Location
  • Interests
    Music, Videogames, Computers and Meeting Interesting People

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 12g

    Projectiles detouring

    so, uh, yeah, again me, please, help. thanks.
  2. https://wiki.multitheftauto.com/wiki/OOP
  3. It's quite obvious, heh. function phone:new() local data = {} --blahblahblah return data end --blahblah phone:new() "data" isn't processed anywhere outside of that function scope if you do it like that. Consider deleting the "local" prefix inside of that function block, or adding it to the last line, like: local data = phone:new() or, let that table exist outside of any block, so its scope is limited to the whole script file.
  4. 12g

    Projectiles detouring

    I'd be glad if someone could answer me this. Thanks beforehand.
  5. Ok guys look, I've got this code: local findX, findY, findZ = getWorldFromScreenPosition(cx, cy, 60) local rlX, rlY, rlZ = getElementPosition(localVehicle) rlZ = rlZ+4 local hit, finalX, finalY, finalZ, element = processLineOfSight(rlX, rlY, rlZ, findX, findY, findZ, true, true, true, true, false, true, true, true, localVehicle, false) if not hit then finalX, finalY, finalZ = findX, findY, findZ end if element == nil or getElementType(element) ~= "player" then createProjectile(localPlayer, 19, rlX, rlY, rlZ, 0, nil, findRotation(rlY, rlZ, findY, findZ), findRotation(rlX, rlZ, findX, findZ), findRotation(rlX, rlY, findX, findY), (findX-rlX)/60, (findY-rlY)/60, (findZ-rlZ)/60) else createProjectile(localPlayer, 20, rlX, rlY, rlZ, 1, element) end It's supposed to launch a rocket directed to the center of the screen. It works flawlessly if pointing to N or S. Otherwise, it's working, but said rockets detour after some travelled distance, which I believe to be caused by the rotation, but I really can't tell how to fix it... Maybe I'm using findRotation wrong? I've also tried setting all rotation axis' to 0, but it didn't help. Can someone help me with this? It has nothing to do with beforehand values, I've already debugged everything, and the problem is only there in the createProjectile function.
  6. local polveh = getElementsByType("vehicle") I'm gonna help you to understand how to use this. So, you want it to be triggered for every police vehicle? I guess you mean you mean to every player who is in a police vehicle. That isn't possible from client-side, unless you want to add unnecesary extra processing both for client and server by triggering events from client and back from server. So, in the server script is where we'll use some of that code you have there. You gotta paste the following in the part where you trigger the client event. Use your common sense to know if there's something to replace, remove, or add; I'm only explaining how to do this particular stuff work, NOT how to make it compatible to your whole code: local polveh = getElementsByType("vehicle") for i, v in ipairs (polveh) do --Let's loop through every policecar if getElementData(polveh,"Service") == "Police" then --I hope the car itself has this element data, not the player pl = getVehicleOccupant(polveh) --Let's only retrieve the player who's the driver of a policecar (it isn't a good idea to trigger the event more than once per car) triggerClientEvent(root, "policeradio", pl) --trigger that client event to EVERY player that exists (hence that "root") end end --This "for" loop will be done for every single policecar, remember that! Now, for the client-side: addEvent("policeradio", true) addEventHandler("policeradio", root, function() local x, y, z = getElementPosition( source ) local polveh = getPedOccupiedVehicle( source ) policeradio = playSound3D("policead.mp3",x,y,z, true) attachElements(polveh, policeradio) end end ) This should work. You can delete my comments (the gray text) when you paste the codes; they're only there to help you understand why and how it all works. Also, remember to eventually destroy the sound!
  7. 12g

    About compiler Gui

    Since compiling is only the action of transcripting a file to make it understandable in computer language (or, in this case, to simply avoid to see the source code, because it's a scripting language), there are de-compilers in the internet, built to do exactly the opposite process in order to get the source code out of a compiled file. However, there are methods to avoid that. That page you passed has two for the MTA Lua scripting language, the second one only possible to be used in 1.3.4 or later releases of the MTA client (the mod). To put it simple: if you have downloaded the latest one recently from the main page, you shouldn't have a problem using any of those two options. I can't provide much of an in-depth technical look, because I'm not into it yet. I hope my answer served you anyway.
  8. 12g

    About compiler Gui

    I don't understand your question. Where did you take those concepts from (e.g. maybe a forum topic, post which)? And what is, precisely, what you ask for?
  9. That error occurs when you try to insert values into non-declared tables. To fix it, either change the name of your button to something without the brackets [ ], or add this line before it: guestb = { } This is declaring a table. You can read more about tables and related at the Lua wiki. If you're familiar with arrays, it's similar but easier to use.
  10. Here, an user-friendly description. getTickCount returns a given time in miliseconds that you should use, but you gotta read the documentation for it in order to acknowledge how to use it. Sam1er gave you a whole example, you can use it to experiment and check how it works.
  11. You can use custom Element Data for this. It's kinda messy, but instead of letting everything (resources, chat) display the players' names, you must make them display said element data instead. There's also a better alternative, since element data uses a good amount of bandwidth. It's just a bit harder to manipulate from both server and client side.
  12. This might be the problem: you must declare handler functions before the event handlers they will be used for. guestb["guests"] = guiCreateButton(140, 178, 70, 30, "Guest", false, loginWindow["mainWindow"]) function guest32(button,state) if button == "left" and state == "up" then --Maybe you should use state == "down" instead guiSetInputEnabled( false ) guiSetVisible(loginWindow["mainWindow"], false) showCursor(false) end end addEventHandler("onClientGUIClick", guestb["guests"], guest32, false) As a note, when you test your scripts, bother using the command /debugscript 3, to check where do said errors come from. This might be an exception though, since addEventHandler's sources are never shown. If it still doesn't work, then post your results with that command I just said, plus your full codes.
  13. 12g

    [HELP]3D radio

    attachElements You'd know how to use this, right?
  14. The wiki said So, don't worry. You should be doing well unless you use onClientPlayerWasted to call a spawnPlayer function (which is kinda pointless nowadays); onPlayerWasted has no issues.
  15. How's that? You want someone to pretty much script it all for you, I guess? You pay for it? Isn't it the FFS multigamemode, by any circumstance?