Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    dbPoll?

    Then how shall I do it?
  2. GTX

    dbPoll?

    No... Look, I've got a problem in returning a table... For example: I've got 2 rows and I select them with query. Then when I want to use exports.mysql:poll, this returns only 1 row, but it must return 2 rows. Row #1: abc Row #2: def outputChatBox(result["id"]) --> def Is it possible to return 2 times?...
  3. GTX

    dbPoll?

    I don't want to do a loop in a script, I want to do it in the mysql script already.
  4. GTX

    dbPoll?

    I don't want to send it directly. Currently, I am getting values like: local result, affected = exports.mysql:poll(query) outputChatBox(result["id"]) I don't want to change the whole gamemode for that...
  5. GTX

    dbPoll?

    Hello, I'm making a 'custom' poll function. I have problem with return thingy... So, code looks like: function poll(resultid) local result, num_affected_rows, errmsg = dbPoll(resultPool[resultid], -1) if not result then outputDebugString("Error: "..errmsg) return false end local resulta = {} for result, row in pairs(result) do for column, value in pairs(row) do resulta[column] = value end end return resulta, num_affected_rows end Everything is fine. But now, here comes the problem. It returns only 1 row. So, my query looks like that: local query = exports.mysql:query("SELECT * FROM characters WHERE account='"..accID.."'") This query selects 2 rows. But when I use dbPoll, it returns only 1! I want it to return ALL selected rows. Thanks in advance.
  6. --adminsOnly addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..acc, aclGetGroup( "Admin" ) ) then triggerClientEvent(source, "GUI", source) else outputChatBox("You are not an admin", source) end end )
  7. GTX

    dbConnect error!

    Oh lol. I forgot to put "host=". I'm so dumb. Thanks!
  8. GTX

    dbConnect error!

    Hello. I'm really out of ideas! What's this error? ERROR: mysql/s_connect.lua:6: dbConnect failed; Can't connect to local MySQL server through socket '' (111) If I put unix_socket, this comes out; ERROR: mysql/s_connect.lua:6: dbConnect failed; Can't connect to local MySQL server through socket '/usr/lib32/libmysqlclient.so.15/' (20) Script: local hostname = "127.0.0.1" local database = "mg" local username = "db_user" local password = "db_user123@" local mysql = dbConnect("mysql", "dbname="..database..";"..hostname, username, password) if mysql then outputChatBox("MySQL has been successfuly connected!", root, 255, 255, 255, true) end Thanks in advance.
  9. I fixed it. The problem was in my client-side code. Thanks for trying to help me!
  10. Hello. I'm trying to send a long string with triggerLatentClientEvent, but the other side doesn't recieve it. I realized that, when I use triggerLatentClientEvent once, I can't use triggerClientEvent any more. How did I test: Resource1: - Server function co(a, b) string = "very long string... I won't post it." triggerLatentClientEvent(a, "startThis", 50000, false, root, string) end addCommandHandler("fny", co) Resource2: - Client function co2(string) outputChatBox"asd" -- It did not output that. -- Do the magic here. end addEvent("startThis", true) addEventHandler("startThis", root, co2) After I realized it did not work, I tried with triggerClientEvent and that did NOT work also. When I rebooted the VPS, triggerClientEvent worked. But when I used triggerLatentClientEvent again, both didn't work. Weird... I am using Linux, Debian 6.0 - 64bit. Is my VPS messed up, am I doing something wrong or is MTA/function bugged? Thanks in advance.
  11. GTX

    Help - x,y - DX

    guiGetScreenSize() -- Look at "Using guiGetScreenSize to fit GUI & DX drawing in all resolutions"
  12. Hello, I'd like to rebind the 't' key (/say), but I am having some problems. Here's how far I came: roomName = "Room" addEventHandler("onPlayerJoin", root, function() bindKey(source,"t","down","chatbox",roomName) end ) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() for index, player in pairs(getElementsByType"player") do bindKey(player,"t","down","chatbox",roomName) end end ) function onRoomChat(player,_,...) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = 255, 255, 255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end if string.sub(msg, 1, 1) == "/" then executeCommandHandler(string.sub(msg, 2, string.len(msg)), player, msg) return end for _,v in ipairs(getElementsByType("player")) do if getElementData(v, "roomID") == getElementData(player, "roomID") then outputChatBox("#ffffff"..RGBToHex(r, g, b)..nick..": #ffffff"..msg,v,r,g,b,true) end end end addCommandHandler(roomName,onRoomChat) Okay. My problem is: When I'm trying to execute a command (like saying /logout in chatbox) it just doesn't. But it works perfectly on non-hardcored commands. Any idea? Thanks in advance.
  13. Try this: function mod() txd = engineLoadTXD("infernus.txd") engineImportTXD(txd, 411) dff = engineLoadDFF("infernus.dff", 411 ) engineReplaceModel(dff, 411) end addEventHandler("onClientMapStarting",getResourceRootElement(getThisResource()), mod) addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), mod) Also check if these files exist and they're in meta.
  14. Did you download it from community? If so, try to download newest resources (http://code.google.com/p/mtasa-resource ... p&can=2&q=) and search for stealth gamemode.
  15. Why don't you use fetchRemote?
  16. Try: local showMyIcon = true local chattingPlayers = {} local drawDistance = 1000 local transicon = false local chatIconFor = {} local screenSizex, screenSizey = guiGetScreenSize() local guix = screenSizex * 0.1 local guiy = screenSizex * 0.1 local globalscale = 1 local globalalpha = .85 addEvent("updateChatList", true ) gChatting = false function chatCheckPulse() local chatState = isChatBoxInputActive() or isConsoleActive() if chatState ~= gChatting then if chatState then triggerServerEvent("playerChatting", getLocalPlayer()) else triggerServerEvent("playerNotChatting", getLocalPlayer()) end gChatting = chatState end setTimer( chatCheckPulse, 250, 1) end function showTextIcon() local playerx,playery,playerz = getElementPosition ( getLocalPlayer() ) for player, truth in pairs(chattingPlayers) do if (player == getLocalPlayer()) then if(not showMyIcon) then return end end if(truth) then local chatx, chaty, chatz = getElementPosition( player ) if(isPlayerInVehicle(player)) then chatz = chatz + .5 end local dist = getDistanceBetweenPoints3D ( playerx, playery, playerz, chatx, chaty, chatz ) if dist < drawDistance then if( isLineOfSightClear(playerx, playery, playerz, chatx, chaty, chatz, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( chatx, chaty, chatz+1.2 ) local scaled = screenSizex * (1/(2*(dist+5))) *.85 local relx, rely = scaled * globalscale, scaled * globalscale -- -.0025 * dist+.125 --if(dist < 1) then -- relx, rely = guix, guiy --end guiSetAlpha(chatIconFor[player], globalalpha) guiSetSize(chatIconFor[player], relx, rely, false) if screenX and screenY then guiSetPosition(chatIconFor[player], screenX, screenY, false) else guiSetVisible(chatIconFor[player], false) end if(screenX and screenY) then guiSetVisible(chatIconFor[player], true) end end end end end end function updateList(newEntry, newStatus) chattingPlayers[newEntry] = newStatus if(not chatIconFor[newEntry]) then chatIconFor[newEntry] = guiCreateStaticImage(0, 0, guix, guiy, "chat.png", false ) end guiSetVisible(chatIconFor[newEntry], false) end function toggleIcon() outputChatBox ( "Your icon is: " ) if( showMyIcon ) then showMyIcon = false outputChatBox ( "off", 255, 0, 0) else showMyIcon = true outputChatBox ( "on", 0, 255, 0) end end function resizeIcon( command, newSize ) if(newSize) then local resize = tonumber( newSize ) local percent = resize/100 globalscale = percent end outputChatBox("Chat icons are "..(globalscale * 100).."% normal size") end function setIconAlpha( command, newSize ) if(newSize) then globalalpha = tonumber( newSize ) / 100 end outputChatBox("Chat icons are "..(globalalpha * 100).."% visible") end addEventHandler ( "updateChatList", getRootElement(), updateList ) addEventHandler ( "onClientResourceStart", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientPlayerJoin", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientRender", getRootElement(), showTextIcon ) addCommandHandler( "toggleicon", toggleIcon) addCommandHandler( "resizeicon", resizeIcon) addCommandHandler( "seticonvis", setIconAlpha)
  17. GTX

    MTA PHP SDK 0.4?

    Hi, I need PHP SDK 0.4, does someone have it? I really need it. Thanks in advance!
  18. By bugged, I mean some objects are unsynced for some players. Like glass is broken for someone, for other not.
  19. Hello there! I want to re-create mapmanager of Race resource. So, where should I create objects? Client side or server side? If I put it on server-side, it would "kill" the server and simply lag it (if there are too many objects). If I put it on client-side, some objects would be "bugged" somehow. So, what should I do? Thanks in advance!
  20. Thanks! But how do I check if chatbox outputs a resource? And if this resource is a map?
  21. exports.admin:getPlayerCountry(player)
  22. All you have to do is calculate positions: Clock: 28/800 = 0.035 560/600 = 0.933 10/800 = 0.0125 10/600 = 0.0166 local x, y = guiGetScreenSize() dxDrawText(hours..":"..minutes,x*0.035,y*0.933,x*0.0125,y*0.0166,tocolor(255,255,255,255),0.5,Digital) Do the same for others.
  23. guiGetScreenSize -- Check out: Using guiGetScreenSize to fit GUI & DX drawing in all resolutions
×
×
  • Create New...