xSrTorino Posted August 3, 2017 Share Posted August 3, 2017 Hola, este es mi primer port que hago y espero haberlo hecho bien, sólo quería pasar por acá necesitando un poco de ayuda, la cual tengo una duda. ¿Se puede crear un dxDrawText en el cuál diga la información de que un Player mató a otro? Por ejemplo: Player1 mata a Player2, lo cual al Player1 le tendría que salir un mensaje el cual diga "Mataste a Player2 con Minigun, daño hecho 100%" es un ejemplo breve, y que también funcione dentro de los vehículos como Hydra, Hunter, Rustler, Rhino.. etc. espero haberme explicado bien, perdonen las molestias, es que soy nuevo en esto. Desde ya, muchisimas gracias! Link to comment
Rose Posted August 3, 2017 Share Posted August 3, 2017 Si se puede, debes usar los eventos onPlayerWasted o onClientPlayerWasted. Mira ejemplos de la wiki de esos eventos e intenta hacerlo, si no puedes pues pasa el código como lo tienes hecho para ayudarte. Link to comment
Simple0x47 Posted August 3, 2017 Share Posted August 3, 2017 (edited) Te hago el script en un momento. Edited August 3, 2017 by Uknown. Link to comment
aka Blue Posted August 3, 2017 Share Posted August 3, 2017 Toma: Server-side: function player_Wasted ( ammo, attacker, weapon, bodypart ) if attacker and attacker ~= source and getElementType( attacker ) == "player" then triggerClientEvent( root, "actulizarDatos", root, attacker, source ) end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Client-side: local jugadorAsesinado = "" local jugadorAsesino = "" addEvent( "actulizarDatos", true ) addEventHandler( "actualizarDatos", getRootElement( ), function( asesino, asesinado ) jugadorAsesinado = asesinado jugadorAsesino = asesino end ) local screenWidth, screenHeight = guiGetScreenSize( ) addEventHandler( "onClientRender", root, function( ) if jugadorAsesinado ~= "" and jugadorAsesino ~= "" then dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end end ) Las posiciones del dxText ajustalas a tu gusto Link to comment
xSrTorino Posted August 5, 2017 Author Share Posted August 5, 2017 Perdón por la tardanza en responder, no estuve en casa estos días, acabé de intentarlo y no funciona (No sale nada) de todas formas muchas gracias por su tiempo al responder! Link to comment
aka Blue Posted August 5, 2017 Share Posted August 5, 2017 Como lo hice rápido, he cometido un par de errores. Aquí está fixeado: Server function player_Wasted ( ammo, attacker, weapon, bodypart ) if attacker and attacker ~= source and getElementType( attacker ) == "player" then triggerClientEvent( root, "actualizarDatos", root, getPlayerName( attacker ), getPlayerName( source ) ) outputChatBox( "Fuiste asesinado por "..getPlayerName( attacker )..".", source ) end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Client addEvent( "actualizarDatos", true ) addEventHandler( "actualizarDatos", getRootElement( ), function( asesino, asesinado ) jugadorAsesinado = asesinado jugadorAsesino = asesino end ) local screenWidth, screenHeight = guiGetScreenSize( ) local jugadorAsesinado = " " local jugadorAsesino = " " addEventHandler( "onClientRender", root, function( ) if jugadorAsesinado ~= " " and jugadorAsesino ~= " " then dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.5, "default-bold" ) dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) else dxDrawText ( "Todavia no hay nadie asesinado", 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.5, "default-bold" ) dxDrawText ( "Todavia no hay nadie asesinado", 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) end end ) Link to comment
xSrTorino Posted August 5, 2017 Author Share Posted August 5, 2017 hace 9 minutos, también conocido como azul dijo: Como lo hice rápido, he cometido un par de errores. Aquí está fixeado: Servidor Cliente addEvent( "actualizarDatos", true ) addEventHandler( "actualizarDatos", getRootElement( ), function( asesino, asesinado ) jugadorAsesinado = asesinado jugadorAsesino = asesino end ) local screenWidth, screenHeight = guiGetScreenSize( ) local jugadorAsesinado = " " local jugadorAsesino = " " addEventHandler( "onClientRender", root, function( ) if jugadorAsesinado ~= " " and jugadorAsesino ~= " " then dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.5, "default-bold" ) dxDrawText ( jugadorAsesino.." mató a "..jugadorAsesinado, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) else dxDrawText ( "Todavia no hay nadie asesinado", 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.5, "default-bold" ) dxDrawText ( "Todavia no hay nadie asesinado", 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) end end ) Perdón si no fui claro, me refería a que: El mensaje sólo le aparezca al asesino, sólo a él, por ejemplo: "Mataste a Rodas con Minigun" que sea un dxDrawText, que dure un predeterminado tiempo y luego desaparezca. Éste es el único ejemplo que encontré, incluso es de otro server de hecho, (No tengo necesidad de hacer una copia, sólo que me parece un interesante script) Imagen: http://imgur.com/82awmtW Link to comment
aka Blue Posted August 5, 2017 Share Posted August 5, 2017 Server addEventHandler( "onPlayerWasted", getRootElement( ), function( _, attacker, weapon, _ ) if attacker and attacker ~= source then if weapon then triggerClientEvent( attacker, "actualizarDatos", attacker, getPlayerName( source ), getWeaponNameFromID ( weapon ) ) end end end ) Client local screenWidth, screenHeight = guiGetScreenSize( ) local jugadorAsesinado = " " local weaponUsado = " " timer = false addEvent( "actualizarDatos", true ) addEventHandler( "actualizarDatos", getRootElement( ), function( asesino, weaponName ) jugadorAsesinado = asesinado weaponUsado = weaponName if not timer then timer = setTimer( function( ) weaponUsado = " " jugadorAsesinado = " " end, 7000, 1 ) end end ) addEventHandler( "onClientRender", root, function( ) if jugadorAsesinado ~= " " and jugadorAsesino ~= " " then dxDrawText ( "Mataste a "..jugadorAsesinado.." con un/a "..weaponUsado, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.5, "default-bold" ) dxDrawText ( "Mataste a "..jugadorAsesinado.." con un/a "..weaponUsado, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) end end ) 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