-Rex-

Pequeños aportes

Recommended Posts

Bueno debido a que no puedo ir creando un post para cada script que aporte, Entonces crearé este post donde ire agregando aportes de mi antiguo servidor.

 

Scripts:

Modo de disparo (Cliente):

------------------------------------------------------------------------
--  Desarrollador/Developer: -Rex-
--  Proyecto/Proyect:        Battle of GamerZ
--  Contacto/Contact:        https://www.facebook.com/rexscripting/
--  Fecha de creacion:       xx/xx/2016 No recuerdo el mes Jeje
--
--  Libre uso y modificacion, No borrar los creditos, Gracias
------------------------------------------------------------------------

local maxFiring = 0
local firing = 0
local theMode = 1 
toggleControl ( "fire", true )
setElementData( getLocalPlayer(  ), "weapon_mode", "Auto" )

function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )

	if weapon == 0 then return end
	if weapon == 33 or weapon == 34 then return end
	if theMode == 2 then

		if firing >= maxFiring-1 then
			toggleControl ( "fire", false )
		else
			firing = firing + 1
		end

	elseif theMode == 3 then

		if firing >= maxFiring-1 then
			toggleControl ( "fire", false )
		else
			firing = firing + 1
		end

	else
		toggleControl ( "fire", true )
	end
    
end
-- Add this as a handler so that the function will be triggered every time the local player fires.
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc )

function setMode1( )
	if weapon == 0 then return end
	if weapon == 33 or weapon == 34 then return end
	theMode = 1 
	maxFiring = false
	firing = 0
	toggleControl ( "fire", true )
	setElementData( getLocalPlayer(  ), "weapon_mode", "Auto" )
	outputChatBox( "Modo de disparo: Automatico", 242, 242, 242, true )
end
bindKey( "1", "down", setMode1 )
bindKey( "num_1", "down", setMode1 )

function setMode2( )
	if weapon == 0 then return end
	if weapon == 33 or weapon == 34 then return end
	theMode = 2
	maxFiring = 3
	firing = 0
	toggleControl ( "fire", true )
	setElementData( getLocalPlayer(  ), "weapon_mode", "Rafaga" )
	outputChatBox( "Modo de disparo: Rafaga", 242, 242, 242, true )
end
bindKey( "2", "down", setMode2 )
bindKey( "num_2", "down", setMode2 )

function setMode3( )
	if weapon == 0 then return end
	if weapon == 33 or weapon == 34 then return end
	maxFiring = 1
	theMode = 3
	firing = 0
	toggleControl ( "fire", true )
	setElementData( getLocalPlayer(  ), "weapon_mode", "Semi" )
	outputChatBox( "Modo de disparo: Semiautomatico", 242, 242, 242, true )
end
bindKey( "3", "down", setMode3 )
bindKey( "num_3", "down", setMode3 )

function allow(  )
	local weapon = getPedWeapon( getLocalPlayer(  ) )
	if weapon == 0 then return end
	if weapon == 33 or weapon == 34 then return end
	if theMode == 2 then
		theMode = 2
		maxFiring = 3
		firing = 0
	elseif theMode == 3 then
		maxFiring = 1
		theMode = 3
		firing = 0
	end
	toggleControl ( "fire", true )
end
bindKey( "fire", "down", allow )



local x, y = guiGetScreenSize(  )
local sx, sy = 1280, 600


