Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. You can't stop or delete a function.
  2. Put all objects into a table and then when you trigger an unload function, destroy them with destroyElement.
  3. viewtopic.php?f=91&t=56871#p549336
  4. How does IPB encrypts passwords? I'm using IP.Board 3.3.4 right now. I tried many options: md5(md5(salt)..md5(password)) sha1(password) md5(password) md5(md5(username)..md5(password)) Can you help me out? Thanks. EDIT: Nevermind, I got it! It was: md5(md5(salt):lower()..md5(password):lower()):lower()
  5. If map has scripts, you'll need to cache and load them with loadstring and pcall.
  6. Hello. I have problem with colliding vehicles. Well, here's picture: http://shrani.si/f/33/5z/3ObG7iTG/mta-s ... 1400-2.png As you can see in the picture, vehicles can't collide correctly. Code: function col() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then for i,v in ipairs(getElementsByType("vehicle")) do setElementCollidableWith(vehicle, v, false) end end end addEventHandler("onClientRender", root, col)
  7. Executable file in: https://community.multitheftauto.com/in ... ls&id=6888 DONE
  8. That's the problem from the image. I had the same problem but in my case, I used dxDrawImageSection.
  9. Hello, I am creating a spectator system using setCameraTarget, and when I use it, it works fine. But after few seconds, it shows "*** Network Trouble ***" in the middle of screen. Any solution there? Thanks in advance.
  10. You're welcome. You must use loadstring and do the wrappers. Like: -- Override the function. _playSound = playSound sounds = {} res = "" function playSound(filepath, looped) local music = _playSound("cache/"..res.."/"..filepath, looped) -- Filepath is song (music.mp3) if music then table.insert(sounds, music) -- You can unload it later. Just loop through this table and use stopSound. end end function loadScript(content, resourceName) res = resourceName -- Your map name. local loadit = loadstring(content) local loaded = pcall(loadit) if loaded then -- ? end end
  11. Would you like to cache client-side scripts? If so, you first need to get script name's and their location and send them to client. Put them in a table. (You don't need latent event.) local scriptsTable = {} for index, node in ipairs( xmlNodeGetChildren(meta) ) do local ntype = xmlNodeGetName(node) if ntype == 'script' then local filePath = xmlNodeGetAttribute(node,'src') if filePath then table.insert(scriptsTable, filePath) end end end triggerClientEvent(a, "checkCache", a, resName, scriptsTable) Then you need to check if script is already cached. Do that by: function checkCache(resName, tScripts) for i, v in ipairs(tScripts) do if not fileExists("mapscripts/"..resName.."/"..v) then triggerServerEvent("requestDownload", source, resName, v) else end end end addEvent("checkCache", true) addEventHandler("checkCache", root, checkCache) On the server-side, you need to read that file and send it back to client. addEvent("requestDownload", true) addEventHandler("requestDownload", root, function(resName, scriptName) if fileExists(":"..resName.."/"..scriptName) then file = fileOpen(":"..resName.."/"..scriptName) if file then fileSize = fileGetSize(file) fileContent = fileRead(file, fileSize) triggerLatentClientEvent(source, "onClientDownloadRecieve", source, fileContent, resName, scriptName) end end end ) When server will send the code back, client will cache it. function cacheFiles(content, resName, scriptName) local newFile = fileCreate("mapscripts/"..resName.."/"..scriptName) if newFile then fileWrite(newFile, content) fileClose(newFile) end end addEvent("onClientDownloadRecieve", true) addEventHandler("onClientDownloadRecieve", root, cacheFiles) That's it It works fine for me! EDIT: Do the same for files like music. You can stream music also.
  12. The problem is, the script isn't mine. I'm using resedit. (Newest version.)
  13. Well, no, script is working on my windows server.
  14. No one knows? I really need to find a solution...
  15. Put that in your textlib.lua: dxText = {} dxText_mt = { __index = dxText } local idAssign,idPrefix = 0,"c" local g_screenX,g_screenY = guiGetScreenSize() local visibleText = {} ------ defaults = { fX = 0.5, fY = 0.5, bRelativePosition = true, strText = "", bVerticalAlign = "center", bHorizontalAlign = "center", tColor = {255,255,255,255}, fScale = 1, strFont = "default", strType = "normal", tAttributes = {}, bPostGUI = false, bClip = false, bWordWrap = true, bVisible = true, tBoundingBox = false, --If a bounding box is not set, it will not be used. bRelativeBoundingBox = true, } local validFonts = { default = true, ["default-bold"] = true, clear = true, arial = true, pricedown = true, bankgothic = true, diploma = true, beckett = true, } local validTypes = { normal = true, shadow = true, border = true, stroke = true, --Clone of border } local validAlignTypes = { center = true, left = true, right = true, } function dxText:create( text, x, y, relative, strFont, fScale, horzA ) assert(not self.fX, "attempt to call method 'create' (a nil value)") if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then outputDebugString ( "dxText:create - Bad argument", 0, 112, 112, 112 ) return false end local new = {} setmetatable( new, dxText_mt ) --Add default settings for i,v in pairs(defaults) do new[i] = v end idAssign = idAssign + 1 new.id = idPrefix..idAssign new.strText = text or new.strText new.fX = x or new.fX new.fY = y or new.fY if type(relative) == "boolean" then new.bRelativePosition = relative end new:scale( fScale or new.fScale ) new:font( strFont or new.strFont ) new:align( horzA or new.bHorizontalAlign ) visibleText[new] = true return new end function dxText:text(text) if type(text) ~= "string" then return self.strText end self.strText = text return true end function dxText:position(x,y,relative) if not tonumber(x) then return self.fX, self.fY end self.fX = x self.fY = y if type(relative) == "boolean" then self.bRelativePosition = relative else self.bRelativePosition = true end return true end function dxText:color(r,g,b,a) if not tonumber(r) then return unpack(self.tColor) end g = g or self.tColor[2] b = b or self.tColor[3] a = a or self.tColor[4] self.tColor = { r,g,b,a } return true end function dxText:scale(scale) if not tonumber(scale) then return self.fScale end self.fScale = scale return true end function dxText:visible(bool) if type(bool) ~= "boolean" then return self.bVisible end if self.bVisible == bool then return end self.bVisible = bool if bool then visibleText[self] = true else visibleText[self] = nil end return true end function dxText:destroy() self.bDestroyed = true setmetatable( self, self ) return true end function dxText:font(font) if not validFonts[font] then return self.strFont end self.strFont = font return true end function dxText:postGUI(bool) if type(bool) ~= "boolean" then return self.bPostGUI end self.bPostGUI = bool return true end function dxText:clip(bool) if type(bool) ~= "boolean" then return self.bClip end self.bClip = bool return true end function dxText:wordWrap(bool) if type(bool) ~= "boolean" then return self.bWordWrap end self.bWordWrap = bool return true end function dxText:type(type,...) if not validTypes[type] then return self.strType, unpack(self.tAttributes) end self.strType = type self.tAttributes = {...} return true end function dxText:align(horzA, vertA) if not validAlignTypes[horzA] then return self.bHorizontalAlign, self.bVerticalAlign end vertA = vertA or self.bVerticalAlign self.bHorizontalAlign, self.bVerticalAlign = horzA, vertA return true end function dxText:boundingBox(left,top,right,bottom,relative) if left == nil then if self.tBoundingBox then return unpack(boundingBox) else return false end elseif tonumber(left) and tonumber(right) and tonumber(top) and tonumber(bottom) then self.tBoundingBox = {left,top,right,bottom} if type(relative) == "boolean" then self.bRelativeBoundingBox = relative else self.bRelativeBoundingBox = true end else self.tBoundingBox = false end return true end addEventHandler ( "onClientRender", getRootElement(), function() for self,_ in pairs(visibleText) do while true do if self.bDestroyed then visibleText[self] = nil break end if self.tColor[4] < 1 then break end local l,t,r,b --If we arent using a bounding box if not self.tBoundingBox then --Decide if we use relative or absolute local p_screenX,p_screenY = 1,1 if self.bRelativePosition then p_screenX,p_screenY = g_screenX,g_screenY end local fX,fY = (self.fX)*p_screenX,(self.fY)*p_screenY if self.bHorizontalAlign == "left" then l = fX r = fX + g_screenX elseif self.bHorizontalAlign == "right" then l = fX - g_screenX r = fX else l = fX - g_screenX r = fX + g_screenX end if self.bVerticalAlign == "top" then t = fY b = fY + g_screenY elseif self.bVerticalAlign == "bottom" then t = fY - g_screenY b = fY else t = fY - g_screenY b = fY + g_screenY end elseif type(self.tBoundingBox) == "table" then local b_screenX,b_screenY = 1,1 if self.bRelativeBoundingBox then b_screenX,b_screenY = g_screenX,g_screenY end l,t,r,b = self.tBoundingBox[1],self.tBoundingBox[2],self.tBoundingBox[3],self.tBoundingBox[4] l = l*b_screenX t = t*b_screenY r = r*b_screenX b = b*b_screenY end local type,att1,att2,att3,att4,att5 = self:type() if type == "border" or type == "stroke" then att2 = att2 or 0 att3 = att3 or 0 att4 = att4 or 0 att5 = att5 or self.tColor[4] outlinesize = att1 or 2 if outlinesize > 0 then for offsetX=-outlinesize,outlinesize,outlinesize do for offsetY=-outlinesize,outlinesize,outlinesize do if not (offsetX == 0 and offsetY == 0) then dxDrawText(self.strText:gsub("#%x%x%x%x%x%x", ""), l + offsetX, t + offsetY, r + offsetX, b + offsetY, tocolor(att2, att3, att4, att5), self.fScale, self.strFont, self.bHorizontalAlign, self.bVerticalAlign, self.bClip, self.bWordWrap, self.bPostGUI ) end
  16. GTX

    MySqL problem

    Is MySQL port already in use? Close your Skype.
  17. Hello, I'm trying to run a compiled script, and then this comes up: Loading script failed: resource\client.lua: bad constant in precompiled chunk I'm using Debian 6, 64bit Linux. The installation of the server went smooth. But when I'm trying to run a compiled script... ^ Thanks in advance.
  18. GTX

    mysql problem

    Where are the variables of mysql_connect? Also check if it connects; handle = mysql_connect(MYSQL_SERVER,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DB) if handle then outputChatBox"Connected" else outputChatBox"Couldn't connect" end Also, do you have a module installed?
  19. GTX

    dbPoll?

    Ahh, now I fixed it. The problem was in accID, it was returning false. Thanks for helping me!
  20. GTX

    dbPoll?

    The number of rows.
  21. GTX

    dbPoll?

    It doesn't work. No errors. No outputs; local query = mysql:query("SELECT * FROM characters WHERE account='"..accID.."'") if query then local result, num_affected_rows = mysql:poll(query) if num_affected_rows > 0 then outputChatBox(result[1]["charactername"]) end end
×
×
  • Create New...