Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by botder

  1. Looks like you rotate the map at the middle of the map center (0.5, 0.5) and not where your player is located.
  2. addCommandHandler passes serverside the player element as first argument whereas clientside it passes the command name as first argument. The code is serverside.
  3. botder

    Label on map

    Take a look at the code from the resource and use it. You should make a table (or use custom elements) with the name + the coordinates (x, y) and then show them on the map.
  4. Did you know that the example in isLineOfSightClear shows how to make peds jump when there is an obstacle?
  5. Let's ignore that and try this: local val = math.floor(tonumber(val))
  6. Does this [onClientPlayerChoke] event work?
  7. You should know that networking doesn't work like that, otherwise it would freeze your client until the server sends the result (= extremely bad). And you might use setElementData and getElementData for your kill counter.
  8. What did you write in the mtaserver.conf ?
  9. setElementData(m_Enter, "pickup", greenhouse) Maybe like that?
  10. Do effect texture names appear in the table from engineGetVisibleTextureNames?
  11. Going to test the code on my own. Anyway, I can't tell right now if it's mine code or the function itself. Edit: The function is broken and the best result was that the other player's head was switching between left and straight. Changing the player skin broke the function for your own player.
  12. http://en.wikipedia.org/wiki/Trigonometry Mathematical functions.
  13. Warning: I forgot that particles might not have a model id, which you can replace (others please report your knowledge) and it might be only possible with shaders? You probably can't replace .fxp files, but you can replace .txd files (. Your resource needs a clientside script (that script will be downloaded by every player [automatically] and it will be run on the MTA client). Let's call this script client.lua (place it in your resource folder) Your server needs to know that it should transfer the client.lua to each client. To archive that you have to add the script to your meta.xml <meta> <info author="Xwad" /> <file src="effects.fxp" /> <file src="effectsPC.txd" /> <file src="particle.txd" /> <script src="client.lua" /> </meta> So far so good, but the clientscript is empty. Now to replace the files you have to use those functions when the resource starts: But how do you know when a resource actually starts? For that purpose you have to use the event system. function whenMyResourceStarts() -- Probably not possible, because particles might not have a special model id (i don't know, lol) local txd = engineLoadTXD( "effectsPC.txd" ) engineImportTXD( txd, 1 ) txd = engineLoadTXD( "particle.txd" ) engineImportTXD( txd, 1 ) end addEventHandler("onClientResourceStart", resourceRoot, whenMyResourceStarts)
  14. I changed the code secretly (it sent the data always to the original player [localPlayer]). Try it again and report.
  15. I would suggest using getVehicleTurretPosition, getElementPosition, math.cos, math.sin, triggerServerEvent, triggerClientEvent and createExplosion
  16. Resources won't replace the files when you only let the players download the files. Resources are small programms/modules and as a scripter you have to make them also replace the GTA files.
  17. Not tested. Edit: It might be better to update it only for those players, which are streamed in. CLIENTSIDE: -- To avoid flooding the server with massive head rotation updates -- you shouldn't drop it below 50 milliseconds local UPDATE_MS = 100 -- Systemtick, when the last update occured local g_nLastUpdate = 0 -- Last rotation sent to other players local g_fLastX, g_fLastY, g_fLastZ = 0, 0, 0 -- Screen resolution of the player local g_nScreenWidth, g_nScreenHeight = guiGetScreenSize() function updateLookAt() -- Get the current tick and world position local tick = getTickCount() local fX, fY, fZ = getWorldFromScreenPosition(g_nScreenWidth / 2, g_nScreenHeight / 2, 10) -- Let our player look at that point setPedLookAt(localPlayer, fX, fY, fZ, -1, 0) -- Update if the last update has passed the min. time if tick >= (g_nLastUpdate + UPDATE_MS) then g_nLastUpdate = tick -- Only update the head rotation when the actually changed it -- (to avoid flood from AFK players) if fX ~= g_fLastX or fY ~= g_fLastY or fZ ~= g_fLastZ then g_fLastX, g_fLastY, g_fLastZ = fX, fY, fZ triggerLatentServerEvent(".updateHeadRotation", resourceRoot, localPlayer, fX, fY, fZ) end end end addEventHandler("onClientPreRender", root, updateLookAt) addEvent(".updateHeadRotation", true) addEventHandler(".updateHeadRotation", resourceRoot, function (player, x, y, z) -- Prevent applying invalid data if not isElement(player) or type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then return end setPedLookAt(player, x, y, z, -1, 0) end ) SERVERSIDE: addEvent(".updateHeadRotation", true) addEventHandler(".updateHeadRotation", resourceRoot, function (player, x, y, z) -- Prevent sending invalid data if not isElement(player) or type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then return end -- Get every player on this server local players = getElementsByType("player") -- Abort if there is only 1 player if #players == 1 then return end -- Cache the original player's dimension local dim = getElementDimension(player) -- Loop through each player for i = 1, #players do -- Ignore our player, who sends his head rotation if player ~= players[i] then -- Check if the player is in the right dimension if getElementDimension(players[i]) == dim then -- Send the head rotation to that player triggerLatentClientEvent(players[i], ".updateHeadRotation", resourceRoot, player, x, y, z) end end end end )
  18. It doesn't work this way. Your 'meta.xml' only tells the server to transfer the files to each client (and the client does nothing with them).
  19. You should get 3DS Max and use those scripts: http://www.gtagarage.com/mods/show.php?id=9172
  20. Start MTA. Click on Map Editor. Map your custom objects. Save your map. Upload it to the server. ???. Profit
  21. You have to set the parameter getPropagated from addEventHandler to false addEventHandler("onClientGUIClick", selectButton, function () ... end, false)
  22. Yeah, almost. With your code your first name will be rendered at height 420, the next one at 840 and so on. (id starts at 1) Solution: dxDrawText(..., x + 60, 420 + 30 * (id - 1), ...)
  23. You don't move the names. Every name will be rendered on the same spot. You should use the index value (that one you called _)
×
×
  • Create New...