Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. Yes, but BEFORE, not AFTER. Also add some debuglines, I need those to help you.
  2. 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.
  3. @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).
  4. 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 (%).
  5. @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
  6. IIYAMA

    Help!

    With: https://wiki.multitheftauto.com/wiki/OnPlayerQuit Players that left the server, are still inside of the playerIDs table. playerIDs[source] = nil
  7. 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.
  8. 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.
  9. 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
  10. 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)
  11. 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
  12. 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):
  13. IIYAMA

    Animation

    The second code is the condition for removing the handler.
  14. 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
  15. Conditions are used for excluding actions. Which is not what you want, when you want: shooting OR killing Instead you want to have a variable value which only exist when all conditions are met. local victim = isElement(hitElement) and getElementType(hitElement) == "player" and hitElement or false You can't hit yourself with your own bullets: hitElement ~= source As I said before: addEventHandler("onClientPlayerWeaponFire", root, cameraFireing) addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) triggerServerEvent("sendGroupMessage", resourceRoot, hitElement) Do this on serverside: if hitElement then local message = "#ffffffThe camera: #ca5454("..getElementData(hitElement,"char.MarkerZoneName")..") #ffffffdetected shots." end addEventHandler("onClientPlayerWasted", getLocalPlayer(), cameraKilling) onClientPlayerWasted, so this is not needed: if (getElementType(source) == "player") then
  16. As your code is programmed now, you have to hit another player in order to trigger the server event. Are you sure you have met that condition? Also attach the eventhandler to the localPlayer: addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing) Even though this event is fired on each client/player. The event is also fired for each player when attached to the root. When there are 5 players in the server, 1 player hits another player, the triggerServerEvent is activated max 5 times.
  17. @ilnaz Re-used data, with a buffer. local songBuffer = {} addEvent("onSearchRequest", true) addEventHandler("onSearchRequest",getRootElement(),function(txt) local buffer = songBuffer[txt] if buffer then onSongReturn(buffer, 0, player) else fetchRemote( "http://5music.online/?song="..(txt:gsub(' ', '+')),onSongReturn,'',true,client, txt) end end) function onSongReturn(data, errno, player, txt) if errno == 0 and txt then songBuffer[txt] = data end if player and isElement(player) then local str1 = string.find(data,"<ul>") local _,str2 = string.find(data,"</ul>") if str1 ~= nil then local data = string.sub(data,str1,str2) triggerClientEvent(player,"onSongReceived", player, data) end end end -- clear buffer setTimer(function () songBuffer = {} end, 1000 * 60 * 60 * 4, 0)
  18. Locked for the following reasons. 1. Suspicion release. (Leaving a link on a topic, which leads to a ZIP file. Without a description of any kind except for the title) 2. Unsupported at all. (Which makes it looks like, it is not yours to begin with) 3. Wrong section. Because of those 3 reasons, I am not even going to check your ZIP file.
  19. Is your issue now solved with xFabel his explanation? You can convert names to id's with this function: https://wiki.multitheftauto.com/wiki/GetVehicleModelFromName local model = getVehicleModelFromName ("bandito") if model then -- is there an id based on that name? end
  20. Where is that suppose to come from? It is not as if groupid is something from default MTA.
  21. Clientside? Btw you are missing an argument: (model) createVehicle ( int model, float x, float y, float z
  22. Have you noticed that the event system is Asynchronous? (You can't make use of the return keyword functionality after all. Stopping the code with it does work.) And exports are Synchronous. (You can use the return keyword to return values) An understanding of what I am talking about in JavaScript: After you watched this, you know which one is way faster.
  23. By just looking at the initial setup, it looks very logic. That is without looking at syntax and any other issues at all.
  24. The variable name localPlayer isn't suppose to be used on serverside, because it only makes sense for the player that runs the MTA application and the server on his own pc. No other player in your server will be able to met that condition. Note: If this code is fully clientside, you will not be able to send a message to other players. Do you remember this loop you posted in your other topic? It will allow you to go through all the players in the server.
  25. Wait until the bug has been solved. https://github.com/multitheftauto/mtasa-blue/issues/1091 No video on your server, is not the end of your world atleast. (Hope hope)
×
×
  • Create New...