Jump to content

Mr.Loki

Members
  • Posts

    667
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Mr.Loki

  1. For every vehicle the cap is in a different position so you will have to create a table with offsets. The best way for the offsets to line up every time at any angle is using the element's Matrix. For this you'd need to enable OOP in your script. Here's a simple code that does this and make the offsets simple for you to edit -- This is the offsetTable where we add the vehicles and its fuel cap -- [vehicle Model] = Vector3(Right, Forward, Up) local oT = { [411] = Vector3(1.08,-2.1,0.09), --Infernus [400] = Vector3(-1,-2.1,-0.09), --Landstalker [485] = Vector3(-0.79,0.7,0), --Baggage } local color = tocolor( 255, 255, 255 ) -- Simple color variable. -- Run this function for every frame. addEventHandler( "onClientRender", root, function( ) --Create a table of all the vehicles in the server. local vehs = getElementsByType"vehicle" -- Loop through every vehicle in the server. for i=1,#vehs do -- Checks if the vehicle's model is in the offsetTable. if oT[vehs[i].model] then -- Create some simple variables. local veh,model,offset = vehs[i],vehs[i].model,oT[vehs[i].model] -- Convert the global position to screen position. local screenOffset = Vector2(getScreenFromWorldPosition( veh.matrix:transformPosition(offset), 0, false )) -- Draw a circle at that location. dxDrawText( "●", screenOffset, screenOffset, color, 2, "default", "center", "center" ) end end end ) https://streamable.com/x3mlx
  2. Another function to get the players in the same group isn't really necessary unless you need to do something else with them other that output a message. Here's a simple way of doing it. Used my phone to do this so format might be a bit off. function playerSentGroupMsg (message, messageType) cancelEvent() if ( messageType == 2 ) then if ( getElementData(source,"Group") ) then local myGroup = getElementData(source,"Group") --store your group name in a variable. local plrs = getElementsByType"player" for i=1,#plrs do --now we loop through all the players so that we can output the message for each player. local plr = plrs[i] if getElementData(plr,"Group") == myGroup then -- this checks to see if the player's group name is the same as yours. outputChatBox("[Group]"..getPlayerName(source)..": "..message,plr,0,255,0) -- now we output the message for each player that has the same group name as the sender. end end end end end addEventHandler("onPlayerChat", root, playerSentGroupMsg)
  3. Try using /debugscript 3 and restart the script to see if there are any errors.
  4. Here u go: function checkClip(weapon, ammo, clipammo) if clipammo == 1 then bindKey("R", "down", reload) toggleControl("fire", false) toggleControl("next_weapon", false) toggleControl("previous_weapon", false) end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), checkClip) function reload( ) unbindKey("R", "down", reload) toggleControl("fire", true) toggleControl("next_weapon", true) toggleControl("previous_weapon", true) end
  5. I tested this and it works fine for me it does not let me shoot or switch until I reload(which i added) my weapon. Maybe toggleControl is handled somewhere else than this script?
  6. Did you even read the topics and im sure you can modify the code to check for damaged/blown vehicles
  7. Mr.Loki

    Request 2

    try this: local vehicleHealthMultiplier = 3 addEventHandler( "onClientVehicleDamage", root, function ( _,_, loss ) cancelEvent( ) setElementHealth( source, getElementHealth(source)-(loss/vehicleHealthMultiplier) ) end )
  8. Your code works for me but when deleting an object in editor it just places in a temporary dimension so that the undo and redo functions are simple. You will need to ckeck if the object is in the same dimension as you. x,y = guiGetScreenSize() addEventHandler("onClientRender", root, function() local obj,count = getElementsByType("object"), 0 for i=1,#obj do count = true and inMyDim(obj[i]) and count+1 or count end dxDrawText("obj: ".. count, x * 0.4470, y * 0.1514, x * 0.5071, y * 0.1800, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) end) function inMyDim( elem ) if getElementDimension( elem ) == getElementDimension( localPlayer ) then return true end end
  9. You should check to see if "thePlayer" is actually a player by using getElementType
  10. link to the resource?
  11. Just pointing this out...
  12. I'm pretty sure it's because OOP was not enabled.
  13. Maybe set a check by getting the number of objects in the server with getElemantsByType'object'
  14. Use the code option <> next time and what is your problem, what exactly isn't working?
  15. Here's a tutorial about strings and how to use Lua's string functions. With this you can follow the tutorial to "find" stuff in the message that may be IPs and cancel the event that @ViRuZGamiing stated: OnChatMessage
  16. Stop the dayz resource then: If you are using version 0.7 then delete the backup.db in tools so it will add the new spawn positions and vehicles. (Correct me if I'm wrong @Tekken) If anything lower than 0.7 (update brah) which it looks like you are, in the server do /delaccount vehicleManager Doing this will delete all tents and vehicles. Dayz 0.7 Dayz 0.9.6a
  17. https://wiki.multitheftauto.com/wiki/FindRotation But it only returns rotation on the z axis so it will follow anything on x and y but on z(up and down) But I'm sure you can get it if you modify the code a bit
  18. Maybe you can set account data the first time the player logs in and use that to check whether they have been in the server or not. on player login getAccountData "regularPlayer" if false then show the skin selection screen set the account data for regularPlayer to true
  19. There's an addon in the new DayZ that does this called Dead Streets you can get it here.
  20. Mr.Loki

    help

    Wait do you lag with moded vehicles or just the default vehicles? If moded then get simpler mods.
  21. Download the newest server at https://linux.multitheftauto.com
  22. CreateRadarArea GetTeamColor SetRadarAreaColor
  23. Mr.Loki

    help

    If vehicle mods lowers your fps then you should use a better vehicle model which is less detailed because sometimes the model isn't optimised too well. Another option is to upgrade your PC, upgrade from a wooden PC to a stone PC like me or maybe even an iron PC.
×
×
  • Create New...