Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    Need help

    Hello guys. I know it sounds funny but I need days to seconds converter. I'm not so good in maths... Thanks in advance...
  2. GTX

    TopTimes

    We will not make it for you. Make it by yourself and post code if you have problem. viewtopic.php?f=91&t=42372#p430214
  3. We will not make it for you. Make script by yourself and if you have problem, post code here.
  4. GTX

    getZoneName()

    And what's the problem?
  5. GTX

    carfade issue

    Well, you can use getElementAlpha. Like: 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.7 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- 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 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 dxDrawText ( getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,getElementAlpha(player) or textalpha), textscale*NAMETAG_TEXTSIZE, "default", "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,getElementAlpha(player) or 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*getElementAlpha(player) or 0.4*alpha) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(r,g,0,getElementAlpha(player) or 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 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 )
  6. A. Gonna **** my girlfriend Q. What about you?
  7. GTX

    MySQL bug?!

    Tried. Still doesn't work. By the way, script is working fine on other maps but doesn't work on that one.
  8. GTX

    MySQL bug?!

    No. My MySQL handler looks like this: connect_mysql = mysql_connect(host, user, password, database, 3306, "/var/run/mysqld/mysqld.sock") And yes, MySQL seems to be setted up correctly.
  9. GTX

    MySQL bug?!

    Hmmm? That's not my problem. That topic you posted is talking on how to make SQL scripts work. I have this problem: Error executing the query: (1103) Incorrect table name '[DM]Ffgg -Vol3- The enc '
  10. GTX

    MySQL bug?!

    Race. (DD/DM)
  11. GTX

    MySQL bug?!

    Hello, I found problem/bug on my script, which I can't fix... I think this is MySQL bug. I have latest MySQL version. Debug: Error executing the query: (1103) Incorrect table name '[DM]Ffgg -Vol3- The enc ' My script looks like this: result = mysql_query(connect_mysql, "CREATE TABLE IF NOT EXISTS `"..mapname.."` (name VARCHAR(70),time TEXT,date TEXT,serial VARCHAR(100),tag VARCHAR(100))")
  12. GTX

    Returns nil... Why?

    Hmm, I think mysql_fetch_assoc is returning nil but I don't know why.
  13. GTX

    Returns nil... Why?

    Where should I run query? At the web? If so: http://shrani.si/f/S/FX/2smLn8LW/2012-04-101540.png if at the server, it returns same as before (nil).
  14. GTX

    Returns nil... Why?

    Still 0. Nothing is missing: http://shrani.si/f/13/8/vWU33cV/2012-04-101532.png
  15. GTX

    Returns nil... Why?

    "name" is column. I want to get rows and if row matches server name, function CONNECT activates, else WRONG activates.
  16. GTX

    Returns nil... Why?

    Which table? row?
×
×
  • Create New...