Jump to content

IIYAMA

Moderators
  • Posts

    6,063
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by IIYAMA

  1. tweak When there are 0 players the while loop will still be executed. A simple > if #thirdpart > 0 then < on line 4 would do the fix. Also count i = i+1 some where else...
  2. What is the best way to detect a NaN value? I found this: (but it doesn't seems to work, I still get warnings in the rest of the code when I check it like that) function isnan(x) return x ~= x end
  3. Yet I think he should first do that. Because to prevent tables that overflow like you mentioned, is mostly by fixing error and warnings so incorrect data will not enter the systems. Error and warnings and fps Error and warnings is lagg that will not be visible by fps, unless it takes longer than the frame time. But players will feel the lagg even if the fps doesn't drop. Error and warnings give a longer frame time. When you have 60 fps and the lua code hasn't finished with in 16,666 ms the fps will drop. (1sec/60fps)
  4. Make sure there are 0% errors/warnings in your debugscript. Those are the ones that cause the most lagg in servers. I have sometimes 1 or 2 of those in my server caused by a NaN value, yet I can't prevent those very well. But other servers have 100 of those in 1 min, which is... (and will fill up your server logs)
  5. That is possible, when the mta functions are changed and using more memory when extra features are added. But I put my bets on the new/rewritten sync features, since those are the stuff that you have to multiply by the amount of players. Yet, I think mta 1.5 is great. Especially the new light feature, which I hope will also work on objects in the future.
  6. There is probably a moment when the player isn't in the vehicle. You should always check the nil's. And reduce the amount of executions of functions to the minimal where possible. Especially when rendering them. sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) -- Speed sx, sy, sz = getElementVelocity (playerVehicle) -- Speed
  7. Well, you want the minigun aiming to a location somewhere in mta. (pointX2,pointY2,pointZ2 ) You also have the location of the minigun. (which you can fill in on line 31) (pointX1,pointY1,pointZ1) When you get the direction vector from those 2 locations you can make a matrix(table). This matrix can be used on your minigun element: https://wiki.multitheftauto.com/wiki/SetElementMatrix How to find this vector? local pointX1,pointY1,pointZ1 local pointX2,pointY2,pointZ2 local vectorX,vectorY,vectorZ = pointX2-pointX1,pointY2-pointY1,pointZ2-pointZ1 I am not a pro at matrix and vectors, so it is kinda hard to explain it to you.
  8. This piece of code will give you the matrix of 1 point which has a direction vector. local rx, ry, rz = 0,0,0 local vectorX,vectorY,vectorZ = -- fill in... (the vector) local rz = -math.deg( math.atan2(vectorX,vectorY ) ) local rx = math.atan2(vectorZ,math.sqrt(math.pow(vectorY,2) + math.pow(vectorX,2)))*(180/math.pi) local rx,ry,rz = math.rad(rx), math.rad(ry),math.rad(rz) local matrix = {} matrix[1] = {} matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry) matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry) matrix[1][3] = -math.cos(rx)*math.sin(ry) matrix[1][4] = 1 matrix[2] = {} matrix[2][1] = -math.cos(rx)*math.sin(rz) matrix[2][2] = math.cos(rz)*math.cos(rx) matrix[2][3] = math.sin(rx) matrix[2][4] = 1 matrix[3] = {} matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx) matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx) matrix[3][3] = math.cos(rx)*math.cos(ry) matrix[3][4] = 1 matrix[4] = {} matrix[4][1], matrix[4][2], matrix[4][3] = -- fill in... (position) matrix[4][4] = 1
  9. IIYAMA

    gun tower

    yup, https://wiki.multitheftauto.com/wiki/Se ... etPosition But it is probably not easy.
  10. Remove that: if use == 0 then < it is from the old code (line 31 and it's "end" on line 56)
  11. IIYAMA

    Anti teamkill

    There is no need to cancel anything. 1: trigger directly after onClientExplosion event. (no looping through the vehicles because that is what you are going to do at serverside) 2: Loop through the vehicles at serverside and check if the owners are in the same team. It is just combining and adjusting those scripts, no big deal.
  12. It seems you are spawning players when they are still alive. I now added the event onPlayerSpawn too. local vipItemsSetLimiter = {} function useAgain() if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end addEventHandler("onPlayerWasted", root , useAgain) -- added -- addEventHandler("onPlayerSpawn",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end) ------------- -- clean up -- addEventHandler("onPlayerQuit",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove/clean up end end) -------------- function giveVipItems(thePlayer) if not vipItemsSetLimiter[thePlayer] then -- check if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then if use == 0 then setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Box of Matches", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Watch", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "M4 Mag", 150) setElementData(thePlayer, "M4", 1) setElementData(thePlayer, "CZ 550 Mag", 25) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "Medic Kit", 1) setElementData(thePlayer, "Morphine", 1) setElementData(thePlayer, "Painkiller", 2) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "CZ 550 Mag", 30) setElementData(thePlayer, "Milk", 2) setElementData(thePlayer, "Camouflage Clothing", 1) setElementData(thePlayer, "Pizza", 2) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "MAX_Slots" , 26 ) outputChatBox("VIP: Items set !", thePlayer, 50, 255, 0, false) vipItemsSetLimiter[thePlayer] = true -- store end else outputChatBox("VIP: Only VIP users can use this command!", thePlayer, 255, 0, 0, false) end else outputChatBox("VIP: You can only use this command ones in a lifetime.", thePlayer, 255, 0, 0, false) end end addCommandHandler("vipitems", giveVipItems , thePlayer)
  13. IIYAMA

    Anti teamkill

    Then you have to edit that one...
  14. You can circa see how many they use when you type: /shownetstat When I compared those two I got this result. Which one uses more bandwidth: Triggering uses much more bandwidth than elementdata when it is just you and the server. But when there are more players in the server, you have to multiply the elementdata with the amount of players. So for example (the elementdata will be set serverside): elementdata uses 1 kb, 1 kb X 8 players = using 8 kb total. If you have a server with 1000 players in it(like sometimes CIT), you will be using 1000kb. Which one is faster? Triggering is much faster than using elementdata, you can probably compare the speed of elementdata with triggerLatentClientEvent, but I do not know the exact speed of both.
  15. How many times are they suppose to use that command? (like everyday or only ones per account) Well at least try this: local vipItemsSetLimiter = {} function useAgain() if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end addEventHandler("onPlayerWasted", root , useAgain) -- clean up -- addEventHandler("onPlayerQuit",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove/clean up end end) -------------- function giveVipItems(thePlayer) if not vipItemsSetLimiter[thePlayer] then -- check if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then if use == 0 then setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Box of Matches", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Watch", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "M4 Mag", 150) setElementData(thePlayer, "M4", 1) setElementData(thePlayer, "CZ 550 Mag", 25) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "Medic Kit", 1) setElementData(thePlayer, "Morphine", 1) setElementData(thePlayer, "Painkiller", 2) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "CZ 550 Mag", 30) setElementData(thePlayer, "Milk", 2) setElementData(thePlayer, "Camouflage Clothing", 1) setElementData(thePlayer, "Pizza", 2) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "MAX_Slots" , 26 ) outputChatBox("VIP: Items set !", thePlayer, 50, 255, 0, false) vipItemsSetLimiter[thePlayer] = true -- store end else outputChatBox("VIP: Only VIP users can use this command!", thePlayer, 255, 0, 0, false) end else outputChatBox("VIP: You can only use this command ones in a lifetime. : )", thePlayer, 255, 0, 0, false) end end addCommandHandler("vipitems", giveVipItems) -- not needed> , thePlayer
  16. If you really want that folder to exist. Like for keeping your resource administration. You have to put it like this: MTA/server/mods/deatchmatch/resources/[myserver] Mta will ignore folders when you put the name of the folder between those brackets [].
  17. IIYAMA

    Anti teamkill

    Tanks can't damage other tanks, only the fire of the explosion causes damage. (fire damage can't be detected well and most of the time there is no owner) That you guys haven't figure that out yet. O_o
  18. Is it that worse? I haven't had any issues with it, yet I hardly get players in my server. (I haven't found out why yet) How much fps are you missing in compare to 1.4.1?
  19. You tested the event: onPlayerNetworkStatus ? I am freezing the players by using (client)>onClientPreRender+setElementPosition+setElementRotation+elementdata+(server x1)>setElementPosition+setElementRotation+setElementVelocity It is their problem that they have those connection issues, if I do not do this my server. A special script of mine that detects bullet hits serverside would work sometimes incorrect because the players will not stop moving, but doing what they last suppose to do(last packet they send). GetElementPosition will only return data of the last packet, which as result the players don't know where to shoot this snail. Already thought of it and added it 1,5 year ago. It is only the question on how much % of packetloss this should be used. Before I had 30%, 30% does not works on small issues which sometimes last longer than 2 seconds. Now I am applying 5% and I hope that will work.
  20. I am already using getNetworkStats > packetlossLastSecond. But it is kinda hard to check because it is over 1 second and require a timer which gets executed a lot. So I though that onPlayerNetworkStatus might work better.
  21. Did anybody tested/used the event onPlayerNetworkStatus? I am wondering how sensitive this event is. Also if it is for small interruptions or only large ones. Why I am asking this question? Because sometimes players have small network interruptions which causes teleportations and I am very curiously if this event can detect those. https://wiki.multitheftauto.com/wiki/On ... workStatus
  22. IIYAMA

    rectangle

    I ones wrote messy and unoptimised code for it. To try it out. You can use/edit it if you want, I don't really care what you do with it. If I need it, I will probably rewrite it from scratch. The problem with the code is that it is really slow ones starting creating it(texture) and it renders slow because it is an image according to the absolute resolution. https://dl.dropboxusercontent.com/u/631 ... reator.zip
  23. You can, by convert them to pixels and only using textures. https://wiki.multitheftauto.com/wiki/DxCreateTexture https://wiki.multitheftauto.com/wiki/DxGetTexturePixels https://wiki.multitheftauto.com/wiki/DxSetTexturePixels
×
×
  • Create New...