function ss()
    	local id = getPedWeapon( getLocalPlayer(  ) )
    	if id == 0 then return end
    	local r, g, b = 255, 255, 255
    	local r2, g2, b2 = 255, 255, 255
    	local r3, g3, b3 = 255, 255, 255

    	local mode = getElementData( getLocalPlayer(  ), "weapon_mode" )

    	if mode == "Auto" then
    		r, g, b = 83, 200, 0
    		r2, g2, b2 = 255, 255, 255
    		r3, g3, b3 = 255, 255, 255
    	elseif mode == "Rafaga" then
    		r, g, b = 255, 255, 255
    		r2, g2, b2 = 83, 200, 0
    		r3, g3, b3 = 255, 255, 255
    	elseif mode == "Semi" then
    		r, g, b = 255, 255, 255
    		r2, g2, b2 = 255, 255, 255
    		r3, g3, b3 = 83, 200, 0
    	else
    		r, g, b = 255, 255, 255
    		r2, g2, b2 = 255, 255, 255
    		r3, g3, b3 = 255, 255, 255
    	end

    	local fontS = ( y / 600 ) * 1.0

    	if x < 1024 then
        	fontS = 0.8
    	end
    	
        dxDrawText('Fire mode', ( ( 10 - 1 ) / sx ) * x, ( ( 364 - 1 ) / sy ) * y, ( ( 105 - 1 ) / sx ) * x, ( ( 282 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Fire mode', ( ( 10 + 1 ) / sx ) * x, ( ( 364 - 1 ) / sy ) * y, ( ( 105 + 1 ) / sx ) * x, ( ( 282 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Fire mode', ( ( 10 - 1 ) / sx ) * x, ( ( 364 + 1 ) / sy ) * y, ( ( 105 - 1 ) / sx ) * x, ( ( 282 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Fire mode', ( ( 10 + 1 ) / sx ) * x, ( ( 364 + 1 ) / sy ) * y, ( ( 105 + 1 ) / sx ) * x, ( ( 282 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Fire mode', ( 10 / sx ) * x, ( 364 / sy ) * y, ( 105 / sx ) * x, ( 282 / sy ) * y, tocolor(83, 200, 0, 255), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_1: Auto", ( ( 10 - 1 ) / sx ) * x, ( ( 380 - 1 ) / sy ) * y, ( ( 181 - 1 ) / sx ) * x, ( ( 306 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_1: Auto", ( ( 10 + 1 ) / sx ) * x, ( ( 380 - 1 ) / sy ) * y, ( ( 181 + 1 ) / sx ) * x, ( ( 306 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_1: Auto", ( ( 10 - 1 ) / sx ) * x, ( ( 380 + 1 ) / sy ) * y, ( ( 181 - 1 ) / sx ) * x, ( ( 306 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_1: Auto", ( ( 10 + 1 ) / sx ) * x, ( ( 380 + 1 ) / sy ) * y, ( ( 181 + 1 ) / sx ) * x, ( ( 306 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_1: Auto", ( 10 / sx ) * x, ( 380 / sy ) * y, ( 181 / sx ) * x, ( 306 / sy ) * y, tocolor(r, g, b, 255), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_2: "..'Burst', ( ( 10 - 1 ) / sx ) * x, ( ( 400 - 1 ) / sy ) * y, ( ( 181 - 1 ) / sx ) * x, ( ( 330 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_2: "..'Burst', ( ( 10 + 1 ) / sx ) * x, ( ( 400 - 1 ) / sy ) * y, ( ( 181 + 1 ) / sx ) * x, ( ( 330 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_2: "..'Burst', ( ( 10 - 1 ) / sx ) * x, ( ( 400 + 1 ) / sy ) * y, ( ( 181 - 1 ) / sx ) * x, ( ( 330 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_2: "..'Burst', ( ( 10 + 1 ) / sx ) * x, ( ( 400 + 1 ) / sy ) * y, ( ( 181 + 1 ) / sx ) * x, ( ( 330 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_2: "..'Burst', ( 10 / sx ) * x, ( 400 / sy ) * y, ( 181 / sx ) * x, ( 330 / sy ) * y, tocolor(r2, g2, b2, 255), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_3: Semi-Auto", ( ( 10 - 1 ) / sx ) * x, ( ( 420 - 1 ) / sy ) * y, ( ( 205 - 1 ) / sx ) * x, ( ( 354 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_3: Semi-Auto", ( ( 10 + 1 ) / sx ) * x, ( ( 420 - 1 ) / sy ) * y, ( ( 205 + 1 ) / sx ) * x, ( ( 354 - 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_3: Semi-Auto", ( ( 10 - 1 ) / sx ) * x, ( ( 420 + 1 ) / sy ) * y, ( ( 205 - 1 ) / sx ) * x, ( ( 354 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_3: Semi-Auto", ( ( 10 + 1 ) / sx ) * x, ( ( 420 + 1 ) / sy ) * y, ( ( 205 + 1 ) / sx ) * x, ( ( 354 + 1 ) / sy ) * y, tocolor(5, 5, 5, 21), fontS, "sans", "left", "top", false, false, false, false, false)
        dxDrawText('Press'.." num_3: Semi-Auto", ( 10 / sx ) * x, ( 420 / sy ) * y, ( 205 / sx ) * x, ( 354 / sy ) * y, tocolor(r3, g3, b3, 255), fontS, "sans", "left", "top", false, false, false, false, false)
    end
addEventHandler("onClientRender", root, ss )

if fileExists( "client.lua" ) then
	fileDelete( "client.lua" )
end 

Descripción:

Este idea la copie del Counter Strike, ya que ahi podias cambiar el tipo de disparo, Asi que simple, con las teclas 1, 2, 3 puedes cambiar el tipo de disparo de Automatico a Rafaga y a Semi-Automatico.

Advertencia de Recargar(Cliente):

------------------------------------------------------------------------
--  Desarrollador/Developer: -Rex-
--  Proyecto/Proyect:        Battle of GamerZ
--  Contacto/Contact:        https://www.facebook.com/rexscripting/
--  Fecha de creacion:       xx/xx/2016 No recuerdo el mes Jeje
--
--  Libre uso y modificacion, No borrar los creditos, Gracias
------------------------------------------------------------------------

local idsT = 
{
    [22] = true,
    [23] = true,
    [24] = true,
    [27] = true,
    [28] = true,
    [29] = true,
    [32] = true,
    [30] = true,
    [31] = true,
}
function checkRecargar( )

    local id = getPedWeapon( getLocalPlayer(  ) )

    if idsT[id] == nil then setElementData( getLocalPlayer(  ), "recargar_Hud_status", false ) return end

  	if id then
 
        local maxAmmo = getWeaponProperty( id, "poor", "maximum_clip_ammo")
        local minAmmo = math.floor( maxAmmo / 2 )

        local clip = getPedAmmoInClip ( getLocalPlayer(  ) )

        if clip <= minAmmo then

            setElementData( getLocalPlayer(  ), "recargar_Hud_status", true )
        else
            setElementData( getLocalPlayer(  ), "recargar_Hud_status", false )
        end
    end
end
setTimer( checkRecargar, 500, 0 )

local x, y = guiGetScreenSize(  )
local par = 255
local parS = false
addEventHandler("onClientRender", root,
    function()
        if getElementData( getLocalPlayer(  ), "recargar_Hud_status" ) == true then

            if parS == false then
                if par > 10 then
                    par = par - 10
                else
                    parS = true
                end
            else
                if par < 240 then
                    par = par + 10
                else
                    parS = false
                end
            end

            local texto = dxGetTextWidth( "Recarga!", 1.50, "default-bold" )
            local anc = ( x - texto ) / 2
            dxDrawText("Recarga!", anc, y / 2 , ( 1207 / 1280 ) * x, ( 508 / 600 ) * y, tocolor(178, 18, 18, par), 1.50, "default-bold", "left", "top", false, false, false, false, false)
        end
    end
)


if fileExists( "client.lua" ) then
	fileDelete( "client.lua" )
end 

 

Descripción:

Este sistema lo que hace es que cuando la municion de tu Arma este por la mitad, Salga una advertencia ( El mensaje parpadea ) para que recarges tu arma :v

Edited by -Rex-
Agregado Advertencia de Recargar! :v

Share this post


Link to post

Tomar el control de un Vehiculo, siendo Pasajero:

 


function checkCopilot( player )

	local vehicle = getPedOccupiedVehicle(player)
	
  	--Parte del codigo es de la wiki, Que flojera no? xD
    local occupants = getVehicleOccupants(vehicle) or {}

    for seat, occupant in pairs(occupants) do 

        if (occupant and getElementType(occupant) == "player") then 

        	if not getVehicleController( vehicle ) then

        		warpPedIntoVehicle( player, vehicle, 0 )
            	outputChatBox("Has tomado el control", player)
        
        	end

        end
    end

end

addEventHandler ( "onResourceStart", getResourceRootElement( getThisResource() ),
function (  )
	
	for i,v in ipairs( getElementsByType ("player") ) do
		bindKey( v, "b", "down", checkCopilot )
	end

end )


addEventHandler ( "onPlayerJoin", root,
function (  )
	bindKey( source, "b", "down", checkCopilot )
end )

addCommandHandler("control", checkCopilot )

 

Descripcion:

Es simple, Por ejemplo, El conductor del vehiculo en el que vas ha muerto y vas como pasajero, Presionas 'b' o tecleas /control y automaticamente te conviertes en el conductor.

Share this post


Link to post

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.