Jump to content

velcan1

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by velcan1

  1. Ok, Ive done what you said, and the text doesnt move anymore up, but, its down the health bar, and I dont know what to change, if I change local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) the bar also goes up etc.
  2. Hi again, I have a big problem that is annoying me in the race mode. What you see in that pic is, that the nametag text goes up when you go far away, and thats the error im being annoying with, I want the nametag text to be over the health bar always, not go far when I move away. This is my script 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-30, sy-40 + offset, sx, sy, tocolor(r,g,b,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,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 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 ) If someone could help me please.
  3. The code is still the same as mine but without tostring() and tonumber().
  4. Even when I put 0 it still doesnt work.
  5. I dont know if thats a joke, but what you did was just remove tostring() and tonumber(), they dont affect anything.
  6. Hi all, Im here to ask for help with a wheel replacement script, Im not sure why it wont work, its suposed to be working fine... local wheelDFFS = { {"wheel_1", 1025}, {"wheel_2", 1073}, {"wheel_3", 1074}, {"wheel_4", 1075}, {"wheel_5", 1076}, {"wheel_6", 1077}, {"wheel_7", 1078}, {"wheel_8", 1079}, {"wheel_9", 1080}, {"wheel_10", 1081}, {"wheel_11", 1082}, {"wheel_12", 1083}, {"wheel_13", 1084}, {"wheel_14", 1085}, {"wheel_15", 1096}, {"wheel_16", 1097}, {"wheel_17", 1098}, } addEventHandler("onClientResourceStart",resourceRoot, function () for index, dff in pairs(wheelDFFS) do local thedff = engineLoadDFF("wheels/".. tostring(dff[1]) ..".dff", tonumber(dff[2])) engineReplaceModel(thedff, tonumber(dff[2])) end local txd = engineLoadTXD("wheels/wheels.txd") engineImportTXD(txd, 1025) end) If someone can help me please.
  7. I just tested it, and it seems to be working now, I guess it didnt work before because the person that died didnt had a weapon in hand.
  8. Hi everyone, I have a question regarding to the gamemode Basemode. Ive seen in many servers that you can pick weapons from the ground from dead players with the key F, when you go over them, it says (Press F to change weapon to), I know that this function is built in the Basemode, but I dont know how to enable it. I hope someone can help me, thanks.
  9. my script addEventHandler( "onPlayerConnect", getRootElement(), function ( _,_,_,_, clientVersion ) if ( clientVersion < 260 ) then cancelEvent( true, "Update your MTA version for 1.0.4!" ); end end ) What is the number for the 1.0.5 client ?
  10. Yes I simply want to replace the texture of the object. has a video tutorial of how to change the objects txd txd replace moldel Att Velcan
  11. you do not understand I want a video tutorial like this to change the skin look: most want a video tutorial for objects Att Velcan
  12. Does anyone have the tutorial on how to edit objects ? Att, Velcan Thanks
  13. velcan1

    Anti-cheat problem

    Yes varez but still kicking myself ;/
  14. velcan1

    SCORE BOARD

    solved the problem mtaserver.config --> thanks
  15. velcan1

    minclientversion

    My serves have version 1.0.3 no work ;/ not working any more suggestions ?
  16. velcan1

    Anti-cheat problem

    not working any more suggestions ?
  17. velcan1

    minclientversion

    ???????????????????????????????????????????????????????????????????????????????
  18. velcan1

    Anti-cheat problem

    some solution??????????????????????????????
  19. velcan1

    minclientversion

    I want only to connect customers 1.0.4 on my server allright ?
×
×
  • Create New...