Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. It is possible. I have already seen that script in TG server.
  2. Hello, I'm wondering how can I get the player who killed me with hunter's projectile? I tried everything but I failed, could someone help me in that? What do I need? Thanks in advance!
  3. Nah, it wasn't that. The problem was: tostring(olddata.playerName), tostring(olddata.timeText), tostring(olddata.playerSerial) to: tostring(v.playerName), tostring(v.timeText), tostring(v.playerSerial)
  4. I made it working. Thank you for trying to help me.
  5. And what it should be? I think it's fine here.
  6. addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring(olddata.playerName) .. ", ".. tostring(olddata.timeText) ..", ".. tostring(olddata.playerSerial) ..".") end end end) Why don't you test it? tostring(olddata.playerName), tostring(olddata.timeText), tostring(olddata.playerSerial) return nil
  7. Hello, I tried to move from SQLite to MySQL, like: addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs">ipairs">ipairs">ipairs">ipairs">ipairs">ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring">tostring">tostring">tostring(olddata.playerName) .. ", ".. tostring">tostring">tostring">tostring">tostring(olddata.timeText) ..", ".. tostring">tostring">tostring(olddata.playerSerial) ..".") --mysql_query(connect_mysql, "INSERT INTO `"..mapname.."` (name, Time, Date, Serail, CTag) VALUES ('"..tostring(olddata.playerName).."', '"..tostring(olddata.timeText).."', '"..Date.."', '"..tostring(olddata.playerSerial).."','CLAN')") end end end) Returns nil I've no idea why. Do you know? EDIT: There's freaky bug in ... addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring(olddata.playerName) .. ", ".. tostring(olddata.timeText) ..", ".. tostring(olddata.playerSerial) ..".") end end end) Thanks in advance
  8. GTX

    3D text

    local x = 2306.7126464844 local y = -3898.6943359375 local z = 236.62010192871 addEventHandler("onClientRender",getRootElement(), function() local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 150 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1/(0.3 * (distance / 150)) dxDrawText ( "3D text", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false ) end end )
  9. GTX

    Stats System

    Why don't you test it?
  10. Hello community! If you want to know why did I wrote this topic, I'll tell you. He (their leader) offered me a free server, then I uploaded my scripts, because he has root access, he entered with his root into directory where my scripts are and he easily downloaded them. Their leader, in-game "GG" has stolen our scripts which were made by DTR scripters for DTR server. He's offering a "free" server. Just to warn you, do not trust that guy. And now they're running our scripts on Dinastia Lusitana server with no worries! I must say, shame on them! I entered to this server, I saw scripts and told him to delete them and he banned me! That's just stupid... Yours sincerely, GTX
  11. Good job! But try to make less loops and make your own ideas
  12. GTX

    Nametags

    nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 50 --Distance to start fading out local NAMETAG_DISTANCE = 120 --Distance until we're gone local NAMETAG_ALPHA = 120 --The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 2 local NAMETAG_WIDTH = 50 local NAMETAG_HEIGHT = 5 local NAMETAG_TEXTSIZE = 0.26 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- -- If 1 then it shows your own nametag, else it will make invisible Testing = 0 -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", g_Root, function() -- Hideous quick fix -- for i,player in ipairs(g_Players) do if player ~= g_Me or Testing == 1 then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametag.create ( player ) end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isPedInVehicle(player) or isPlayerDead(player) then break end local vehicle = getPedOccupiedVehicle(player) local px,py,pz = getElementPosition ( vehicle ) local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) if not sx or not sy then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local r,g,b = 255,255,255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 -- There will be the font name font = "bankgothic" -- As you can see, i'm using bankgothic font dxDrawColorText ( string.gsub(getPlayerNametagText(player),'#%x%x%x%x%x%x',''), sx + 1, sy - offset + 1, sx + 1, sy - offset + 1, tocolor(0,0,0,textalpha), textscale*NAMETAG_TEXTSIZE, font, "center", "bottom", false, false, false ) dxDrawColorText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, font, "center", "bottom", false, false, false ) --We draw three parts to make the healthbar. First the outline/background local drawX = sx - NAMETAG_WIDTH*scale/2 drawY = sy + offset local width,height = NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale dxDrawRectangle ( drawX, drawY, width, height, tocolor(0,0,0,alpha) ) --Next the inner background local health = getElementHealth(vehicle) health = math.max(health - 250, 0)/750 local p = -510*(health^2) local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(r,g,0,0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,0,alpha) ) end break end end end ) ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', g_ResRoot, function() for i,player in ipairs(getElementsByType"player") do if player ~= g_Me or Testing == 1 then nametag.create ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", g_Root, function() if source == g_Me then return end setPlayerNametagShowing ( source, false ) nametag.create ( source ) end ) addEventHandler ( "onClientPlayerQuit", g_Root, function() nametag.destroy ( source ) end ) addEvent ( "onClientScreenFadedOut", true ) addEventHandler ( "onClientScreenFadedOut", g_Root, function() bHideNametags = true end ) addEvent ( "onClientScreenFadedIn", true ) addEventHandler ( "onClientScreenFadedIn", g_Root, function() bHideNametags = false end ) function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) 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 local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w 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) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end
  13. GTX

    adding XML Files

    You'll also need to create XML files https://wiki.multitheftauto.com/wiki/XmlCreateFile
  14. Thank you so much for helping me out! Server runs very fast!
  15. Some scripters may make it for you, but you will have to pay.
  16. You can do that with these: createTeam setPlayerTeam getElementData setElementData
  17. function playerConnect(playerNick, playerIP, playerUsername, playerSerial, playerVersionNumber) outputChatBox("* " .. playerNick .. " has connected the game", getRootElement(), 255, 100, 100, false) end addEventHandler("onPlayerConnect", getRootElement(), playerConnect)
  18. Try this: IPList = { ["31.201.76.*"] = "AD", --A list of table values (about 1300) } function getPlayerCountry(player) theIP = getPlayerIP(player) IP1 = tostring(math.adjust(tonumber(gettok(theIP, 1, 46)))) IP2 = tostring(math.adjust(tonumber(gettok(theIP, 2, 46)))) IP3 = tostring(math.adjust(tonumber(gettok(theIP, 3, 46)))) IP4 = tostring(math.adjust(tonumber(gettok(theIP, 4, 46)))) IP = tonumber(tostring(IP1..IP2..IP3..IP4)) for ip1, ip2 in pairs(IPList) do if ip1 and ip2 then IPStart = tostring(gettok(ip1, 1, 45)) IPEnd = tostring(gettok(ip1, 2, 45)) IPCode = tostring(ip2) if IPStart ~= "" and IPEnd ~= "" and IPCode ~= "" then IPS1 = tostring(math.adjust(tonumber(gettok(IPStart, 1, 46)))) IPS2 = tostring(math.adjust(tonumber(gettok(IPStart, 2, 46)))) IPS3 = tostring(math.adjust(tonumber(gettok(IPStart, 3, 46)))) IPS4 = tostring(math.adjust(tonumber(gettok(IPStart, 4, 46)))) IPE1 = tostring(math.adjust(tonumber(gettok(IPEnd, 1, 46)))) IPE2 = tostring(math.adjust(tonumber(gettok(IPEnd, 2, 46)))) IPE3 = tostring(math.adjust(tonumber(gettok(IPEnd, 3, 46)))) IPE4 = tostring(math.adjust(tonumber(gettok(IPEnd, 4, 46)))) IPS = tonumber(tostring(IPS1..IPS2..IPS3..IPS4)) IPE = tonumber(tostring(IPE1..IPE2..IPE3..IPE4)) if IP >= IPS and IP <= IPE then flag = IPCode end end end end return flag or "N/A" end
  19. GTX

    Got problem...

    Yes, it does! Thank you very much!
×
×
  • Create New...