Jump to content

Tails

Members
  • Posts

    731
  • Joined

  • Days Won

    10

Everything posted by Tails

  1. @MGO_SA @Magiz0r @Reda_Iq @CarCrasher @Woffi1221 @Lt.Price @MoHaRx @Marinovv @DreaM40BG I pushed a small update to Cinema Experience (version 2.3) on March 20th, 2024. This is mostly a release to fix some long standing issues. The changes include: Fixed video playback issues with auto click through and ad skipping Improved screen resolution from 360p to 1080p Smoothed ambilight color transitions Unlocked Audio Toggle and Change View settings Added screen aspect ratio adjustment in settings Added YouTube Shorts support (.com browser only) Minor UI and texture updates Fixed hud compatibility issue Fixed some multiplayer sync issues A couple of new features added as well: onscreen video start messages, and the ability to Change View to look directly at the screen. I also cleaned up some unused settings and code. Note that if YouTube TV acts up, you can try enabling the embed video fallback by setting useEmbeds=true in shared.lua. This may cause some videos to error out though due to an embedding issue which is unfixable. You can download the updated version here. Let me know if you run into any other issues. Enjoy!
  2. Hi, this is likely a problem with your spawn code. In your code add an event called onPlayerSpawn for server or onClientPlayerSpawn for the client side and use the function fadeCamera. Here is an example for the client side: addEventHandler('onClientPlayerSpawn', localPlayer, function() fadeCamera(true) end) See here for more details: https://wiki.multitheftauto.com/wiki/FadeCamera
  3. Because @FLUSHBICEPS made a tiny mistake. The event doesn't return the player, it returns the damage the vehicle took. What you need to do instead, is use the getVehicleOccupant function to get the player. See https://wiki.multitheftauto.com/wiki/OnVehicleDamage for more info and an example.
  4. You can use getCameraMatrix: https://wiki.multitheftauto.com/wiki/GetCameraMatrix and setCameraMatrix https://wiki.multitheftauto.com/wiki/SetCameraMatrix
  5. I think what you're looking for is a continuous list addEventHandler( "onClientKey", root, function(b, state) if b == "arrow_u" and state then table.insert(skinTable, 1, table.remove(skinTable)) playSoundFrontEnd(1) elseif b == "arrow_d" and state then table.insert(skinTable, table.remove(skinTable, 1)) playSoundFrontEnd(1) end end) local x,y = 0, 0 local sx, sy = guiGetScreenSize() local maxShownItems = 7 local selectedItem = 4 --use middle item as the current selected item addEventHandler("onClientRender", root, function() for i=1, maxShownItems do local xy = (i)*55 -- draw rectangle behind text dxDrawRectangle(x, y+xy, 200, 50, tocolor(0, 0, 0, 125)) if i == 4 then -- selected item dxDrawRectangle(x, y+xy, 200, 50, tocolor(255, 0, 0, 125)) dxDrawText(" "..skinTable[i].name.." "..skinTable[i].price.."$", x, y+xy, x+200, y+xy+50, tocolor(255, 255, 255, 255), 1.5, 'default', 'center', 'center', false, false, true, true) else -- the other items dxDrawText(" "..skinTable[i].name.." "..skinTable[i].price.."$", x, y+xy, x+200, y+xy+50, tocolor(255, 255, 255, 255), 1, 'default', 'center', 'center', false, false, true, true) end end end) This is pretty standard for these types of lists (ignore the styling)
  6. Maybe use + in your calculation instead. Or paste your loop here so we can look at it.
  7. Hi Snow-Man, Just do something like this: local startIndex = 1 local maxShownItems = 3 addEventHandler('onClientRender', root, function() for i=startIndex, startIndex+maxShownItems do local y = (i-startIndex)*20 dxDrawText(skinTable[i].name, 0, y, 100, 100) end end) And then add or subtract 1 to the startIndex on a key press addEventHandler('onClientKey', root, function(key, p) if key == 'arrow_u' and p then if startIndex > 1 then startIndex = startIndex - 1 end elseif key == 'arrow_d' and p then if startIndex+maxShownItems < #skinTable then startIndex = startIndex + 1 end end end) Hope this helps.
  8. Tails

    /me BUG

    I think you have to cancel onPlayerCommand. Otherwise try doing it on the client side instead. https://wiki.multitheftauto.com/wiki/OnPlayerCommand
  9. Yes with dxDrawText and onClientRender event (see: https://wiki.multitheftauto.com/wiki/DxDrawText) local sw, sh = guiGetScreenSize() addEventHandler('onClientRender', root, function() dxDrawText('hello', 0, sh-25, sw, sh+25, tocolor(255, 255, 255, 150), 1, 'default', 'right', 'top', false, false, true) end) I think this should work. You may have to play around with the x,y,rightx,bottomx values to get it right though, I just wrote this off the top off my head.
  10. You have to shut down your server safely with ctrl+c in windows, or shutdown command in the server console. If the server is stopped abruptly, onResourceStop will not be triggered! To avoid losing data in the instance your server crashes, I highly recommend saving important player data such as money every time you update something.
  11. Definitely first one. I would format it like this though, with the start of the function on the same line. It's the common way of writing it because you'll have less indentation. addEventHandler("onClientGUIClick", window, function(button, state) if button ~= "left" then return end if source == btnClose then return closeMenu() end if source == btnChange then local AmountKey = guiGetText(EditKey) if AmountKey == "" then return outputChatBox("error", 255, 25, 25, true) end if string.len(AmountKey) ~= 16 then return outputChatBox("error", 255, 25, 25, true) end outputChatBox("successful", 255,126,0, true) closeMenu() end end) Good luck!
  12. SetElementData is data stored on the player temporarely, if the player logs off, or the server shuts down, you will lose that information. It is stored inside GTA memory and is synced with all players and the server unless specified otherwise. SetAccountData only allow you to insert key/value pairs into a fixed db. You have no real control over it, and with lots of data this could be bad for performance because it'd need to do a lot of queries (via getAccountData) for each key/value pair that you saved to a player account. MySQL allows you to structure your database and gives you control over what you put in your database and how you modify and query the data. You can also access the data from other places like a website. This will give you the best optimization. If you're new or uncomfortable with MySQL you could try using SQLite instead, which creates a new .db file for you which you gives you similar control over it as MySQL except that you don't have a address from which you can access it. I recommend this if you're new and want to try out MySQL for the first time. You don't have to install MySQL to your desktop or server with this option. You can use setAccountData for small gamemodes if you don't need to store a ton of data per user, otherwise use MySQL or SQLite. Hope this helps.
  13. Tails

    [HELP]

    Make sure that resource with the log function is started, preferably before the other resource.
  14. Tails

    [HELP]

    Is that the fv_logs resource? Make sure to add this line: <export type="server" function="createLog"/>
  15. Tails

    [HELP]

    Make sure you have exported the function createLog in the fv_logs resource meta.
  16. From http://lua-users.org/wiki/FormattingNumbers, slightly simplified: function comma_value(n) return tostring(n):reverse():gsub('(%d%d%d)','%1,'):reverse() end print(comma_value(4024910100)) --> 4,024,910,100 Hope this helps
  17. You need to use givePlayerMoney: https://wiki.multitheftauto.com/wiki/GivePlayerMoney
  18. Also make sure you have disabled "Always show download window" in the mta settings.
  19. You can simply keep track of the ids by adding them to a table and then check against that table to see if it's already seen that id. local ids = {} for i,v in ipairs(getElementsByType("blips")) do local id = getBlipIcon(v) if not ids[id] then ids[id] = true outputChatBox("ID Icon : "..id) end end ids = {} -- clear it if necessary (depends on your application) You'll probably want to put this inside a function so that you can trigger it again later, or have the function return the unique ids. But this all depends on the application.
  20. Tails

    [HELP]

    You need to add a if statement and check for the player's model with getElementModel Example: if getElementModel(localPlayer) == 0 then -- do your thing end
  21. Just use triggerServerEvent. It's not player related that's why it's not a player method.
  22. My guess is it's because it's not really player related, unlike with triggerClientEvent you can specifically target a player (in the 1st parameter) that's why there's a oop method. Also, you should avoid passing the local player by argument or source as the wiki states, you should use the global client variable on the serverside instead that will be available within every event handler. Read the warning here: https://wiki.multitheftauto.com/wiki/TriggerServerEvent
  23. You just need to add the event with addEvent and set the second arg to true. https://wiki.multitheftauto.com/wiki/AddEvent
  24. Tails

    Chat

    Use isTransferBoxActive to check if the client is downloading Cancel onClientChatMessage
×
×
  • Create New...