-
Posts
1,673 -
Joined
-
Last visited
-
Days Won
6
Everything posted by 0xCiBeR
-
Hola estoy haciendo un sistema de medallas..Todo marcha bien pero las medallas se superponen en el scoreboard..Ya intente achichar las imagenes.. no sirve...Me pasa algo pareceido a lo que le pasaba a hunterix en su sistema de medallas--Aca les dejo la imagen de lo que me pasa(Aclaro esa imagen es de hunterix pero me pasa lo mismo que a el..) Pliss si me indican como lo arreglo..de seguro es algo en el scoreboard..Pero no encuentro que..Gracias
-
Bueno el problema esta que si un player que no es el dueño quiere entrar al vehiculo que tiene dueño, lo deja, cuando deberia no dejarlo y decirle de quien es.. Aca el script: cars={} buycarpickup={} maxcars = 0 addEventHandler ( "onResourceStart", getResourceRootElement(), function () local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"cars",0) if (houseroot) then for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local carmodel = xmlNodeGetAttribute (v,"model") local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") local color1 = xmlNodeGetAttribute (v,"color1") local color2 = xmlNodeGetAttribute (v,"color2") local owner = xmlNodeGetAttribute (v,"owner") local price = xmlNodeGetAttribute (v,"price") local a = xmlNodeGetAttribute (v,"a") cars[i] = createVehicle ( tonumber(carmodel),tonumber(x),tonumber(y),tonumber(z), 0, 0, tonumber(a) ) setElementInterior ( cars[i], 0 ) setElementData (cars[i],"xpos",tonumber(x)) setElementData (cars[i],"ypos",tonumber(y)) setElementData (cars[i],"zpos",tonumber(z)) setElementData (cars[i],"angle",tonumber(a)) setElementData (cars[i],"owner",owner) setElementData (cars[i],"price",tonumber(price)) setElementData (cars[i], "num", i ) setVehicleColor ( cars[i], tonumber(color1), tonumber(color2), 0, 0 ) if getElementData ( cars[i], "owner" ) == "Nobody" then buycarpickup[i] = createPickup ( x, y, z, 3, 1274 ) attachElements ( buycarpickup[i], cars[i], 0, 0, 1.9 ) end maxcars = maxcars+1 end outputDebugString ("Cars loaded!") end end ) function saveCars () local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"cars",0) if (houseroot) then for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local color1, color2, color3, color4 = getVehicleColor ( cars[i] ) xmlNodeSetAttribute ( v, "model", getElementModel(cars[i]) ) xmlNodeSetAttribute ( v, "x", getElementData(cars[i], "xpos") ) xmlNodeSetAttribute ( v, "y", getElementData(cars[i], "ypos") ) xmlNodeSetAttribute ( v, "z", getElementData(cars[i], "zpos") ) xmlNodeSetAttribute ( v, "a", getElementData(cars[i], "angle") ) xmlNodeSetAttribute ( v, "color1", color1 ) xmlNodeSetAttribute ( v, "color2", color2 ) xmlNodeSetAttribute ( v, "owner", getElementData(cars[i], "owner") ) xmlNodeSetAttribute ( v, "price", getElementData(cars[i], "price") ) end xmlSaveFile(root) end end function adminCreateVehicle ( source, cmd ) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"cars",0) local createdcar = xmlCreateChild ( houseroot, "vehicle" ) local carmodel = xmlNodeSetAttribute ( createdcar, "model", "451" ) local x, y, z = getElementPosition ( source ) local xa,ya,a = getElementRotation ( source ) xmlNodeSetAttribute ( createdcar, "x", x ) xmlNodeSetAttribute ( createdcar, "y", y ) xmlNodeSetAttribute ( createdcar, "z", z ) xmlNodeSetAttribute ( createdcar, "a", a ) xmlNodeSetAttribute ( createdcar, "color1", "0" ) xmlNodeSetAttribute ( createdcar, "color2", "0" ) xmlNodeSetAttribute ( createdcar, "owner", "Nobody" ) xmlNodeSetAttribute ( createdcar, "price", "0" ) cars[maxcars+1] = createVehicle ( 451,x,y,z,0,0,a ) setElementData (cars[maxcars+1],"xpos",x) setElementData (cars[maxcars+1],"ypos",y) setElementData (cars[maxcars+1],"zpos",z) setElementData (cars[maxcars+1],"angle", a) setElementData (cars[maxcars+1],"owner","Nobody") setElementData (cars[maxcars+1],"price",0) xmlSaveFile(root) maxcars = maxcars+1 else outputChatBox ("Error: You can't use this command",source, 255,255,127 ) end end addCommandHandler ("acarcreate", adminCreateVehicle) addCommandHandler ("acarsave", saveCars) function getCar ( car ) return cars[car] end addEventHandler ( "onVehicleEnter", getRootElement(), function ( source, seat, jacked ) local playercar = getPedOccupiedVehicle ( source ) if(seat == 0) then if (getElementData ( playercar, "owner" )) then if(getElementData ( playercar, "owner" ) == getAccountName(getPlayerAccount( source ))) then outputChatBox ("It is your car!",source, 255,255,127 ) end elseif (getElementData ( playercar, "owner" ) ~= getAccountName(getPlayerAccount( source ))) then cancelEvent () outputChatBox ("This vehicle owner: "..getElementData ( playercar, "owner" ).."",source, 255,255,127 ) end elseif (getElementData ( playercar, "owner" ) ~= "Nobody" ) then local price = getElementData ( playercar, "price" ) triggerClientEvent ( source, "showBuyCar", source, price) toggleAllControls ( source, false, true, false ) return true end end end) function AcceptToBuyCar ( ) local playercar = getPedOccupiedVehicle ( source ) if(getElementData ( playercar, "owner" ) == "Nobody") then if(getPlayerMoney ( source ) > tonumber(getElementData ( playercar, "price"))) then setElementData ( playercar, "owner", getAccountName(getPlayerAccount( source ))) takePlayerMoney ( source, tonumber(getElementData ( playercar, "price" ))) toggleAllControls ( source, true ) outputChatBox ("You buy this car!", source, 243,149,72 ) destroyElement(buycarpickup[getElementData(playercar,"num")]) saveCars () else outputChatBox ("Error: You don't have enought money", source, 243,149,72 ) setControlState ( source, "enter_exit", true ) end end end addEvent("acceptBuyCar",true) addEventHandler("acceptBuyCar",root,AcceptToBuyCar) Errores: [2013-04-05 14:01:09] SCRIPT ERROR: PDz_autos_test\cars_main.lua:117: ')' expected (to close '(' at line 98) near 'end' [2013-04-05 14:01:09] WARNING: Loading script failed: PDz_autos_test\cars_main.lua:117: ')' expected (to close '(' at line 98) near 'end'
-
Exactly , my images get on top of the other players rank..
-
DOnt know if i should edit the name ur what..I want the rectangle where the name, ping and other things is marked to be bigger so my rank images fit..
-
lol wich part?...Besides that edits the backround rectangle..I need to edit the name Rectangle... ._.
-
nothing usefull there ._.
-
Eso no creo funcionaria, lo que yo quiero es agrandar el rectangulo del nombre...
-
Does anyone know how could i edit the scoreboard default height in each name sow the my images will fit acordingli to the size of the image in this case 30 x 30? Thx
-
Lol ya se, pero he buscado y no encuentro como hacer eso.. Sabrias como se Hace?
-
No es el width lo que quiero definir, es el height
-
Pon ahi todos los vehiculos.. Sino haces un nuevo script donde usas for-loop para obtener todos los autos del server..Le agregas el respawn, y un comando si queres.. Salu2
-
Hola queria saber que parte del scoreboard debo editar para que el cuadrado que se genera donde esta el nombre sea mas grueso, asi me entrarian los ranks en 30 x 30...
-
pues puedes tratar buscando por ese nombre dentro de cada archivo lua
-
el problema ahi es el segundo argumento de la linea 19 Client-Side...Debes poner un argumento valido, como un jugador EJ: "localPlayer" , etc---
-
Asi el server side=? function apagar(player) triggerClientEvent ( "nameoff", player ) end addCommandHandler ( "nameoff", apagar )
-
Agregue esto en el client-side addEvent( "nameoff", true ) addEventHandler( "nameoff", getRootElement(), nametag.destroy ) y esto server-side function apagar(source) triggerClientEvent ( "nameoff", source ) end addCommandHandler ( "nameoff", apagar ) y me sale .. nametags.lua:41 table index is nil
-
No entiendo quiero que con 1 comando muestre mi name tag y con otro lo oculte...
-
Seria asi? Xq no me anda... function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end addCommandHandler ("nameoff", nametag.destroy ) addCommandHandler ("nameon", nametag.create )
-
pues pero si me cambio el nick no serviria..Yo quiero que con un comando se borre mi nametag..
-
lol eso es lo primero que intente..Pero con el script de nametags no funciona xq los nametags en si son dibujados..Eso solo serviria para las nametags basicas del mta...Alguna idea?
-
Hola mi duda es en este script como puedo hacer para ocultarme mi nametag hacia los demas?.. srfont = dxCreateFont("LCD.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 Gracias!