Jump to content

HELP - ME (PT/BR) BELT SYSTEM


Recommended Posts

function Sistema_de_Cinto_AirNewSCR ( loss )
    local Jogador = getVehicleOccupant ( source )
	if Jogador then
	    if getPlayerName ( Jogador ) ~= "AirNewSCR" then return end
		local vehicle = getPedOccupiedVehicle ( Jogador )
		if vehicle then
			if getVehicleType ( vehicle ) == "Automobile" then
				if Jogador then
	    			if getElementData ( Jogador, "AirNewSCR_Cinto" ) ~= "Sim" then
		    			if Testando == true then
            		        outputChatBox ( ""..tonumber(loss).."", Jogador )
						end
						local Vida_Jogador = getElementHealth ( Jogador )
						local Perca = tonumber(loss) / 2
						setElementHealth ( Jogador, Vida_Jogador - Perca )
						if Testando == true then
						    outputChatBox ( "Vida: "..getElementHealth ( Jogador ), Jogador )
						end
					end
    			end
			end
		end
	end
end
addEventHandler ( "onVehicleDamage", root, Sistema_de_Cinto_AirNewSCR )

 

Preciso de uma Ajuda nesse script para cancelar o DAMAGE quando um Jogador atirar no Veiculo, pois é considerado como Damage, e eu quero bloquear pro jogador que está no carro com cinto de segurança tomar dano quando atirarem no veiculo.

Link to comment
  • Moderators

Como foi mencionado use o evento do lado client, nele você pode detectar se usou arma e cancelar o dano com cancelEvent.

Tente este código:


function Sistema_de_Cinto_AirNewSCR( attacker, weapon, loss )
	local Jogador = getVehicleOccupant ( source )
	if Jogador and weapon and getPlayerName ( Jogador ) == "AirNewSCR" then
		if getVehicleType ( source ) == "Automobile" and getElementData ( Jogador, "AirNewSCR_Cinto" ) ~= "Sim" then
			cancelEvent()
			local Vida_Jogador = getElementHealth ( Jogador )
			local Perca = tonumber(loss) / 2
			outputChatBox ( "Sua vida: "..tostring(Vida_Jogador).."; Perca: "..tonumber(Perca), Jogador )
			setElementHealth ( Jogador, Vida_Jogador - Perca )
		end
	end
end
addEventHandler( "onClientVehicleDamage", root, Sistema_de_Cinto_AirNewSCR )

 

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