Jump to content

#Black_Hawk

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by #Black_Hawk

  1. i putted 5 seconds just for example, but i want it even when i use a bigger number like 1 minute or 5 .. etc how to make it synced to new players ?
  2. no i meant the timer of destroying the ped
  3. ok but how is the timer gonna be updated ? is it like triggering event every second ? that will cause lag
  4. hello guys i have a little question let's say i created a ped and when i create the ped there will be a trigger to create this ped to all players and with a timer to destroy this ped so how to make it synced for the new players ? like when i create the ped to all players at the server it works but how to make it working even when a new player enters the server ? with the same timer count i know that i can create a ped on server side, but i want to know how to make synced on client side codes: addCommandHandler ("ped", function () local x, y, z = getElementPosition (localPlayer) triggerServerEvent ("createPed", localPlayer, x, y, z) end ) addEvent ("pedCreated", true) addEventHandler ("pedCreated", root, function (x, y, z) local ped = createPed (7, x, y, z) setTimer (function (ped) destroyElement (ped) end, 5000, 1, ped) end ) addEvent ("createPed", true) addEventHandler ("createPed", root, function (x, y, z) triggerClientEvent (root, "pedCreated", source, x, y, z) end ) and let's say that i killed the ped, and if the ped died it will be destroyed to all players that can see the ped, but how about new players
  5. i used like this: files/skin.txd and also like this: :Models/files/skin.txd nothing works
  6. no it's exists and it defined in the meta nothing wrong but i got that error always here is the meta: <meta> <info name="" description="" type="script" version="1.0" /> <script src="models.lua" cache="false" type="client"/> <file src="files/skin.txd" download="false" /> </meta>
  7. hello guys i'm trying to download a file from other resource like using exports to download the file calling downloadFile from other resource, but i always get the error: file not exists why i get that error ? codes of the call: function download (file) downloadFile (file) end codes of calling: addEventHandler ("onClientResourceStart", resourceRoot, function () exports["file"]:download ("files/skin.txd") end )
  8. Hello guys, I'm having a little problem with this code, The problem is when every new object created it should give it new valid it that is not used by another object the id will be Number. NOTE: i'm using a 'split' cause i need it in the whole code. My code: local object = createObject (3095, 1557.835, 1575.586, 10.820) setElementID (object, "1,Object") function getFreeID () local id = 0 for _,v in ipairs (getElementsByType ("object", resourceRoot)) do local data = split (getElementID (v), ",") for i = 0, #getElementsByType ("object", resourceRoot) + 1 do if (data[1] == i) then id = id + 1 end end end return id end
  9. hello guys .. i was wondering how to make the marker clickable ? by using 'onClientClick' or other ways that may be valid i know there is a lot of ways to make it by attaching objets or peds or whatever to the marker but i want to know if there is a way to make it clickable without attaching anything to it ?
  10. thanks for this tip thanks a lot
  11. i don't know how to thank you thanks a lot now i'm gonna try to make this gui bigger a little bit i hope it's not gonna be messed
  12. i don't want to use that i want moveable
  13. really thanks but there is this problem when moving the gui to any other position and try to warp to a place you can see it's not working correctly so the gui needs to be in one place only and not be moved to anywhere .. so the last code that probleem wasn't there
  14. yes only this happens when i change the resolution
  15. The cursor's position is where i am standing on the correct positions but the blip is too far from my position: http://i.imgur.com/NsoEYeQ.jpg
  16. Really thank you so much .. but there is a problem with the blips it's not at the same position but when i spawn it warps me correctly to the place is select but the blip in the same problem when i warp higher the blip be close to my position when warp lower the blip move far from the position
  17. i got this problem, that when i select a place it warps me perfectly without any mistakes but the problem begins when the resolutions of the screen get changed for example: my resolutions is (1366 / 768) if someone have a different resolutions from mine when he select a place to warp it warps him near the place that he selected not the same as he select but different place My code: local BLIPS = { } local NAMES = { } local screenW, screenH = guiGetScreenSize () function removeHex (name) return type (name) == "string" and string.gsub (name, "#%x%x%x%x%x%x", "") or name end addEventHandler ("onClientResourceStart", resourceRoot, function () win = guiCreateWindow ((screenW - 674) / 2, (screenH - 716) / 2, 674, 716, "Teleporter", false) guiWindowSetSizable (win, false) guiSetAlpha (win, 1.00) guiSetVisible (win, false) map = guiCreateStaticImage (9, 23, 655, 654, ":freeroam/map.png", false, win) for _,v in ipairs (getElementsByType ("player")) do blip = guiCreateStaticImage (347, 337, 10, 10, ":freeroam/localplayerblip.png", false, map) name = guiCreateLabel (347, 337, 123, 20, "", false, map) guiSetFont (name, "default-bold-small") guiLabelSetColor (name, 24, 230, 39) BLIPS [v] = blip NAMES [v] = name end spawn = guiCreateButton (243, 682, 188, 24, "Teleport Me", false, win) guiSetFont (spawn, "clear-normal") guiSetProperty (spawn, "NormalTextColour", "FF19E528") end ) addCommandHandler ("map", function () if getElementData (localPlayer, "allowed") then guiSetVisible (win, not guiGetVisible (win)) showCursor (guiGetVisible (win)) end end ) local XP, YP addEventHandler ("onClientGUIClick", resourceRoot, function (button, _, x, y) if (button == "left") then if (source == map) then local winx, winy = guiGetPosition (win, false) local imgw, imgh = guiGetSize (map, false) local x, y = x - winx - 7, y - winy - 20 local nx, ny = (x / imgw), (y / imgh) XP = (nx * 6000) - 3000 YP = (3000 - ny * 6000) elseif source == spawn and XP and YP then setElementPosition (localPlayer, XP, YP, 0) setElementFrozen (localPlayer, true) setTimer (function (localPlayer) _, _, _, ZP = processLineOfSight (XP, YP, 3000, XP, YP, -3000) setElementPosition (localPlayer, XP, YP, (ZP or 0) + 1) setElementFrozen (localPlayer, false) end, 300, 1, localPlayer) end end end ) addEventHandler ("onClientGUIDoubleClick", resourceRoot, function (button, _, x, y) if (button == "left") then if (source == map) then local winx, winy = guiGetPosition (win, false) local imgw, imgh = guiGetSize (map, false) local x, y = x - winx - 7, y - winy - 20 local nx, ny = (x / imgw), (y / imgh) XP = (nx * 6000) - 3000 YP = (3000 - ny * 6000) setElementPosition (localPlayer, XP, YP, 0) setElementFrozen (localPlayer, true) setTimer (function (localPlayer) _, _, _, ZP = processLineOfSight (XP, YP, 3000, XP, YP, -3000) setElementPosition (localPlayer, XP, YP, (ZP or 0) + 1) setElementFrozen (localPlayer, false) end, 300, 1, localPlayer) end end end ) addEventHandler ("onClientRender", root, function () for _,v in ipairs (getElementsByType ("player")) do if (BLIPS [v] and NAMES [v]) then local x, y = getElementPosition (v) x = math.floor ((x + 3000) / 6000 * 655) - 4 y = math.floor ((3000 - y) / 6000 * 654) - 4 guiSetPosition (BLIPS [v], x, y, false) guiSetText (NAMES [v], removeHex (getPlayerName (v))) guiSetPosition (NAMES [v], x + 13, y - 5, false) end end end ) so can someone help me please with that ?
  18. so i got this new problem when clicking on the top of the map it get lower like y - 20 something like that so it's not the same place i selected and also when clicking on the bottom of the map it get higher like y + 20 so what is that problem ? can someone please help me
  19. the problem is not there the problem is in function (button_, x, y) the coordinations of x, y when the gui get clicked will be changed if the gui was changed not gonna be the same result as if it was not moved. the question is, Can i make the coordinations of x, y the same even if it was moved ?
  20. hello guys, i'm trying to make a teleport, By using a map just like freeroam but i'm having this weird problem that the coordinates changes whenever i change the position of the main gui (window) here is my code: addEventHandler ("onClientGUIClick", resourceRoot, function (button, _, x, y) if (button == "left") then if (source == map) then local imgX, imgY = guiGetPosition (map, false) local width, height = guiGetSize (win, false) local x, y = (x - imgX) / width, (y - imgY) / height XP = x * 6000 - 3000 YP = 3000 - y * 6000 _, _, _, ZP = processLineOfSight (XP, YP, 3000, XP, YP, -3000) outputChatBox (XP .. ", " .. YP .. ", " .. (ZP or 0)) end end end )
  21. Thanks i know what you mean now .. thanks for help
×
×
  • Create New...