Jump to content

AMARANT

Members
  • Posts

    748
  • Joined

  • Last visited

Posts posted by AMARANT

  1. Ого какие люди, я как-то и подзабыл зачем и за что тебя вообще тут забанили такого спеца по МТА :D

    Рад слышать что у тебя всё ОК, в своё время немало мне тут помог на форуме за что и благодарен тебе)

  2. Мониторинг нехило развивается, виден результат работы и частые обновления, так что создателю огромный респект. Также хочу поблагодарить за предоставление моему проекту бесплатного V.I.P. статуса на месяц, это приятная неожиданность. Желаю и дальше развиваться во благо популяризации МТА.

    • Like 1
  3. Разработчикам МТА давно пофиг на эту проблему, которой уже наверно лет 5. Баг вечно переносится из версии в версию и вместо того чтобы нормально решить это самим разрабам, скриптеры вынуждены фиксить это различными таблицами, таймерами, проверками вхождения в стрим и т.д.

  4. First, I'd like to thank you guys for your very useful tips and advices!

    Now I want to ask some additional questions. Let's begin.

    First of all, if you're using mysql. don't overuse the connection. Only use it for login systems, to get and save data. Only at resource start to keep it really nice.

    I'm an owner of Roleplay server, so I use MySQL for saving data. You know that there is a lot of information about players, vehicles and so on. I've been using "UPDATE" statements very often before I read what you wrote. "SELECT" queries I use only on login and on a resource start events. Then I set the returned data to the tables. I also have one db-connection and shared it with other resources. So, my questions are:

    1. How often do I need to use UPDATE statements, e.g. for backup saving player data while he's online every 15 mins (I used this every 1 min!)?

    2. Do I need to use callback function in my SELECT query to disable freezeing the whole server or use timeout parameter -1 in dbPoll anyway?

    ipairs are no big deal, as long as you use 'return' or 'break' once you've got the data you need. Something else for this can be.

    Yes, I use return fot that.

    if you're looking for a specific vehicle, give the vehicle an ID with setElementID and parse the ID to the function and use getElementByID to speed up the progress of getting the vehicle.

    Never used this useful function before, thank you again! Will try!

    getElementsByType, if you're doing it with objects etc, include the resource's name after the type. This'll make sure the function only takes the objects created by that resource and not the map files etc./

    Did that too, but it's hard to do with players, especially on render.

    Colshapes are fine, so is element data. Just make sure you don't share everything with the client. setElementData sets data on the element and uses a trigger towards the client to share this data. Quite hard if you're doing it with fuel systems or health status things every 50ms.

    I use many colshapes with key binds. E.g., if a player press some button being within the colshape something happens. What is the best way to do that taking into account that there might be a lot of places where you need to activate something with button?

    As to fuel systems I even need to synchronize fuel state of a vehicle not only with a driver, so I have to use element data for that. Any other solution?

    Thanks in advance for replies!

  5. Hi there. I've been making my own server for a long time and the time has come for beta testing. Now I came across a problem called optimization. I have a lot resources with huge amount of stuff which may cause some lags and which eat CPU. These are elements, like vehicles, house and business pickups, many colshapes, etc. I also use element data and some render stuff of course. The things I mentioned in the subject of this topic never leave me in peace. My question is what of them are most CPU-greed and what is an alternative? Where do I need to dig first for optimizing? Because I found that the server starts to lag when its online hits 15+ people. Thank you for advance.

  6. Is there anyway you can can get the cpu graphs of the actual server box? Although performance browser shows the scripts usage, there could be something else on the host box eatting up the CPU. Or it could be memory or something such as that.

    Unfortunately, I only can see a small piece of information provided by my hosting services. It shows there that my server eats:

    • - 6-7% CPU
      - 0.2% RAM
      - 6% Hard drive

    I can give a screenshot of my client scripts from performancebrowser if it's needed.

  7. Oh yes, forgot about that "posted both of those at 1 am wasn't exactly thinking about that atm, when the vehicle health drops below a certain point, use repair vehicle, as to prevent it from exploding, yet still allowing it to be hit, rammed etc without repairing every time.

    As an easier thing; just make the vehicle damage proof when the health drops below 400. :lol:

    Yes it really works but how about server CPU if I use it server-side with "onVehicleDamage"?

  8. I can spawn a vehicle after blowing up at the right coordinates and make it damage proof. But before that the vehicle needs to be blow up anyway. And I'd like to completely remove blowing up. Is this possible? Here is my code what I've got:

    function onVehiclesExplode() 
    local model = getElementModel(source) 
    local x, y, z = getElementPosition(source) 
    local rx,ry,rz = getElementRotation(source) 
    destroyElement(source) 
    setTimer(spawnAfterExplode,50,1,model,x,y,z,rx,ry,rz) 
    end 
    addEventHandler("onVehicleExplode", getRootElement(), onVehiclesExplode) 
      
    function spawnAfterExplode(model,x,y,z,rx,ry,rz) 
    local newvehicle = createVehicle(model,x,y,z,rx,ry,rz) 
    setVehicleDamageProof(newvehicle,true) 
    end 
    

  9. did you try to check /debugscript 3? maybe there are spamming errors that makes the people lag when they enter the vehicles. Check it up that might help!.

    Of course, I always use debugscript. It's clear and there are no any errors or warnings. I can't figure out what else may cause these lags because scripts seem OK. I don't experience any FPS drop or something. It's just some delays.

×
×
  • Create New...