Jump to content

Addlibs

Members
  • Posts

    1,060
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Addlibs

  1. As far as I'm concerned, none of what is uploaded through lac.mtasa.com is reviewed by the MTA administration. It is just an online compiler made in interest of protecting scripts from being stolen. Compiled scripts with verified reports of backdoors have their (compiled) content added to a list of 'malicious scripts', which restricts these scripts from being loaded. I do believe that there should be an option to disable such protection, under the server manager's own risk.
  2. You could manipulate handling so that all vehicles are too heavy for on-foot people to push. Since all cars would have increased mass, one vehicle would be able to push another just like previously, while peds/players would be unable to push it. I have done this in my server. Note that this solution will require you to completely change vehicle handling since higher mass = more momentum, thus braking deceleration, engine inertia, engine acceleration, and possibly braking bias would need to be changed in order to compensate for higher mass. You should also increase drag by the same multiplier as mass, so your car will decelerate at normal speed when accelerator button is released. Clientside setElementFrozen would change the state only on the current client - what if another client was syncing the car? It would't move on the server...
  3. Actually, assuming that this is for a deathmatch server, a player could enter a vehicle as a passenger and the vehicle would still be invincible... But whatever.
  4. For me, it looks as though HEX colour coding makes the new coloured text appear like 1px further (as if the hex was replaced with a 1px-long character). Shadowed texts completely remove HEX colour codes via string.gsub (without leaving that 1px-long character). Although I might be wrong ^^ It seems that the actual dx text drawing codes don't use sub-pixel positioning, therefore text-parts are rounded to the nearest pixel - meaning that sometimes the normal, coloured text appears to be slightly longer (due to rounding up) than text without separation for colouring. Of course, I don't know how the actual code works but this assumption is based on that the dx text is split into parts, every part for every colour used.
  5. I think he wants others to spawn at default locations too... Disabling 'play' or whatever resource he's using for spawning would make standard players stuck after getting wasted, wouldn't it?
  6. Wrong section, I believe? This is for MTA/Lua scripts. The answer to your question can be found on Google.
  7. I don't really know if it's possible to export functions within lua tables - the only possibility I know would be to make a specific function that would return that 'namespace' which contains your functions... function getNamespace() return someNamespace; end (of course it that 'getNamespace' function would have to be defined as an export in the meta.xml) and then called by exports['your-resource']:getNamespace().myFunction() I'm not entirely sure but I think that functions within that namespace don't need to be added to exports in meta.xml
  8. You could change position of the player upon onPlayerSpawn, otherwise you'd probably have to edit the currently running gamemode or script which handles respawning
  9. Addlibs

    about PHP sdk

    You don't really need to use the PHP SDK to display players who are online. All you'd need to do is dbConnect and dbExec to truncate (clear) the table and insert all online players every now and then. The website can then use PDO or Mysqli to access the database and retrieve the online players, and write them to the HTML code.
  10. My GTAV radar has full blips support (except Z-level ordering, yet): https://community.multitheftauto.com/index.php?p= ... s&id=10673
  11. I think it would be easier making a render-target and drawing the map with dxDrawImage on calculated positions and rotation, then drawing the render-target onto the screen - that's how I did my GTAV radar.
  12. setElementCallPropagationEnabled should work (see example)
  13. The example doesn't make them jump if an obstacle is right in front of them. It will make the ped jump only if he is 1 meter away from the obstacle. I want to make him jump even if he is 0 meters away. From what I observed in the code and my own knowledge, it should force the ped to jump once, as soon as something is in front of the 1 meter detection. The following code is edited to make the ped jump every second until no obstacles are in the way local t_Data = {} local jumpTimerInterval = 1000*1 --(1000ms x 1 = 1 second) This variable determines the interval between jumps, in ms [1000ms = 1 second] local function updateNPC () if (not isElement(t_Data.ped) or (getElementHealth(t_Data.ped) == 0)) then return toggleNPCFollower () end local t_PlayerPos = {getElementPosition(localPlayer)} local t_PedPos = {getElementPosition(t_Data.ped)} local intDistance = getDistanceBetweenPoints3D (t_PedPos[1], t_PedPos[2], t_PedPos[3], unpack(t_PlayerPos)) if (intDistance < 4) then setPedControlState (t_Data.ped, 'forwards', false) return true end -- Calculate the rotation between ped and player position local intPedRot = -math.deg (math.atan2(t_PlayerPos[1] - t_PedPos[1], t_PlayerPos[2] - t_PedPos[2])) if intPedRot < 0 then intPedRot = intPedRot + 360 end; setElementRotation (t_Data.ped, 0, 0, intPedRot, 'default', true) -- At this point we know that the ped needs to move it setPedControlState (t_Data.ped, 'forwards', true) local bPathClear = true local t_Matrix = getElementMatrix (t_Data.ped) -- Calculate a position 1m ahead of ped local int_RayX = t_Matrix[2][1] + t_Matrix[4][1] local int_RayY = t_Matrix[2][2] + t_Matrix[4][2] local int_RayZ = t_Matrix[2][3] + t_Matrix[4][3] -- We cast 10 rays 1m ahead of the ped for i = 1, 10 do local intSourceX, intSourceY, intSourceZ = t_PedPos[1], t_PedPos[2], t_PedPos[3] -- The target position height is identical to the center of the ped (1m above ground) -- We lower this value by 0.5m to detect short obstacles local intTargetX, intTargetY, intTargetZ = int_RayX, int_RayY, int_RayZ - 0.5 + i*0.2 bPathClear = isLineOfSightClear (intSourceX, intSourceY, intSourceZ, intTargetX, intTargetY, intTargetZ, true, true, false, true) dxDrawLine3D (intSourceX, intSourceY, intSourceZ, intTargetX, intTargetY, intTargetZ, bPathClear and tocolor(255,255,255,255) or tocolor(255,0,0,255)) if (not bPathClear) then break end end if isTimer(t_Data.jumpTimer) then killTimer(t_Data.jumpTimer) end if (not bPathClear) then setPedControlState (t_Data.ped, 'jump', true) t_Data.jumpTimer = setTimer(function() setPedControlState (t_Data.ped, 'jump', false) setPedControlState (t_Data.ped, 'jump', true) end, jumpTimerInterval, 0) else setPedControlState (t_Data.ped, 'jump', false) end if (intDistance > 15) then setPedControlState (t_Data.ped, 'sprint', true) else setPedControlState (t_Data.ped, 'sprint', false) end end function toggleNPCFollower () if (t_Data.ped) then if (t_Data.updateNPCTimer) then if (isTimer(t_Data.updateNPCTimer)) then killTimer (t_Data.updateNPCTimer) end end if (isElement(t_Data.ped)) then destroyElement (t_Data.ped) end t_Data.ped = nil return true end local intX, intY, intZ = getElementPosition (localPlayer) local _, _, intRZ = getElementRotation (localPlayer) local t_Matrix = getElementMatrix (localPlayer) -- Calculate a position 4m behind local player local intPedX = -4 * t_Matrix[2][1] + t_Matrix[4][1] local intPedY = -4 * t_Matrix[2][2] + t_Matrix[4][2] local intPedZ = -4 * t_Matrix[2][3] + t_Matrix[4][3] t_Data.ped = createPed (0, intPedX, intPedY, intPedZ, intRZ) t_Data.updateNPCTimer = setTimer (updateNPC, 50, 0) end addCommandHandler ('npc', toggleNPCFollower) Untested, but should work.
  14. Yes. And tell us if it works.
  15. function immunity ( attacker, weapon, bodypart ) if ( weapon == 41 ) then --if the weapon used was the spray-can (41) cancelEvent() --cancel the event end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), immunity ) You'll need to edit this to make it cancel only when 'attacker' is a medic
  16. You probably didn't add the data for max fuel, and fuel consumption rate for your vehicle in the DayZ scripts
  17. Addlibs

    Chatbug

    if ( getAccountData ( account, "chatc" ) and getElementData ( thePlayer, "Vip" ) == true ) then source => thePlayer in getElementData
  18. You can't send client-side elements to the server. isElementLocal
  19. You could select all rows, check the values of the last one and add 1. This should work - not fully tested under all circumstances but it does the job.
  20. (XML version) is equivalent to \n (Lua version).
  21. Message only concerning your SFPD_Deliver.lua What's MySQL_GetString? Appears on lines 17, 18, 27 and 28. What's MySQL_SetString? Appears on lines 24 and 25. Never heard of these Anyway, [...] Name LIKE '"..player.."" (end of lines 17, 18, 24, 25, 27 and 28) is wrong. You're attempting to merge an MTA player element with a string.
  22. Don't use freeroam or playercolors resource. They also handle chat - that's why you might get double-chat (one from your script, 2nd one from freeroam/playercolors resource).
  23. Basically, the script was compiled, so you wouldn't see that there is malicious code inside. MTA Devs have (probably) been informed and blocked the hash of that file (since a compiled script can't be edited to change the hash) for security reasons.
  24. Don't call MoveObject on every frame... moveObject works on the principle of setElementPosition onClientRender
×
×
  • Create New...