-
Posts
461 -
Joined
-
Last visited
Everything posted by Feche1320
-
How can I delete a entire folder with fileDelete? Thanks.
-
But what I need is: test = "hello" outputChatBox(test[1]) -- h outputChatBox(test[2]) -- e outputChatBox(test[3]) -- l outputChatBox(test[4]) -- l outputChatBox(test[5]) -- o Hope you understand me. --EDIT Nevermind, got it, thanks!
-
For example, on C I would do: char test[24] test = "hello" print(test[4]) And if I'm not wrong that will print 'l'. But on lua I tryed that, and seems not to work. How can I do it? Thanks
-
Well, I just used string.gsub, replacing ' with '' and seems to work fine. Ah, I didn't think about it, gonna try, thanks.
-
Hey, I'm saving some info on the SQLite based system from MTA, but when I want to save a word with ' character(EX: Amoxicilin tablet's), it gives me some errors. How can I do to save it without those errors? Thanks BTW is there any onServerShutdown event? So when the server shutdows, I can save all players stats.
-
Meh, I preffer that program. Thanks!
-
Is there any way to edit registry.db? Becouse I have a SQL saving system, and everytime I have to reset all accounts I delete it, but my TT's are gone too.. Thanks PS: I already tried with resourse sqlitebrowser , but it didn't show up anything.
-
Set the window in the center of the screen: local sx, sy = guiGetScreenSize() panel = guiCreateWindow(sx/2-457, sy/2-268, 914, 536, "Extreme Gamers Admin Panel", false) Note: screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2 Thank you!
-
So, with guieditor I made my gui, but when I switched resolution, it 'moved'. So, I tried this: local sx, sy = guiGetScreenSize() panel = guiCreateWindow((1113/1360)*sx,(643/768)*sy,914,536,"Extreme Gamers Admin Panel",false) But it doesn't work. Also I tried this: local sx, sy = guiGetScreenSize() panel = guiCreateWindow(247/2-sx,125/2-sy,914,536,"Extreme Gamers Admin Panel",false) But doesn't wok either, any ideas? Thanks
-
Any way to do this?
-
Yes, I do know that totalPlayers it's a string and it will never work. setElementData works client-side, but it's only for elements, so I have to attach an element to make it work. What I meant, is if on MTA exists setElementDataGlobal or whatever without having to put an element, so client-side I don't have to add handlers and triggers. Hope you understand now.
-
Is there any setElementData global? Like: local count = getPlayerCount() setElementData("totalPlayers", count) Thanks
-
Everytime a maps ends, a maps played counter will increase by one. The way I do it is like this: addEvent("onPostFinish", true) addEventHandler("onPostFinish", g_Root, function() for i, player in ipairs(getElementsByType("player")) do if getElementData(player, "isLogged") == true then local mapsplayed = executeSQLSelect("stats", "mapsplayed", "account = '" ..getElementData(player, "playerAcc").. "'") executeSQLUpdate("stats", "mapsplayed = '" ..(mapsplayed+1).. "'", "account = '" ..getElementData(player, "playerAcc").. "'") end end end ) As you can see, I'm using executeSQLSelect to get the value into a variable, and then executeSQLUpdate to add +1 to the variable, but is there a faster way like just add +1 inside executeSQLUpdate without have to use every time executeSQLSelect and a variable? Something like: addEvent("onPostFinish", true) addEventHandler("onPostFinish", g_Root, function() for i, player in ipairs(getElementsByType("player")) do if getElementData(player, "isLogged") == true then executeSQLUpdate("stats", "mapsplayed = '+1'", "account = '" ..getElementData(player, "playerAcc").. "'") end end end ) Thanks.
-
Ah, nevermind.. got it solved.
-
I did try, but I failed. I just need a little example code, just the little push to start.
-
How can I do a saving system using natives MTA SQL functions? Thanks.
-
So I been like 3 hours trying to make colored name tags using dxDrawColorText, but I fail. function drawNameColor(str, ax, ay, bx, by, color, scale, font, alignx) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local w if s and e and cap and col then local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then w = dxGetTextWidth(cap, scale, font) w = w*1.6 dxDrawText(cap, ax - w, ay, ax - w, by, color, scale, font, alignx) color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) dxDrawText(cap, ax + w, ay, ax, by + w, color, scale, font, alignx) end else dxDrawText(str, ax, ay, bx, by, color, scale, font, alignx) end end That's what I tryied, but it doesn't work.
-
If your gui X = 500 and your gui Y = 600 then do: (1440/1440) = 1440-500 = (940/1440)*sx (900/900) = 900-600 = (300/940)*sy Hope you understand. Or post the script if you don't understand.
-
Well, no, after posting that, I realised that is becouse im clearing it when it finds the map, that's why it was showing only 1. addEventHandler("onClientGUIChanged", SearchMaps, function(element) local mapsearch = guiGetText(element) guiGridListClear(Shop) for i = 0, mapCount do if string.find(tostring(Maps[i]), mapsearch, 1, false) then local row = guiGridListAddRow(Shop) guiGridListSetItemText(Shop, row, 1, tostring(Maps[i]), false, false) end end end ) Changing it to the bottom works, but now I have another problem.. How can I do string.find to be uncase sensitive? HeLLo will be the same as hello. I already tryed changing false to true, but it seems like to be the same.
-
Okay, I managed to create the table with the maps, and they are storing, but I have a problem related to the grid lists.. addEventHandler("onClientGUIChanged", SearchMaps, function(element) local mapsearch = guiGetText(element) for i = 0, mapCount do if string.find(tostring(Maps[i]), mapsearch, 1, true) then guiGridListClear(Shop) local row = guiGridListAddRow(Shop) guiGridListSetItemText(Shop, row, 1, tostring(Maps[i]), false, false) end end end ) So, this is only showing one map.. I know that guiGridListClear(Shop) is causing it.. but I do not know how to solve it. Thanks
-
I have a Race server, with a client panel that allows you to buy maps. What I want to do is a search button, so they can type the server name and find the map more easy. Thanks
-
I used redirectPlayer, thanks all
-
Is there anything like 'reconnectPlayer(source)' to reconnect the player? Thanks