-
Posts
730 -
Joined
-
Days Won
8
Tails last won the day on July 14 2023
Tails had the most liked content!
Recent Profile Visitors
4,067 profile views
Tails's Achievements
Homeboy (31/54)
112
Reputation
-
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
-
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.
-
You can use getCameraMatrix: https://wiki.multitheftauto.com/wiki/GetCameraMatrix and setCameraMatrix https://wiki.multitheftauto.com/wiki/SetCameraMatrix
-
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)
-
Maybe use + in your calculation instead. Or paste your loop here so we can look at it.
-
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.
-
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.
-
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.
-
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!
-
Tails changed their profile photo
-
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.
-
Make sure that resource with the log function is started, preferably before the other resource.
-
Is that the fv_logs resource? Make sure to add this line: <export type="server" function="createLog"/>
-
Make sure you have exported the function createLog in the fv_logs resource meta.