Jump to content

Reacer

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Reacer

  1. Reacer

    Nametag script

    Yes but this is so strange, it replaces itself on my pc!!! when i replace the images for the countdown 3,2,1,go and i start the server.. old images just get replaced how is that possible? Please help me, my mta has selfcontrol.. and yes i save it all!! The upperone you can see that i replaced the countdown_1,2,3,0 under i started my server and it replaced themself??????
  2. Reacer

    Nametag script

    this is the download: https://community.multitheftauto.com/ind ... ls&id=3480
  3. Reacer

    Nametag script

    i don't understand how to turn off, look nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false When i set "local bHideNametags = false" to "local bHideNametags = TRUE" it will automaticly change back to false when i start my server....
  4. Reacer

    Nametag script

    That script works!, but my problem is that the original mta names are still there.. i've found in resource cache a document called nametags.lua i guess it's the original file for mta. but when i make changes in that lua document and save it and then start my server, it will restore itself how it was before, so for example i set False to True, it changes itself to False again when i started the server
  5. Reacer

    Nametag script

    Where is the document for the names in mta?
  6. Reacer

    Nametag script

    No it didn't work, doesn't do anything now.. But the script was working! but my problem was that original mta names where visible and these from the script. i only want these from the script, I should set something on false in the original document?
  7. Reacer

    Nametag script

    srfont = dxCreateFont("bhz.ttf",13) g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Players = getElementsByType('player') g_Me = getLocalPlayer() 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 = 100 --Distance until we're gone local NAMETAG_ALPHA = 255 --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.3 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 isElement(player) then if player ~= g_Me then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametag.create ( player ) end end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementDimension(player) ~= getElementDimension(g_Me) then break end local px,py,pz = getElementPosition ( player ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end 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 = getPlayerNametagColor(player) local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 local w = dxGetTextWidth(getPlayerNameR(player), textscale * NAMETAG_TEXTSIZE, srfont) / 2 dxDrawText ( getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false ) dxDrawColorText ( getPlayerName(player), sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false ) 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,50) ) --Next the inner background local health local p local r,g health = getElementHealth ( player ) health = math.max(health, 0)/100 p = -510*(health^2) r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) if health > 1.0 then health = 1.0 end dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(0,0,0,50) ) --Finally, the actual health dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(0,100,255,100) ) 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 ) -- Math functions function math.lerp(from,to,alpha) return from + (to-from) * alpha end -- curve is { {x1, y1}, {x2, y2}, {x3, y3} ... } function math.evalCurve( curve, input ) -- First value if input[1][1] then return curve[1][2] end -- Interp value for idx=2,#curve do if input[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] -- Find pos between input points local alpha = (input - x1)/(x2 - x1); -- Map to output points return math.lerp(y1,y2,alpha) end end -- Last value return curve[#curve][2] end function removeColorCoding ( name ) return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name end function getPlayerNameR ( player ) return removeColorCoding ( getPlayerName ( player ) ) end function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 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,alignX,alignY,clip, wordBreak, postGUI) end end So when i'm ingame original nametag will show and this version, 1 nametag is enough
  8. Hi, I've just downloaded a script for colored names above your car. But you have the standard nametags.lua to, so when i come ingame you see your name 2 times(the original and the scripted one).. I've tried to change the nametags.lua for the new one but the nametag.lua reacreats itself every time. Can't find any1 else who has this problem.. Please tell me which part of the original script i have to change/remove.
  9. I mean, When my server was online I was editing the ACL but i didn't SAVED it yet. i guess when u don't save while running, nothing happens yet.. then i stopped the server and saved ACL after that i started the server again!
  10. Oke, I'm going to try that tommorow. But i don't understand what is making the difference? I didn't saved the acl.xml while server was running..
  11. Yes, I made the edit while the server was running and then I restarted the server.
  12. look, for example i took tis part: Resources tab is set to "false" but you can go in the resources tab
  13. Hello I have my own server with score systems etc.. but i was the only admin there. Now i want to make other guys from my team moderator(less rights), but don't want to give them all rights. I know (becuase i'm mod in skc) that you can give just a few rights to some player. how can i do that? I've looked in the admin panel and in the script ACL.xml under here you can see the part I've tried to do in the script.. ...........<---here is the one I'm trying to add as a moderator, in .....................admin panel it looks fine becuase he is in the ......... moderator group there. But he has all the rights. ....................<-- Here i made myself Admin which is oke.
  14. Testing ports... Port 22126 UDP is open. Port 22003 UDP is open. Port 22005 TCP is open.
  15. Business guys deathmatch 22003 32 1 22005 Part of the script which is okay to i guess..
  16. Thanks for your reply, but look at the image.. It's the setup.
  17. Hello all, i've been trying to make an server just a practice server for my team.. I had some servers in another game before so I know about portforwarding, that is what i did. When i write in the server "openports" it says they're closed. look at the following log file =========================================================== = Multi Theft Auto: San Andreas v1.2 =========================================================== = Server name : Business guys deathmatch = Server IP address: = Server port : 22003 = = Log file : .. 1.2/server/mods/deathmatch/logs/server.log = Maximum players : 32 = HTTP port : 22005 = Voice Chat : Disabled =========================================================== [2012-01-12 20:58:20] Resources: 186 loaded, 0 failed [2012-01-12 20:58:20] Querying game-monitor.com master server... success! [2012-01-12 20:58:20] Querying backup master server... success! [2012-01-12 20:58:20] Starting resources.................. [2012-01-12 20:58:22] Server started and is ready to accept connections! [2012-01-12 20:58:22] Type 'help' for a list of commands. Testing ports... Port 22126 UDP is closed. Players can not browse! Port 22003 UDP is closed. Players can not join! Port 22005 TCP is closed. Players can not download! As i told before, I did portforwarding 192.168.0.189, UDP. 22124-22127 192.168.0.189, UDP+TCP. 22002-22005 I'm sure some of you can help me Thanks, greetz Reacer
×
×
  • Create New...