Jump to content

Pedido de script en lo posible.


xSrTorino

Recommended Posts

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!:D

Link to comment

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

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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...