Jump to content

gustavorn

Members
  • Posts

    212
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by gustavorn

  1. Actually, I believe there would be a good option. I'll try to draw up a new metaphor and know what's going. I believe that here, nobody could help me. so thanks to everyone who posted = D
  2. Hello again with another incredible doubt and again there is no time to try alone. Well, I have a system of Top TIMES. In this case, also shows the color of the user. more if the user changes the color of the name he can do Doubletop. I wanted to know what they have to do to block it, let down the syntax of the database, and if anyone can help, how is the new syntax. I really agradesco. Thank you and good forum for everyone. -- -- databasetable_server.lua -- -- A Lua table which is loaded/saved from the sqlite database -- Handled column types are TEXT and REAL -- SDatabaseTable = {} SDatabaseTable.__index = SDatabaseTable SDatabaseTable.instances = {} --------------------------------------------------------------------------- -- -- SDatabaseTable:create() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:create(name,columns,columnTypes) local id = #SDatabaseTable.instances + 1 SDatabaseTable.instances[id] = setmetatable( { id = id, name = name, columns = columns, columnTypes = columnTypes, rows = {}, }, self ) SDatabaseTable.instances[id]:postCreate() return SDatabaseTable.instances[id] end --------------------------------------------------------------------------- -- -- SDatabaseTable:destroy() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:destroy() SDatabaseTable.instances[self.id] = nil self.id = 0 ped = nil vehicle = nil end --------------------------------------------------------------------------- -- -- SDatabaseTable:postCreate() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:postCreate() -- Set column types as strings if not set while #self.columnTypes < #self.columns do table.insert( self.columnTypes, 'TEXT' ) end end --------------------------------------------------------------------------- -- -- SDatabaseTable:safestring() -- -- -- --------------------------------------------------------------------------- function safestring( s ) -- escape ' return s:gsub( "(['])", "''" ) end function qsafestring( s ) -- ensure is wrapped in ' return "'" .. safestring(s) .. "'" end function qsafetablename( s ) return qsafestring(s) end --------------------------------------------------------------------------- -- -- SDatabaseTable:load() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:load() for i=1,10 do if self:tryLoad() then return end end end --------------------------------------------------------------------------- -- -- SDatabaseTable:tryLoad() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:tryLoad() outputDebug( 'TOPTIMES', 'SDatabaseTable: Loading ' .. self.name ) self.rows = {} local cmd -- CREATE TABLE self:createTable() -- SELECT -- Build command cmd = 'SELECT * FROM ' .. qsafetablename( self.name ) local sqlResults = executeSQLQuery( cmd ) if not sqlResults then return false end -- Process into rows self.rows = {} for r,sqlRow in ipairs(sqlResults) do local row = {} for c,column in ipairs(self.columns) do row[column] = sqlRow[column] end table.insert( self.rows, row ) end -- Make copy to detect changes self.rowsCopy = table.deepcopy(self.rows) return true end --------------------------------------------------------------------------- -- -- SDatabaseTable:save() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:save() -- See if save required local bChanged = false if not self.rowsCopy or #self.rows ~= #self.rowsCopy then bChanged = true else for r,row in ipairs(self.rows) do for c,col in ipairs(self.columns) do if self.rows[r][col] ~= self.rowsCopy[r][col] then bChanged = true break end end if bChanged then break end end end if not bChanged then return end outputDebug( 'TOPTIMES', 'SDatabaseTable: Saving ' .. self.name ) -- Being save executeSQLQuery( 'BEGIN TRANSACTION' ); local cmd -- DELETE TABLE -- Build command --cmd = 'DELETE FROM ' .. qsafetablename( self.name ) cmd = 'DROP TABLE IF EXISTS ' .. qsafetablename( self.name ) executeSQLQuery( cmd ) -- CREATE TABLE self:createTable() -- Rebuild -- For each row for r,row in ipairs(self.rows) do -- INSERT INTO cmd = 'INSERT INTO ' .. qsafetablename( self.name ) .. ' VALUES (' for c=1,#self.columns do if c > 1 then cmd = cmd .. ', ' end local key = self.columns[c] if type(row[key]) == 'number' then cmd = cmd .. row[key] or 0 else cmd = cmd .. qsafestring( row[key] or '' ) end end cmd = cmd .. ')' executeSQLQuery( cmd ) end executeSQLQuery( 'END TRANSACTION' ); -- Make copy to detect changes self.rowsCopy = table.deepcopy(self.rows) end --------------------------------------------------------------------------- -- -- SDatabaseTable:createTable() -- -- -- --------------------------------------------------------------------------- function SDatabaseTable:createTable() local cmd -- CREATE TABLE -- Build command cmd = 'CREATE TABLE IF NOT EXISTS ' .. qsafetablename( self.name ) .. ' (' for c=1,#self.columns do if c > 1 then cmd = cmd ..
  3. DNL, thank you very much for your help, I really must thank. I think it is no longer needed anything below
  4. No, stranger. not there is some error. Any suggestions for me of? need much.
  5. Ok that did not work; Continues, the team already inserted the syntax where he was and also did the deviation as months and years.
  6. What line put? desculpe qual linha eu coloco isso, estou sem tempo.?
  7. Hello, I would be grateful if someone could help me add date and actual year in this script. I am very out of time and can not, lose much time. if someone really help me. I know that is not long for this type of resource. local rootElement = getRootElement() local sw,sh = guiGetScreenSize() local windowW = 280 local windowH = 160 local windowTitle = "" local windowTitleHeight = 40 local windowTitleColor = tocolor(0,0,0,255) local windowTitleBGColor = tocolor(0,0,0,255) local windowBGColor = tocolor(0,0,0,0) local windowX = sw - 350 - windowW local windowY = sh / 1.08 - windowH / 2 local localPlayer = getLocalPlayer ( ) function dx (thePlayer) local ping = getPlayerPing(getLocalPlayer()) local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second local day = time.monthday local weekday = time.weekday local month = time.month local year = time.year local playerName = getPlayerName ( getLocalPlayer() ) local money = getPlayerMoney(thePlayer) local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) local playerZoneName = getZoneName( playerX, playerY, playerZ ) local health = getElementHealth(getLocalPlayer()) dxDrawText(""..hours..": "..minutes..": "..seconds.." ",sw/60.203, sh/1.500, sw,sh,tocolor(255,255,255,255),1.5,"default","left","top",false,false,false) dxDrawColorText(""..hours.."#FF00CC: #ffffff"..minutes.."#FF00CC: #ffffff"..seconds.." ",sw/60.200, sh/1.505, sw,sh,tocolor(255,255,255,255),1.5,"default","left","top",false,false,false) local x = windowX local y = windowY + windowTitleHeight local h = windowH - windowTitleHeight dxDrawRectangle(x,y,windowW,h,windowBGColor) local veh = getPedOccupiedVehicle(localPlayer) if veh then local vehicle = getVehicleName(veh,thePlayer) else end end function HandleTheRendering () addEventHandler("onClientRender",rootElement, dx) end addEventHandler("onClientResourceStart",rootElement, HandleTheRendering) Very Thanks, Gustavo.
  8. Actually, I have to try something else.
  9. Okay, thanks i fixed but not it, this way.
  10. Sorry, I'm still a newbie like would get so my syntax?
  11. My bind not work, can help me ? I press and it seems does not work, I can not find anything wrong someone help me? function terragustavo_MainWindow() local gui = {} gui._placeHolders = {} local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 600, 210 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Sistema de Comandos TERRA # Feito por Gustavo", false) guiWindowSetSizable(gui["_root"], true) bindKey ( "F5", "down", Window ) bindKey ( "F5", "up", Window ) gui["label"] = guiCreateLabel(10, 35, 201, 16, "Comando Para Membros", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label"], "left", false) guiLabelSetVerticalAlign(gui["label"], "center") gui["label_2"] = guiCreateLabel(310, 35, 201, 16, "Comando Para Admnistradores", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_2"], "left", false) guiLabelSetVerticalAlign(gui["label_2"], "center") gui["label_3"] = guiCreateLabel(40, 65, 171, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_3"], "left", false) guiLabelSetVerticalAlign(gui["label_3"], "center") gui["label_4"] = guiCreateLabel(40, 85, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_4"], "left", false) guiLabelSetVerticalAlign(gui["label_4"], "center") gui["label_5"] = guiCreateLabel(40, 105, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_5"], "left", false) guiLabelSetVerticalAlign(gui["label_5"], "center") gui["label_6"] = guiCreateLabel(40, 125, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_6"], "left", false) guiLabelSetVerticalAlign(gui["label_6"], "center") gui["label_7"] = guiCreateLabel(40, 145, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_7"], "left", false) guiLabelSetVerticalAlign(gui["label_7"], "center") gui["label_8"] = guiCreateLabel(350, 145, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_8"], "left", false) guiLabelSetVerticalAlign(gui["label_8"], "center") gui["label_9"] = guiCreateLabel(350, 125, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_9"], "left", false) guiLabelSetVerticalAlign(gui["label_9"], "center") gui["label_10"] = guiCreateLabel(350, 105, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_10"], "left", false) guiLabelSetVerticalAlign(gui["label_10"], "center") gui["label_11"] = guiCreateLabel(350, 85, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_11"], "left", false) guiLabelSetVerticalAlign(gui["label_11"], "center") gui["label_12"] = guiCreateLabel(350, 65, 161, 16, "Digite aqui", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_12"], "left", false) guiLabelSetVerticalAlign(gui["label_12"], "center") gui["label_13"] = guiCreateLabel(10, 167, 571, 31, "Script Feito por Gustavo Acesse nosso forum: ranking.terra.com.br/forum", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_13"], "left", false) guiLabelSetVerticalAlign(gui["label_13"], "center") return gui, windowWidth, windowHeight end addEventHandler ( "onClientResourceStart", resourceRoot, terragustavo_MainWindow )
  12. Oh ok, over the fact that I'm beginner what i should do? sorry
  13. \" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n \" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\" font-size:16pt; color:#e29700;\">Lista da equipe do terra
  14. Para compilar já é outro assunto, se eu não me engano um usuário aqui do fórum mesmo fez um compilador. se não me engano o nome é "Lua Compiler" você pode procurar.
  15. Olha que eu conheço realmente é o ++Notepad mais no instalador, já vem a opção .LUA; então realmente fica complicado.
  16. Você poderia inserir seu sintaxe, assim ajudaria.
  17. Ok sorry for aways topic. I now live in Brazil. but thanked all for help me
  18. Não é porque meu nome é gustavo, que a empresa é minha seja ciente disso
  19. Sem dúvidas que é o melhor.. Usando hospedagem de website grátis e com slogan metade copiado da antiga "DamagedGames". Háa, e eu creio que por eles usa hospedagem com nome grátis não significa que a hospedagem seja grátis. Outra você deve ser um tau de Pedro fanha eu acho que é isso que trabalhava na DamagedGames né? Servidores éram horrivel.
  20. Olá, também existe uma empresa nova por ai. http://gusthost.com.br Os preços também são bem legais, e o espaço é ilimitado. também tem um SERVIDOR DE TEST. mtasa://50.57.112.245:22001 Eu acho que é isso. Não deixa de visitar, bem bacana.
  21. I add the "IpToCountryCompact.csv" in the folder
  22. Hi , jays sorry for afk. http://imageshack.us/photo/my-images/266/74085285.png/ http://imageshack.us/photo/my-images/35/32369923.png/
×
×
  • Create New...