Ernesto Posted March 16, 2018 Share Posted March 16, 2018 Bueno pues mi problema es que cuando hagas una funcion osea uses un comando y haga la funcion queria que salga una imagen pequeñita debajo del nametag pero al hacerlo en mi caso con el cinturon se me pone la imagen ami y a los demas ¿Cual puede ser el error? y gracias CLIENT : Spoiler local fuente = dxCreateFont ( "Lato-Light.ttf", 12 ) local mensaje, tipo local localPlayer = getLocalPlayer( ) local disponible = true function eliminarMensaje( ) timer = setTimer( function ( ) mensaje = " " tipo = nil end, 2000, 1 ) end addCommandHandler( "toggletextos", function( ) if disponible == false then addEventHandler( "onClientRender", root, dibujar_names ) disponible = true else removeEventHandler( "onClientRender", root, dibujar_names ) disponible = false end end ) addEvent( "onChat", true ) addEventHandler( "onChat", getRootElement( ), function( message, type ) if message and type then eliminarMensaje( ) mensaje = message tipo = type end end ) addCommandHandler( "yo", function( ) setElementData( localPlayer, "yo", "Es bastante alto y fuerte | Tatuaje en el cuello de un caballo" ) end ) function dibujar_names( ) local px, py, pz, tx, ty, tz local jugadores = getElementsByType( 'player' ) px, py, pz = getCameraMatrix( ) tx, ty, tz = getElementPosition( localPlayer ) for i=1, #jugadores do local v = jugadores[ i ] setPlayerNametagShowing( v, false ) local r, g, b = getPlayerNametagColor ( v ) local id = getElementData( v, "playerid" ) or nil local staffduty = getElementData( v, "dutystaff" ) local cinturon = getElementData( v, "cinturon" ) local cascos = getElementData( v, "Cascos" ) or 0 if getDistanceBetweenPoints3D( tx, ty, tz, getElementPosition( v ) ) <= 8 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 6 ) local xj, yj, zj = getPedBonePosition( localPlayer, 6 ) local xp, yp = getScreenFromWorldPosition( xj, yj, zj + 0.3 ) local vida = tonumber( getElementHealth( v ) ) local x, y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) if x then -- Dibujado del /yo dxDrawText( tostring( getElementData(v, "yo") or "N/A" ), x, y+20+2, x, y, tocolor(0, 0, 0), 0.65, fuente, "center", "center" ) dxDrawText( tostring( getElementData(v, "yo") or "N/A" ), x, y+20, x, y, tocolor(0, 255, 90), 0.65, fuente, "center", "center" ) if cascos == 1 then dxDrawText( "["..id.."] Desconocido", x, y-7+2, x, y, tocolor(0, 0, 0), 1, fuente, "center", "center" ) dxDrawText( "["..id.."] Desconocido", x, y-7, x, y, tocolor(r, g, b), 1, fuente, "center", "center" ) else if vida >= 50 then dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7+2, x, y, tocolor(0, 0, 0), 1, fuente, "center", "center" ) dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7, x, y, tocolor(r, g, b), 1, fuente, "center", "center" ) end if vida <= 50 then dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7+2, x, y, tocolor(0, 0, 0), 1, fuente, "center", "center" ) dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7, x, y, tocolor(255, 145, 0), 1, fuente, "center", "center" ) end if vida <= 10 then dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7+2, x, y, tocolor(0, 0, 0), 1, fuente, "center", "center" ) dxDrawText( "["..id.."] "..getPlayerName( v ):gsub("_"," "), x, y-7, x, y, tocolor(255, 0, 0), 1, fuente, "center", "center" ) end end if isChatBoxInputActive() and not isTimer( timer ) then dxDrawText( "Hablando o actuando...", xp, yp+43+2, xp, yp, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "Hablando o actuando... ", xp, yp+43, xp, yp, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) end if isConsoleActive() and not isTimer( timer ) then dxDrawText( "Consola abierta...", xp, yp+43+2, xp, yp, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "Consola abierta... ", xp, yp+43, xp, yp, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) end if staffduty == true then dxDrawImage( xp, yp-35, 40, 40, "imagenes/Admin.png" ) end if cinturon == true then dxDrawImage( xp, yp-35, 40, 40, "imagenes/Cinturon.png" ) end if tipo == 0 then dxDrawText( "> "..mensaje, xp, yp+43+2, xp, yp, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "> "..mensaje, xp, yp+43, xp, yp, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) elseif tipo == 1 then dxDrawText( "> "..mensaje, xp, yp+43+2, xp, yp, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "> "..mensaje, xp, yp+43, xp, yp, tocolor(255, 0, 0), 0.7, fuente, "center", "center" ) elseif tipo == 2 then dxDrawText( "* "..mensaje, xp, yp+43+2, xp, yp, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "* "..mensaje, xp, yp+43, xp, yp, tocolor(255, 255, 0), 0.7, fuente, "center", "center" ) else dxDrawText( "", x, y+18, x, y, tocolor(255, 0, 0), 2, fuente, "center", "center" ) end end end end end end addEventHandler( "onClientRender", root, dibujar_names ) -- Texto debajo del radar del /yo local screenWidth, screenHeight = guiGetScreenSize ( ) addEventHandler("onClientRender", root, function() local res = getResourceFromName( "players" ) if res and call( res, "isLoggedIn" ) then local yo = getElementData(localPlayer, "yo") local info = "Características: " .. yo ..". (Usa /yo para quitarlo)" if yo then dxDrawText ( info, 43, screenHeight - 42, screenWidth+1, screenHeight+1, tocolor ( 0, 0, 0, 220 ), 1, "default" ) dxDrawText ( info, 43, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "default" ) end end end ) local screenWidth, screenHeight = guiGetScreenSize ( ) addEventHandler("onClientRender", root, function() local res = getResourceFromName( "players" ) if res and call( res, "isLoggedIn" ) then local yo = getElementData(localPlayer, "yo") local info = "Características: Nada. (Usa /yo para asignar)" if not yo then dxDrawText ( info, 43, screenHeight - 42, screenWidth, screenHeight, tocolor ( 0, 0, 0, 220 ), 1, "default" ) dxDrawText ( info, 43, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "default" ) end end end ) ( En este caso seria staffduty y cinturon ) SERVER : Spoiler addCommandHandler ( "yo", function ( player, commandName, ...) if ( ... ) then local caracteristica = table.concat( { ... }, " " ) setElementData( player, "yo", tostring( caracteristica ) ) exports.sql:query_free( "UPDATE characters SET yo = '%s' WHERE characterID = " .. exports.players:getCharacterID( player ), caracteristica ) outputChatBox ( "Has actualizado tú característica.", player, 255, 255, 255 ) else local borrado = "Nada" setElementData ( player, "yo", borrado ) exports.sql:query_free( "UPDATE characters SET yo = '%s' WHERE characterID = " .. exports.players:getCharacterID( player ), borrado ) outputChatBox ( "Has borrado el '/yo' de tu personaje.", player, 255, 255, 255 ) end end ) META : Spoiler <meta> <script src="client.lua" type="client"/> <script src="server.lua" type="server"/> <file src="Lato-Light.ttf"/> <file src="life-jacket.png"/> <file src="imagenes/Admin.png"/> <file src="imagenes/Helper.png"/> <file src="imagenes/Cinturon.png"/> </meta> ( PD : Gracias Aka Blue Por El Resource ) Link to comment
Enargy, Posted March 16, 2018 Share Posted March 16, 2018 if getDistanceBetweenPoints3D( tx, ty, tz, getElementPosition( v ) ) <= 8 and v ~= localPlayer then 1 Link to comment
Ernesto Posted March 16, 2018 Author Share Posted March 16, 2018 No funcciona 8 minutes ago, Enargy, said: if getDistanceBetweenPoints3D( tx, ty, tz, getElementPosition( v ) ) <= 8 and v ~= localPlayer then No funcciona ¿Otra posible solución? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now