Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. As far as I understand you, you're looking for this: https://wiki.multitheftauto.com/wiki/DxDrawBorderedRectangle Note: This function is not a native MTA function. You will need to copy-paste the function given on the wiki in order to use it.
  2. pa3ck

    % math operator

    That's modulus. It get's the remainder of 2 numbers that divide into each other. For example 5%2 will give you 1, because you can only divide 2 into 5 twice (2x2=4) and the remainder is 1. 6%3 = 0, because 2x3 = 6 7%3 = 1, because 2x3 = 6 and remainder is 1 etc. Most of the times I used it to check if a number is even like: local myNum = 11 if ( myNum % 2 == 0 ) then -- if you divide by 2 and no remainder, it's even print('even') else print('odd') end
  3. pa3ck

    Sort table

    Why don't you use ORDER BY Desc / Asc ?
  4. pa3ck

    me chat

    You have to cancel the onPlayerChat event after the if statement like so: addEventHandler("onPlayerChat", root, function(message, messageType) if messageType == 1 then cancelEvent() onChat(source, message) end end)
  5. When using setElementData, the last argument is whether you want it to sync with the server or not. If it's set to false, the scope of that data is the local client only. It's perfectly fine to setElementData's on GUI elements like the tooltip of an exitbox etc, as long as it's not synced with the server.
  6. return getWeaponIDFromName(weaponmodel) Where is weaponmodel defined? Looks like you misunderstand that function. It gets the weaponID from the name, not the name from the ID. Use return getWeaponNameFromID(weapon) instead
  7. So your table keys are the weapon ID's, so what is this for? local weaponmodel = getWeaponNameFromID(weapon) Shouldn't it be if WeaponNames[weapon] then return WeaponNames[weapon]
  8. If you look at spawnVehicle you can see it expects a vehicle element. Now, when you want to create a vehicle you wouldn't have the vehicle element, so they are not the same functions. You will need to use createVehicle. Yes, you would leave the parameters blank at the onResourceStart event. But make sure you have resourceRoot which is short for getResourceRootElement(getThisResource()) because if you leave it as root (short for getRootElement()) it will be fired whenever a resource starts, not just that single one. What else do you put there? Well, you want to create vehicles, that function is the right place to create vehicles. After you created that function, create a command which will check if the player vehicle model is the same as the mower model then create the GUI etc. But I would leave out the GUI, try to implement the checkpoint system first. Event names are always strings, make sure you put them like "onResourceStart" etc
  9. That code hurts my eyes, why are you not using loops to do all the work?
  10. pa3ck

    help with tables

    function deletePlayerInvite(player) for i, k in pairs(invitations) do if k[1] == player then -- k.player doesn't work because player is not the index k = nil return true end end end
  11. There's no need for triggers. When the user enters /paytoll check the distance between their position and the marker. If they're close enough, open the barrier.
  12. Freeroam is the name of the game mode that games with mta. If you press F1 you should see your x,y,z position as well.
  13. Don't worry about author, game mode etc attributes you don't need them. As long as your scripts are referenced in the meta.xml along with your files, it will be fine. If you look at the garage functions on the wiki you will see the link for the garage ID's and positions then you can just go to that position, use the command "gp" (if you're running freeroam) that will show your current position.
  14. pa3ck

    Car Lock System

    Add a debug message client side to see if the event has been triggered to the right players.
  15. pa3ck

    Car Lock System

    As long as you have playSound3D as @Mr.Loki mentioned, it will fade away gradually when you move away from the position of the sound whether you use the getDistanceBetweenPoints3D or not
  16. pa3ck

    Car Lock System

    I'm not sure about that, but I imagine they are the same, yea. I think that's just waste of bandwidth, why would you trigger to 50 other players even though you know they will be outside the "if statement" anyway, but that's just my opinion.
  17. Add this after accName = ... if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then return end
  18. pa3ck

    Car Lock System

    That should work yea, but 100 is way too high, play around with it, use lower numbers.
  19. You are on the right track, except that you never actually loop through the admins, you just loop through a table that has only 1 element in it, the user that executed the command. function adminMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) for k, adm in ipairs(getElementsByType("player")) do local acc = getAccountName ( getPlayerAccount ( adm ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then outputChatBox("#04B486[ADMIN-CHAT]"..name..": #FFFFFF"..message, adm, 255, 255, 255, true) end end end addCommandHandler("adminchat", adminMessage) (not tested)
  20. pa3ck

    Car Lock System

    createColSphere -> getElementsWithinColShape -> triggerClientEvent (with the table returned from getElementsWithinColShape)
  21. No, it's no longer possible, it has been removed a while ago.
  22. pa3ck

    help

    local lastUsed = getTickCount() addCommandHandler("toll", function(p, cmd ) if ( lastUsed + 10000 > getTickCount() ) then outputChatBox("Cannot use this command", p ) else -- code lastUsed = getTickCount() end end)
  23. pa3ck

    Textures

    Replace the TXD with an "empty" texture
  24. Don't think anyone will do that for you, you are not in the right place for requesting stuff. You can look up the community scripts, you might find something like this, if not, you will need to start learning lua.
×
×
  • Create New...