Jump to content

Zango

Discord Moderators
  • Posts

    681
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zango

  1. A new event has been added recently to help you detect this, see https://wiki.multitheftauto.com/wiki/OnPlayerTriggerEventThreshold
  2. Zango

    tank

    Are you using freeroam? Then you need to allow the rhino and minigun in meta.xml of that resource. There is a setting "*weapons/disallowed" and "*vehicles/disallowed"
  3. About Prime Freeroam is an advanced Freeroam server with roleplay features! It has been in development since 2017. If you find any bugs please report them on our discord. Server IP: mtasa://149.28.237.162:22003 Discord: https://discord.gg/Xz9NUAq NPC features We have an extensive NPC system that is fully synchronised and includes features such as: A wanted system with more and harder law enforcement spawning in the greater your wanted level. Traffic - pedestrians, cars and boats. You will find special pedestrians around the map - some easter eggs! Restricted areas such as Area 51 have military, hidden secrets and also tanks (For all your rampage needs!). And much more! Shops and minigames You can spend your money at all the shops in GTA SA Ammunation, Food shops, Hardware store and Strip clubs - and a few more! Time trials, drift challenges and races are located around the map. Taxi, Pizza and Trucking missions to earn money. Casino games including pool where you can compete against other players. Gangs You can join the classic gangs from GTA SA or create your own crew. You can recruit and spawn followers to command. You can even do drivebys! Take gang territories by attacking peds or players in their zone to initiate a gang war. You will have to hold the hill while fighting off waves of enemies. Freeroam To explore you can warp around the map, and spawn vehicles and customise them. We have synchronised vehicle radio, jukeboxes and ped sounds! Media https://streamable.com/tlf8ye
  4. You can't/shouldn't use the old mysql module anymore. Use the built-in database functions: https://wiki.multitheftauto.com/wiki/DbConnect
  5. Use the following functions https://wiki.multitheftauto.com/wiki/CreateColTube - To create a colshape in front of the vehicle https://wiki.multitheftauto.com/wiki/AttachElements - To attach the colshape to the vehicle so it moves together https://wiki.multitheftauto.com/wiki/AddCommandHandler - To add a command https://wiki.multitheftauto.com/wiki/IsElementWithinColShape - To check if the player is inside the colshape when he runs the command https://wiki.multitheftauto.com/wiki/GetElementHealth - To get the health of the vehicle https://wiki.multitheftauto.com/wiki/FixVehicle - To repair the vehicle https://wiki.multitheftauto.com/wiki/SetPedAnimation - To set a player animation
  6. 3 solutions If you are removing the models from a script 1. Have the scripts call a central resource to remove the models. If they are removing the lamp post ID, store the position and radius in a table. 2. Manually store the position and radius in a table. If you are removing the models with map editor (.map files) 3. getElementsByType("removeWorldObject") will return custom elements that represent each removal. Use getElementData on each element and get posX, posY, posZ and radius data fields, on the ones with the right model. Once you have the x, y, z and radius of the world removals, you can skip IPL entries of your lamp post that contain a position within this sphere (defined by x, y,z and radius). To determine if a point is within a sphere, it's a simple distance check x1, y1, z1 x2, y2, z2 radius distance = math.sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) if distance < radius then -- Point is within sphere else -- Point is outside end
  7. I read your original post and you wanted position of lamp posts. It would be a lot simpler to get this data from the .ipl files which contain placement of world models. These files are in the data folder of gta sa.
  8. You can download the 1.5.9 release from moddb here. It should auto update to latest version when you launch it.
  9. Vehicles dont have armor, but you can make them damageproof with setVehicleDamageProof.
  10. Is UDP port 22564 open? Try pasting your IP in https://nightly.multitheftauto.com/ports/ to see if all 3 ports are open.
  11. Have a look at the createPickup function. The wiki page has the ID for the house and info icons. Check out the server and client events to handle the pickups.
  12. Make sure the script is set to type="client" in meta.xml Like this <script src="client.lua" type="client" />
  13. That's interesting. I would have guessed it was caused by MTA. There's a bug report about this issue here: https://github.com/multitheftauto/mtasa-blue/issues/1326 It's an old bug and even though it's only visual it's really annoying and happens on a lot of servers (also without peds) If anyone has information about it feel free to add!
  14. For reference, following the wiki explanation on dxSetBlendMode should fix the quality ("modulate_add" when drawing render target, "add" when drawing to screen) Between these two, I would pick CrystalMV's solution, using a trianglefan for this is neat.
  15. A solution is to use render targets and rotating half circles. It might not be less resource intensive than dxDrawCircle though. I hope the illustration makes sense You need 3 rendertargets (RT1, RT2, RT3) which are textures you can draw onto, instead of the screen. Create these once: local W, H = 100, 100 local RT1 = dxCreateRenderTarget(W, H, true) local RT2 = dxCreateRenderTarget(W/2, H, true) local RT3 = dxCreateRenderTarget(W/2, H, true) The main texture which you will eventually draw to the screen, is RT1. RT2 and RT3 will be drawn onto RT1. Split your circle image into two images of a semicircle. Both images need to be full size so they rotate around the center. Do the following "onClientRender" -- Set and clear RT2 dxSetRenderTarget(RT2, true) local RT2_rot = 0 dxDrawImage(0, 0, W, H, "semicircle_left.png", RT2_rot) -- Set and clear RT3 dxSetRenderTarget(RT3, true) local RT3_rot = 0 dxDrawImage(-W/2, 0, W, H, "semicircle_right.png", RT3_rot) -- Set and clear RT1 dxSetRenderTarget(RT1, true) -- Draw rotated circles onto RT1 dxDrawImage(0, 0, W/2, H, RT2) dxDrawImage(W/2, 0, W/2, H, RT3) -- Draw to screen dxSetRenderTarget() dxDrawImage(100, 100, W, H, RT1) Play around with RT2_rot and RT3_rot to make the loading bar work as you want.
  16. The image is invalid, can you upload it somewhere else like imgur? You can also paste a snippet from server.log related to the crash
  17. Hello You need to go through all players, with ipairs loop and getElementsByType, when the resource stops Then you can check for account and save oldTeam function onResstop() -- Loop all players for k,player in ipairs(getElementsByType("player")) do local playeraccount = getPlayerAccount(player) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local serial = getPlayerSerial(player) if oldTeam[serial] and getTeamFromName(oldTeam[serial]) then setAccountData ( playeraccount, "oldTeam", getTeamFromName(oldTeam[serial]) ) -- save it in his account end end end end addEventHandler("onResourceStop", resourceRoot, onResstop) And you should bind "onResourceStop" to the resourceRoot, if you bind it to the root element, it will trigger when any resource stops.
  18. srslyyyy provided some great tips. One thing I'd add is that you can compare the squared value, saving a sqrt operation, like this local maxRenderDistance = 7^2 if (x-px)^2 + (y-py)^2 + (z-pz)^2 < maxRenderDistance then end
  19. "getWeaponAmmoType" is not an MTA function but a custom one. I'm guessing you found this script somewhere, you need the rest of it to make it work
  20. getCameraMatrix only works serverside if the camera is fixed with setCameraMatrix, it doesn't return GTA camera values. Instead of element data, I recommend using triggerServerEvent to send the values to server, and triggerClientEvent to send to relevant (nearby) players.
  21. You need to sync the camera matrix between the player and the other players manually triggerServerEvent -- Send the camera matrix from the player to the server triggerClientEvent -- Send the camera matrix to the other players from the server
  22. Yeah ok, so there is a property for it, but I can't get it working either. There's a chance it was added in a later version (or maybe it never worked). MTA uses CEGUI 0.4.0, released 16 years ago. I searched through the changelog, but there was nothing about it though.
  23. It's a good question. I've looked through the CEGUI properties from here which you can change with guiSetProperty. But I haven't found any setting that turns off this behavior.
  24. I don't know what causes that error. You can often get a lot of misleading compilation errors. Try and go through the steps below and make sure you did everything. Install Microsoft Visual Studio 2019 Pull the latest master from https://github.com/multitheftauto/mtasa-blue.git Put afxres.h into Client/core, Client/launch and Client/loader Run win-create-projects.bat (Remember to run this again when new source files are added) Open MTASA.sln and run Build -> Rebuild Solution Grab a cup of coffee Run win-install-data.bat
  25. I tested your first example, and it works fine, the ped is detected when he runs into the colshape. testPed = createPed(0, 0, 0, 3) setTimer(setPedAnimation, 100, 1, testPed, "ped", "WOMAN_run") testZone = createColRectangle(-10, 10, 50, 50) function testFunc(targetElem) setElementAlpha(targetElem, 0) end addEventHandler("onColShapeHit", testZone, testFunc) For moveObject however, you're right that it doesn't work. When you move an object serverside, it tells all clients to move the object, but nothing happens on the server. If you use getElementPosition while it's moving, it'll calculate the interpolated position (where it's supposed to be) and give you that. But it doesn't actually do anything while the object is moving, and thats why it doesn't run the colshape collision detection. If you use setElementPosition however, it'll run the spatial checks, and trigger the colshape. I suggest you move the colshape detection to a clientside script, where the object is a physical entity which gets updated every frame.
×
×
  • Create New...