-
Posts
575 -
Joined
Everything posted by codeluaeveryday
-
[TUT] Updating admin countries (Manual & Automatic)
codeluaeveryday replied to codeluaeveryday's topic in Tutorials
It's just because of the hosting, it was having issues... I can try to setup something else. -
we just used dx elements and shaders to achieve this. PHP was not needed
-
^^ If you do this, it will save me a lot of time.
-
This is annoyed me and anderl for sometime, but we eventually got it sorted.
-
I'm with Xxmade, I get the same issue. Even the examples don't do it correctly, the examples all say that the server did not respond, I then added the mta server with the examples and still no result: $servers = array( array( 'id' => 'mtasa', 'type' => 'Mta', 'host' => '80.241.211.36:22123', ) ); -- original port was 22000, ase port = +123 == 22123. I don't have any issues with PHP, it's quite easy.
-
I was using the ASE port at the time, I will test the forked version too.
-
I've tried using GameQ, it didn't work when I used it, I'm pretty sure gameQ is outdated / depreciated.
-
send me a PM of the script you've written down, make sure this is server sided.
-
I've already been page snooping for you, I had no luck.
-
Have you put the key in? it works for me. local theKey = 'MYKEYHERE' edit MYKEYHERE with the key from that site I sent.
-
I've done some research for you, and I found that the best way to achieve this would to use a public API. I was thinking of using it with a Unix timestamp of the local computers time to find a near accurate timezone, or we could use an ip address, or we could use both to get a more accurate GMT result. I have found the best API for this job, I have used them before with old projects. You will need to register an account and recieve your API key first: addEventHandler('onPlayerJoin', root, function() -- Trigger GMT request local theIP = getPlayerIP(source) local theKey = 'MYKEYHERE' local apiURL = 'http://api.ipinfodb.com/v3/ip-city/?key='..theKey..'&ip='..theIP..'&format=json' fetchRemote(apiURL, gmtData, "", false, source) end ) function gmtData(data, response, player) local data = '['..data..']' local theData = fromJSON(data) if theData then setElementData(player, 'timezone', theData['timeZone']) else outputDebugString('Error parsing data') end end ^^ Tested and works, make sure you put your API key in it. To read it just use getElementData.
-
The MYSQL Module is depreciated so I will not offer advice on it. Instead you can use MTA's native SQL functions: dbConnect dbQuery dbPoll dbFree
-
Dude I think you should try Google's British voice, it's much better: http://translate.google.com/translate_t ... therfucker
-
Updated: 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, true) end end end
-
You are also able to rotate text
-
Adding Skype to MTA is already possible through sockets, unfortunately no one is skilled enough to attempt it.
-
Hello Wesley, I am interested, I have added you on Skype. I have a few other questions after that.
-
Linkin, I feel like you have not received much help from Solidsnake, this is pretty basic though: Change you're map name to: g_dxGUI.mapdisplay:text("Map: #ffffff"..g_MapInfo.name) ^^ Replace the #ffffff with what ever color, find them at colorpicker.com Change textlib.lua to: 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, 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, true) end end end
-
Please keep in mind Lua is CASE sensitive, your addEventHandler was AddEventHandler, please look more carefully next time: GUIEditor = { button = {}, window = {}, label = {} } addEventHandler('onClientResourceStart', resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(352, 162, 472, 470, "Silah Paneli FULL Coded by Eded", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.label[1] = guiCreateLabel(17, 44, 429, 46, "Silah Paneli", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 25, 246, -- s8) --> guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) GUIEditor.label[2] = guiCreateLabel(43, 151, 371, 116, "", false, GUIEditor.label[1]) GUIEditor.label[3] = guiCreateLabel(137, 100, 185, 48, "By Eded", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[3], "sa-header") guiLabelSetColor(GUIEditor.label[3], 25, 246, -- s8) --> GUIEditor.button[1] = guiCreateButton(17, 190, 116, 39, "AK - 47", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(176, 190, 116, 39, "M4", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(336, 190, 116, 39, "UZI", false, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(17, 261, 116, 39, "TEC-9", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(176, 261, 116, 39, "Susturucu Pistol", false, GUIEditor.window[1]) GUIEditor.button[6] = guiCreateButton(336, 261, 116, 39, "Pistol", false, GUIEditor.window[1]) GUIEditor.button[7] = guiCreateButton(17, 332, 116, 39, "SPAS-12", false, GUIEditor.window[1]) GUIEditor.button[8] = guiCreateButton(176, 332, 116, 39, "Sawnoff Shotgun", false, GUIEditor.window[1]) GUIEditor.button[9] = guiCreateButton(336, 332, 116, 39, "Shotgun", false, GUIEditor.window[1]) GUIEditor.button[10] = guiCreateButton(17, 400, 116, 39, "Desert Eagle", false, GUIEditor.window[1]) GUIEditor.button[11] = guiCreateButton(176, 400, 116, 39, "MP5", false, GUIEditor.window[1]) GUIEditor.button[12] = guiCreateButton(336, 400, 116, 39, "Sniper Riffle", false, GUIEditor.window[1]) GUIEditor.button[13] = guiCreateButton(17, 94, 91, 86, "Can", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[13], "sa-header") GUIEditor.button[14] = guiCreateButton(361, 90, 91, 86, "Zirh", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[14], "sa-header") GUIEditor.label[4] = guiCreateLabel(156, 446, 306, 14, "Silah Paneli by Eded TurkishCity Freeroam 2012-2013", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetColor(GUIEditor.label[4], 2, 2, 251) GUIEditor.button[15] = guiCreateButton(127, 152, 216, 28, "KAPAT / QUIT / F2", false, GUIEditor.window[1]) addEventHandler ("OnClientGUIClick",silah, silahh, false ) bindKey ( "F2", "down", GUI ) end ) function GUI() local status = not guiGetVisible(GUIEditor.window[1]) showCursor(status) guiSetVisible(GUIEditor.window[1], status) end
-
You are welcome John! If you ever need a paid scripter, just add me on skype: chrisinater22.
-
Hello John! The current script will only work on the server side: local mRed = 255 local mGreen = 255 local mBlue = 255 local theMessages = { 'Message 1', 'Message 2', 'Message 3', 'Message 4', 'Message 5', 'Message 6' } addEventHandler('onClientResourceStart', resourceRoot, function() setTimer(outputChatBox, 300000, 0, theMessages[math.random(#theMessages)], localPlayer, mRed, mGreen, mBlue, true) end ) If you want to use this client sided change line 16 to: setTimer(outputChatBox, 300000, 0, theMessages[math.random(#theMessages)], mRed, mGreen, mBlue, true) Enjoy, please learn from it.
-
I might be interested, add me on skype: chrisinater22, we will chat there.
-
[PAID] Snow script with snow rising and real snow fall
codeluaeveryday replied to ..:D&G:..'s topic in Resources
D&G, add me on skype and we can talk a bit more about your script that you want made. Skype: chrisinater22 -
Your welcome, I also made a PHP version, it's best used for SMF, i'm not sure how it will work with other website software: <?php function checkPasswordType($dbPassword, $checkPassword) { $dbPassword = strtoupper($dbPassword); $theHash = substr($dbPassword, 0, 64); $theType = substr($dbPassword, 64, 1); $theSalt = substr($dbPassword, -32); if (strcmp($theType, '0') == 0) { $theCheckHash = strtoupper(hash('sha256', $theSalt.$checkPassword).$theType.$theSalt); if ($theCheckHash == $dbPassword) { return 1; } else { return 0; } } else { return 3; } } echo checkPasswordType("ffff", 'Password'); ?> if it returns 1 it means that it's definitely a MTA style password and they DO match. if it returns 2 it means that it's definitely a MTA style password and they do NOT match. if it returns 3 it means that it's definitely NOT a MTA style password.
-
Time to add more encryptions :twisted:
codeluaeveryday replied to codeluaeveryday's topic in Suggestions
Thankz