Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. Locked for triple posting, wrong section(this post was in tutorials) and wrong section language.
  2. The data type time in your database is not something you should animate. https://wiki.multitheftauto.com/wiki/GetRealTime Create your end time: (seconds) > End time (start time + duration) That is all you have to save. Remaining time = (End time - current time)
  3. local x, y, z = getElementPosition(source) local xr, yr, zr = getElementRotation(source) local playerData = {x=x, y=y, z=z, xr=xr, yr=yr, zr=zr} Those 2 functions do not return a table, but multiple variables.
  4. https://wiki.multitheftauto.com/wiki/OnClientPlayerVehicleEnter onClientPlayerVehicleEnter can also trigger for the remotePlayers(players other than yourself). So that issue doesn't require any serverside code. ------------------------------------------------- If you want to learn how to sync data, you could start with something not so complicated. And later learn how to use triggerEvents.
  5. Locked for topic bumping. If nobody wants to help you, then there must be something wrong with the information you provide. Or maybe your request is unacceptable. Think about it.
  6. Dit you check out how adminpanel does it? (Vehicle select)
  7. It is not a MTA function. Get it from here: https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D
  8. @WorthlessCynomys isElement -- instead of getElementType
  9. The 2D way. First translate the 3D start and end point to 2D. With this function: https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition You have now a 2D line instead of a 3D. Next Get the distance between the 2D line and point(your cursor) with: https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D
  10. I have heard about this issue before, but not sure if people actually fixed it. The object orientation is updated every frame. But for some unknown reason there is a little delay. With other words: I don't know. Maybe add an extra eventHandler in file bone_attach_c.Lua: addEventHandler("onClientPreRender",root,putAttachedElementsOnBones) --[[ line 85 ]] addEventHandler("onClientRender",root,putAttachedElementsOnBones) --[[ NEW on line 86 ]] If you look at the event order: https://wiki.multitheftauto.com/wiki/Game_Processing_Order You can see that onClientPreRender event first fires and onClientRender fires as last. Maybe if updates are applied on both moments it could be a little bit smoother. Could could could > so not sure.
  11. It is most of the time not a matter of what they show, but which ones aren't shown. Between the ones that are shown and the ones that are NOT shows is your problem. Even if you think such useful information is useless, there will be a time you will think different about your previous reply.
  12. Yes, but BEFORE, not AFTER. Also add some debuglines, I need those to help you.
  13. Hmmm The code is a bit odd. But to fix it. Do not destroy the weapon in the loop. Do it before the loop. Just this: if isElement(armaobject) then destroyElement(armaobject) -- destroyed object end Because the weapon is directly destroyed after creating it. Or atleast I think that could happen.
  14. @thund3rbird23 I am just bewondering, did you test this with other players? Or is that irrelevant? Because this code as it is now doesn't looks like multiplayer compatible. Atleast if the armas effect is visible for remotePlayers(other players than yourself).
  15. Relative as in 80% of 1920px? Nothing actually at the end. The only difference is the usability for the developer. You can develop your UI with absolute values (px), on your own screen resolution, while it is automatic compatible for other resolutions (%).
  16. @grazia local players = getElementsByType("player") -- test code if #players > 0 then setElementData(players[math.random(#players)], "something", "something") end -- local found = false for i=1, #players do local player = players[i] local something = getElementData(player, "something") if something == "something" then iprint(getPlayerName(player), " has something...") found = true break -- stop searching end end
  17. IIYAMA

    Help!

    With: https://wiki.multitheftauto.com/wiki/OnPlayerQuit Players that left the server, are still inside of the playerIDs table. playerIDs[source] = nil
  18. IIYAMA

    Loading mods

    I would recommend moving each loading request atleast to the next frame. That way the process will be synchronised with your framerate > GPU. Which reduces the large freezing effect, because each other operation will be able to finished and continue it's "what ever it's doing?". (Not the small freeze effects though) NOTE: it does not keep an eye on the processor. So for large mods a bigger delay might be recommended.
  19. IIYAMA

    Help!

    The player list is dynamic. The location of the players in the table is changing when players are leaving. Player list (table) local players = getElementsByType("player") New players are added on the back of the table. players = { [1] = player1, [2] = player2, [3] = player3 } players[4] = player4 players = { [1] = player1, [2] = player2, [3] = player3, [4] = player4 } Leaving players are collapsing the list. players = { [1] = player1, [2] = player2, [3] = player3, [4] = player4 } table.remove(players, 1) -- player1 is leaving players = { [1] = player2, [2] = player3, [3] = player4 } If you want to generate IDs, you have to make sure they are always unique. do -- < Closed environment for the variable: id. Nothing can edit it, except for the newId function. local id = 0 function newId() id = id + 1 return id end end local playerIDs = {} function getIDFromPlayer(player) local id = playerIDs[player] if not id then id = newId() playerIDs[player] = id end return id end Note, this table doesn't clean it self, yet.
  20. Big dreams, maybe pay Google a little bit with your privacy, by using the search bar and button. It is a lot cheaper you know? No-cure-no-pay, seriously? ? Zombie bots. <<< Topic doesn't fit within this section, LOCKED
  21. The variable victim contains extra information. It is optional. function cameraFireing(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) iprint("event is fired") if getElementData(localPlayer, "char.inMarkerZone") then iprint("source is in zone") local victim = isElement(hitElement) and getElementType(hitElement) == "player" and hitElement or false local zoneName = getElementData(localPlayer,"char.MarkerZoneName") triggerServerEvent("sendGroupMessage", resourceRoot, victim, victim and getPlayerName(victim), zoneName) end end addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) addEvent("sendGroupMessage", true) addEventHandler("sendGroupMessage", resourceRoot, function (victim, victimName, zoneName) local message = "#ffffffThe camera: #ca5454(".. zoneName ..") #ffffffdetected shots. " if victimName then message = message .. " You hit this player: " .. victimName end outputChatBox(message, client) if isElement(victim) then outputChatBox(getPlayerName(client) .. " hits you and he doesn't feel sorry for it.", victim) end local players = getElementsByType("player") for i=1, #players do local player = players[i] if player ~= client and player ~= victim then outputChatBox(getPlayerName(client) .. " loves sheeps.", player) end end end, false)
  22. if victim then So, do not add this clientside. But as I said in my previous post: And add WAY more debug lines. You have now just 1 line, which is in this case your outputChatBox. That is not enough! YOU ARE A GOD, YOU WANT TO DOMINATE, YOU WANT TO BE IN CONTROL AND KNOW EVERYTHING! function cameraFireing(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) iprint("event is fired") if getElementData(source, "char.inMarkerZone") then iprint("source is in zone") end end
  23. IIYAMA

    Open Browser

    No that is not possible directly from MTA exe to web-browser. But you can set the clipboard with an specific URL. https://wiki.multitheftauto.com/wiki/SetClipboard You can also add push notifications, which comes closer to what you want: https://web-push-book.gauntface.com/ https://web-push-book.gauntface.com/demos/notification-examples/ But I haven't done it before, so the exploration is all yours. How Youtube does it (concept):
  24. IIYAMA

    Animation

    The second code is the condition for removing the handler.
  25. IIYAMA

    Animation

    Block the progress local timeNow = getTickCount() local iProgress = (timeNow - iStartTick)/1000 if iProgress > 1 then iProgress = 1 end Stop the animation 3 seconds after the end time. if ((timeNow - iStartTick) / 1300) >= 1 then
×
×
  • Create New...