Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. function GiveItemOnSpawn () setElementData(source, "M4A1 CCO", 1) outputChatBox("Test!", source, 255, 255, 255, true) end addEvent ("LEVEL1",true) addEventHandler ("LEVEL1",getRootElement(),GiveItemOnSpawn ) addEventHandler("onPlayerSpawn",getRootElement(), GiveItemOnSpawn) https://wiki.multitheftauto.com/wiki/OnPlayerSpawn Source The source of this event is the player that just spawned. https://wiki.multitheftauto.com/wiki/AddEventHandler addEventHandler This function will add an event handler. An event handler is a function that will be called when the event it's attached to is triggered. See event system for more information on how the event system works. Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions: source: the element that triggered the event
  2. Isn't your network getting :Oed up? You might want to do: /shownetstat while running this with multiple players. Which is also possible for causing the frame/cpu lagg.
  3. If not A-sync, then: function testFunction () return math.random(1000) % 2 == 0 end function start () for i=1, 1000 do local value = testFunction() if value then print(value) else break end end end start() If A-sync, use: https://www.lua.org/pil/9.1.html
  4. No other encrypted format is supported to be decrypt by then server except for luac. Which means that if a custom de-crypter isn't included (but still working) then it is compiled AND encrypt with luac. https://luac.multitheftauto.com/ Uploading/downloading = compiled Extra obfuscation = encryption
  5. IIYAMA

    stop driveby

    toggleControl(player, "vehicle_fire",false) * as it is server-side.
  6. IIYAMA

    stop driveby

    Use this event instead: https://wiki.multitheftauto.com/wiki/OnVehicleEnter Also: (not sure what this was about) toggleControl ( "vehicle_fire", false ) (true, "blockedvehicle")
  7. Debug your code manually. Easiest way for us to help you and to help yourself. I assume you have already seen this topic, but fortunately it is exactly what you need to do in this situation. Locate bugs... and annihilate them.
  8. IIYAMA

    stop driveby

    Only ADD, with the code you already used. This code will replace the original setPedDoingGangDriveby function clientside and use it serverside instead. It will fix your de-synchronization. Remember, you still need to use setPedDoingGangDriveby in your original code. clientside function setPedDoingGangDriveby (ped, state ) triggerServerEvent("setPedDoingGangDriveby", resourceRoot, ped, state ) end serverside addEvent("setPedDoingGangDriveby", true) addEventHandler("setPedDoingGangDriveby", resourceRoot, function (ped, state ) if isElement(ped) then setPedDoingGangDriveby(ped, state ) end end, false)
  9. I do not agree with that. Colour 1: 255, 100, 50 Colour 2: 255, 70, 50 <-
  10. Don't forget to give the resource admin rights.
  11. @Juuve
  12. if r ~= r2 or g ~= g2 or b ~= b2 then -- not the same color end
  13. baseWidth * (progress / 100) 4 progress / 100 = 0.04 0.04 * 200 = 8 px
  14. The shader version gives of dxDrawCircle doesn't have a very high impact on the performance: nightly.multitheftauto.com/files/shaders/shader_circle.zip The only thing that it is missing is anti aliasing. (pixel edges) As last resort you can use browser + html + css to make it. (which should give the best quality, but isn't very performance optimal in my opinion. Yet, there shouldn't be much frame lagg of it.)
  15. I am not sure what you want to achieve with it. But if you want to check if an element is in a table, then this is also very fast method. The elements have become the KEY of the table. local table = {[el1] = true, [el2] = true, [el3] = true} if table[place] then -- Yes it is in the table end Adding elements to the table by hand: table[el1] = true table[el2] = true table[el3] = true With this method, you can also make a reference to different data: local table = {[el1] = {"more data"}, [el2] = {"more data"}, [el3] = {"more data"}} local moreData = table[place]
  16. You probably need to save the pixels of the texture in stead of the texture. As textures are client-side only elements, which should not be able to sync.(Just in case if you get stuck there) https://wiki.multitheftauto.com/wiki/DxGetTexturePixels Even though a better way would be saving the file names, as every client does already have the textures.
  17. The value 1.5 represents the offset. Math.sin and math.rad used on the rotation, represents a sort of vector direction of an axis. Which you can multiply by the offset to extend the range. (The original offset is 1 unit.) You should start calculating from the ladder and not from the ped. Else indeed it might causes glitches like that.
  18. function movePlayer(button, press) if press then if button == "w" then local x, y, z = getElementPosition ( localPlayer ) setElementPosition ( localPlayer, x, y, z+1, false ) elseif button == "s" then local x, y, z = getElementPosition ( localPlayer ) setElementPosition ( localPlayer, x, y, z-1, false ) end else --release end end function addTheHandlers() setElementFrozen( localPlayer, true ) addEventHandler("onClientKey", root, movePlayer) --Want this to be constantly checked... end You do not need getKeyState if you use onClientKey, only if you use onClientRender.
  19. You can also use: https://wiki.multitheftauto.com/wiki/BindKey keyState: The state of the key that was pressed, down if it was pressed, up if it was released. If this isn't working for you: https://wiki.multitheftauto.com/wiki/GetKeyState
  20. You can also bind controls. https://wiki.multitheftauto.com/wiki/Control_names
  21. IIYAMA

    Lagshot

    I am not sure what what your friend his ping AND fps are. But just for you to know. There is no serverside bullet detection. The client itself is the only one to decide if there is damage or not. Lower than 50/60 fps is lagg. (causing bullet sync problems) Ping higher than 60 is lagg. (causing bullet sync problems as well) Gta is physics are lagg. (causing bullet sync problems as well) Better sync? How about uber sync? Uber sync (bandwidth and CPU intensive) player_sync_interval 50 keysync_mouse_sync_interval 50 keysync_analog_sync_interval 50 https://wiki.multitheftauto.com/wiki/Sync_interval_settings Instructions Stop the server open: mtaserver.conf Edit settings in file to those values. Save mtaserver.conf Start the server. <player_sync_interval>50</player_sync_interval> <keysync_mouse_sync_interval>50</keysync_mouse_sync_interval> <keysync_analog_sync_interval>50</keysync_analog_sync_interval>
  22. IIYAMA

    Lagshot

    I never said it would fix your lagshot. Anyway. I have no idea how your lagg shot looks like. Because there are different types of laggshots. If it is a lot of teleportation and the server is showing no performance impact, then it is the network. Not sure what kind of server you bought, but it seems there is something wrong with it. The reason behind it, might be that other people who rent a server there and are abusing it's capabilities. Or the owners are sharing the main computer(server) with too many vps users. It is also possible that you are just running bad resources on it.
  23. IIYAMA

    Lagshot

    How about you fire a weapon? (for example m4)
  24. You can also try instead of setting the position, freeze the position temporary(by 1 or 2 frames).
×
×
  • Create New...