Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by knightscript

  1. Thanks, made it work local spawn = exports["NTTC_Tables"]:getRandomLoot("Los Santos") local spawn = exports["NTTC_Tables"]:getRandomLoot("Los Santos") LV = {} LS = {} SF = {} Other = {} function displayLoadedRes ( res ) i = 1 for k,v in pairs(spawntables()) do local zone = getZoneName( v[1],v[2],v[3], true ) if (zone == "Los Santos") then LS[i] = tostring(v[1]..","..v[2]..","..v[3]) i = i+1 end end end addEventHandler ( "onResourceStart", getRootElement(getThisResource( )), displayLoadedRes ) function getRandomLoot(location) --local x,y,z = number[1
  2. I tried to, wasnt able, was just able to send a string, the table I was trying to send was for example: table = [] table['x'] = x table['y'] = y table['z'] = z return table['x'],table['y'],table['z']
  3. Yes, yes, just figured out that it seems I cant send a table through an export, I tried this: outputServerLog("X = "..exports["NTTC_Tables"]:getRandomLoot("Los Santos")) and on my function function getRandomLoot(location) local number = table.random(locations_for_items_and_spawns) --outputServerLog( number[1]..","..number[2]..","..number[3] ) return "x,y,z" end result:
  4. Hello, I am trying to export a function called "getRandomLoot", which is in a resource name NTTC_Tables, I am trying to export this function to be able to use it on another resource, the function: function getRandomLoot(location) local number = table.random(locations_for_items_and_spawns) --outputServerLog( number[1]..","..number[2]..","..number[3] ) local x,y,z = number[1], number[2], number[3] local position = getZoneName ( x, y, z, true ) table = [] table['x'] = x table['y'] = y table['z'] = z return table end <meta> <script src="async.lua" type="shared" /> <
  5. Thank you so much for explaining this, i will try this and update my comment with the result, one more question not exactly related, is there a way to set a weapons alpha (a gun that i give with giveGun)? thank you
  6. Thanks, I do understand, what I dont understand is how can I fade out and fade in an image? i cant manage to understand how onclientrender could work
  7. Hello, I am trying to make a script that swaps the image on screen for a new one from a table I really am lost and dont have idea what to do next, local screenW, screenH = guiGetScreenSize() local randomize2 = math.random ( #Imagens ) local alpha = 255 local current_image = "" function ImageRender(image,alpha) if getElementData (getLocalPlayer( ),"logedin") == false or getElementData (getLocalPlayer( ),"logedin") == nil then current_image = guiCreateStaticImage(0, 0, screenWidth, screenHeight, tostring(Imagens[image]), false) guiMoveToBack( current_image ) guiSetAlpha(current_imag
  8. well you just have to adapt the code I gave you just use getDistanceBetweenPoints3D and i dont know what you use to know if its a criminal that is trying to revive
  9. Forgive me, I wasnt at home, I will work on an example and I will send it to you, i will use 1920x1080 and make calculations there, theoretically if I do it relative it should work on any res, i will update my comment when its ready.
  10. You could use onClientClick to get the position in the screen in combination with GuiGetScreenSize (to calculate the relative screen position)
  11. You could create a PNG image thats bigger than the original one with transparency, have an onclick for it
  12. Thanks, fixed it, it seems one of the image files were missing, i still dont get why for some users it worked fine and for others it didnt,
  13. I mean, there was no need to humilliate him, you could of told him more or less what functions to use, here, tested it, CLIENT: function math.round(number) local _, decimals = math.modf(number) if decimals < 0.5 then return math.floor(number) end return math.ceil(number) end local revive_percentage = 0 local timer = 0 function add_percentage_per_second() if (revive_percentage < 100) then revive_percentage = revive_percentage + 1.25 if (revive_percentage >= 100) then setPedAnimation(getLocalPlayer()) removeEventHandler("onClientRender"
  14. This is because DayZ gamemode has a protection, you should look for a timer in your gamemode that does something like this local skin = getElementData(player,"skin") if (skin ~= getElementModel(player) then setElementModel(player,skin) end if you find this, check the element data, and just add setElementData(player,"DATANAME",YOURSKINID) example, if your DayZ protection dataname is "DayZSkin", and the skin you set is 150 setElementData(player,"DayZSkin",150) FULL CODE With dataname "DayZSkin": newskin = createMarker ( 1856.0751, 851.0827, 9.408, "cylinder",
  15. But can this affect only a couple users and not all of them?
  16. Its calling many elementdatas, but this happens with any gui, happens with inventory system, with gang system
  17. its like nothing was on the screen, you can see when I hover over the buttons in my VM, nothing happens
  18. That is not the problem, its just something that sets some element data, nothing to do with the actual problem shown in the video or else it wouldnt work in any computer
  19. Hello, I dont know if someone has posted this here before, I searched and wasn´t able to find anyone having this problem, my problem is, I have a DayZ script, which I have been modifying, but since the start some of my players were not able to click on the GUI from the Inventory, nor the gang system, nor the login panel, this just happens with some players, for example, everything works on my computer, but with a virtual machine, I am not able to click on anything, here is a video of what I am talking about, I have no idea why this is caused, there is no related problems in my debugscript, act
  20. Hello, sorry for late reply, just tried using setElementFrozen, and it just freezes the vehicle and the elevator object goes through the car and goes up Hello, sorry for late reply, tried this yesterday and the problem persists Hello, I fixed it in a funny way, what I did is add a second elevator object, and made its alpha 0 (invisible) and attached it to the original elevator, it works now, I´ll leave the code for whoever needs it local elevatorcolshape = createColRectangle ( 1666, 1188, 30.6, 20.0 ) local elevator = createObject(3115, 1676.9, 1197.8, 24.2) local elevatorclon
  21. Hello, I am trying to make an elevator script using an createObject, moveObject and attachElements to attach a vehicle to the object, the problem is, the vehicle goes through the object even if I add an Z offset, this is my code: local elevatorcolshape = createColRectangle ( 1666, 1188, 30.6, 20.0 ) local elevator = createObject(3115, 1676.9, 1197.8, 24.2) local elevatorSTATE = "techo" function elevator1337(source,command,goto ) local playeraccount = getPlayerAccount( source ) local accname = getAccountName( playeraccount ) local playerx,playery,playerz = getElementPosition( source )
  22. Alright, Ill try it out and let you know how it goes, thank you
  23. Alright, one last thing, this should do the trick, replace this: amount = str:gsub('%A',amount) with this: amount = string.gsub('%A',amount)
  24. Alright, try changing if (string.count(amount,"-")) then to this: if (string.count(tostring(amount),"-")) then
  25. You could use string.count to check if "amount" contains a negative "-" symbol, and use Split to remove it from the string, EDIT: function string.count (text, search) if ( not text or not search ) then return false end return select ( 2, text:gsub ( search, "" ) ); end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if (string.count(amount,"-")) then amount = str:gsub('%A',amount) end if money >= amo
  • Create New...