Jump to content

dsmatias

Members
  • Posts

    25
  • Joined

  • Last visited

Posts posted by dsmatias

  1. Official Shirt, Equipe DriftShow DS Virtual 
     

    14708290_667174410105407_7733590745742275521_n.jpg?oh=b1fe63494ce18807b27e234090d9461d&oe=5893896B

    Look that! First Fan's Drift Show-Team DS Virtual [Brandão] went straight there Paraiba JP know the Founder of Virtual Team DS [Matias] and Finished winning a shirt Official Team. : ? the #EquipeDSVirtual # MK12

    Very satisfying the love we never think that one day this would happen. Thanks to everyone who somehow likes the work and Admira Drift Show-Team DS Virtual 8) ???

    Stay on top of all the news team: FanPage

  2. 12239663_521917221297794_8471590420282247837_n.png?oh=07394e47b593a2a818fae4cd7644e86b&oe=589709CE

    Essa é uma Equipe Drift Online que foi inspirada pela grande equipe de Drift-Show DS que domina as pistas da vida real e agora virtual. 
    /
    This is a Drift Online team was inspired by the great team Drift Show-DS dominating the tracks of real life and now virtual.

    #EquipeDriftShowVirtual / #EquipeDSVirtual - ??

     

    Server IP:  mtasa://198.50.141.252:22003


    º WebSite Oficial DS: http://driftshowdsvirtual.wix.com/dsvirtual

    ⇨ Channel Oficial DS Virtual: https://goo.gl/i2NZQx
    ⇨ Extensão DS Virtual - Instale:http://goo.gl/gdybTt
    ⇨ Blog Oficial DS: http://goo.gl/LK3C51

    Server MTA Drift
    This server is fully focused on Drift on the server you can find many suitable car to drift.

    On the server is performed campenatos Drift, inspired by the great world of Drift (Formula Drift) Come to the server.

    -

    Total server Drift - Today Today is the best BR Drift MTA. The server contains a maximum of 450MB with the Best Cars, Tracks, Mods and Scripts, Drift Server Lightest MTA BR and with a great connection for you to have a great development on the slopes, most things all exclusive Drift-Show Virtual DS Team - Want to know more about the Server and Team only go straight on their page:  ( Link )

     

    Spoiler

    Equipe DriftShow DS Virtual

    14639620_672151852940996_1735369677149797972_n.jpg?oh=9f16664dfc13cacf4fd5549baff36684&oe=58D43D36

    14639637_669988006490714_4666679684467261275_n.jpg?oh=56e1cf3ceec486f0a14cb31942b55312&oe=588FD04A

    14650295_668752356614279_8611761653238402398_n.jpg?oh=50e1ee02aa447e73d9eafae0573292a7&oe=588B5E7A

     

    Battle

    14671247_659758824180299_4250099087768074760_n.png?oh=189e68abaa80f2aaf4fae3737dc9ed31&oe=5898C977

    14568175_660050560817792_3054567603921954382_n.jpg?oh=616deba843bbb927814f1419044aaf67&oe=588C2CDB

    14721582_661066210716227_7808400023596159180_n.png?oh=2ca6a42df616937ff6335a563426c935&oe=5899D061

    14463030_657315817757933_8022736308627347838_n.jpg?oh=e68a74d90c4f97cbc8d555c6cec6e73e&oe=58926BE2

    =---
     

    Long Beach - FD 

    14470504_657316647757850_347379412907398114_n.jpg?oh=35b1d168ac043c2f3d8528bcbb3db671&oe=589075E9

    14523014_657315794424602_6978167523919822722_n.jpg?oh=2d0a710484207e005e9da8029c9b011d&oe=58CBD2FE

    1 Album Photos <

    2 Camp Drift Long Beach, Photos <

    3 Camp Drift Long Beach, Photos <
    _____

     


    Veja mais vídeos / See more videos:  Channel 

  3. Line 214:                         else

    Line 248:             local model = getElementModel ( vehicle )

    The lines are in this part of the client that sent the top

  4. 8c4d9618b7314325b769c81e89b4b989.png

    Error,  Help?

    Line: 

       if curGear > lastGear then
                                playBlowoffSound(vehicle)
                            end
                            if downgrading then
                                if ( lastRPM < rpm and ( lastGear <= curGear ) ) or lastGear < curGear then
                                    if isTimer ( downgradingTimers[1] ) then killTimer ( downgradingTimers[1] ) end
                                    if isTimer ( downgradingTimers[2] ) then killTimer ( downgradingTimers[2] ) end
                                    downgrading = false
                                end
                                local temprpm = interpolateBetween ( downgradingRPM[1], 0, 0, downgradingRPM[2], 0, 0, downgradingProgress, "Linear" )
                                setSoundSpeed ( sound, temprpm/vehiclesSounds[model].coeff )
                            else
                                setSoundSpeed ( sound, rpm/vehiclesSounds[model].coeff )
                            end
                        end
                        setElementData ( vehicle, "carsound:lastGear", curGear, false )
                        setElementData ( vehicle, "carsound:lastRPM", rpm, false )
                    end
                end
            end
        end
    end
    function playGearSound(vehicle)
        if isElement ( vehicle ) then
            local x,y,z = getElementPosition ( vehicle )
            local px,py,pz = getElementPosition ( localPlayer )
            if getDistanceBetweenPoints3D ( x,y,z, px,py,pz ) < 10 then
                local model = getElementModel ( vehicle )
                local gearSound = playSound3D ( vehiclesSounds[model].gear, x, y, z, false )
                setSoundVolume(gearSound, 2)
                attachElements ( gearSound, vehicle )
            end
        end
    end

     

  5. radioSound = { }
    
    
    
    addEventHandler("onClientResourceStart", resourceRoot,
    
    	function()
    
    		bindKey("r", "down", clientToggleRadio)
    
    		bindKey("mouse_wheel_up", "down", volumeUp)
    
    		bindKey("mouse_wheel_down", "down", volumeDown)
    
    	end
    
    )
    
    
    
    addEventHandler("onClientVehicleEnter", root,
    
    	function(thePlayer, seat)
    
    		if thePlayer == getLocalPlayer() then
    
    			local msg = "Aperte 'R' para ligar a Radio. Bom Jogo #EquipeDSVirtual"
    
    			if radioSound[source] == nil then
    
    				outputChatBox(msg, 124, 252, 0)
    
    			else
    
    				if radioSound[source].soundElement == nil then
    
    					outputChatBox(msg, 124, 252, 0)
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEventHandler("onClientSoundStream", root,
    
    	function(success, length, streamName)
    
    		if streamName then
    
    			local veh = getPedOccupiedVehicle(getLocalPlayer())
    
    			if veh then
    
    				if radioSound[veh] == nil then return end
    
    				if radioSound[veh].soundElement == source then
    
    					outputChatBox("#696969Rádio: #22AA22 " .. streamName, 0, 0, 0, true)
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    addEventHandler("onClientSoundChangedMeta", root,
    
    	function(streamTitle)
    
    		if streamTitle then
    
    			local veh = getPedOccupiedVehicle(getLocalPlayer())
    
    			if veh then
    
    				if radioSound[veh] == nil then return end
    
    				if radioSound[veh].soundElement == source then
    
    					outputChatBox("#696969Música: #AA2222 " .. streamTitle, 0, 0, 0, true)
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEvent("onServerToggleRadio", true)
    
    addEventHandler("onServerToggleRadio", getLocalPlayer(), 
    
    	function(toggle, url, veh, volume)	
    
    		if not isElement(veh) then
    
    			if radioSound[veh] ~= nil then
    
    				stopSound(radioSound[veh].soundElement)
    
    				radioSound[veh].soundElement = nil
    
    			end
    
    			return
    
    		end
    
    		
    
    		if toggle == true then
    
    			local x, y, z = getElementPosition(veh)
    
    			if radioSound[veh] ~= nil then
    
    				stopSound(radioSound[veh].soundElement)
    
    
    
    				local sound = playSound3D(url, x, y, z)
    
    				if volume ~= nil then
    
    					setSoundVolume(sound, volume)
    
    				end
    
    				setSoundMinDistance(sound, 6.0)
    
    				setSoundMaxDistance(sound, 25.0)
    
    				attachElements(sound, veh)
    
    				
    
    				radioSound[veh] = { }
    
    				radioSound[veh].soundElement = sound
    
    			else
    
    				local sound = playSound3D(url, x, y, z)
    
    				if volume ~= nil then
    
    					setSoundVolume(sound, volume)
    
    				end
    
    				setSoundMinDistance(sound, 6.0)
    
    				setSoundMaxDistance(sound, 25.0)
    
    				attachElements(sound, veh)
    
    				
    
    				radioSound[veh] = { }
    
    				radioSound[veh].soundElement = sound
    
    			end
    
    		else
    
    			if radioSound[veh] ~= nil then
    
    				stopSound(radioSound[veh].soundElement)
    
    				radioSound[veh].soundElement = nil
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEvent("onServerRadioURLChange", true)
    
    addEventHandler("onServerRadioURLChange", getLocalPlayer(), 
    
    	function(newurl, veh, volume)
    
    		if radioSound[veh] ~= nil then
    
    			stopSound(radioSound[veh].soundElement)
    
    		
    
    			local x, y, z = getElementPosition(veh)
    
    			local sound = playSound3D(newurl, x, y, z)
    
    			if volume ~= nil then
    
    				setSoundVolume(sound, volume)
    
    			end
    
    			setSoundMinDistance(radioSound, 6.)
    
    			setSoundMaxDistance(radioSound, 25.0)
    
    			attachElements(sound, veh)
    
    		
    
    			radioSound[veh] = { }
    
    			radioSound[veh].soundElement = sound
    
    		end
    
    	end
    
    )
    
    
    
    addEvent("onServerVolumeChangeAccept", true)
    
    addEventHandler("onServerVolumeChangeAccept", getLocalPlayer(), 
    
    	function(veh, newVolume)
    
    		if veh then
    
    			if radioSound[veh] ~= nil then
    
    				setSoundVolume(radioSound[veh].soundElement, newVolume)
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    function clientToggleRadio()
    
    	triggerServerEvent("onPlayerToggleRadio", getLocalPlayer())
    
    end
    
    
    
    function volumeUp()
    
    	local veh = getPedOccupiedVehicle(getLocalPlayer())
    
    	if veh then
    
    		if radioSound[veh] ~= nil then
    
    			local volume = getSoundVolume(radioSound[veh].soundElement)
    
    			if volume ~= false then
    
    				triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, true)
    
    			end
    
    		end
    
    	end
    
    end
    
    
    
    function volumeDown()
    
    	local veh = getPedOccupiedVehicle(getLocalPlayer())
    
    	if veh then
    
    		if radioSound[veh] ~= nil then
    
    			local volume = getSoundVolume(radioSound[veh].soundElement)
    
    			if volume ~= false then
    
    				triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, false)
    
    			end
    
    		end
    
    	end
    
    end
    
    g_VehicleList = {}
    
    
    
    local radioStreams = 0
    
    local defaultRadio = "http://172.82.128.10:19342/Principal"
    
    local defaultRadio = "http://172.82.128.10:19342/Principal"
    
    
    
    addEventHandler("onResourceStart", resourceRoot,
    
    	function()	
    
    		for i,veh in ipairs(getElementsByType("vehicle")) do
    
    			g_VehicleList[veh] = { }
    
    			g_VehicleList[veh].radio = false
    
    			g_VehicleList[veh].radioStation = defaultRadio
    
    			g_VehicleList[veh].volume = 1.0
    
    		end
    
    	end
    
    )
    
    
    
    addEventHandler("onPlayerJoin", root,
    
    	function()		
    
    		for i,veh in ipairs(getElementsByType("vehicle")) do
    
    			if g_VehicleList[veh] ~= nil then
    
    				if g_VehicleList[veh].radio == true then
    
    					triggerClientEvent(source, "onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume)
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEventHandler("onVehicleExplode", root,
    
    	function()
    
    		if g_VehicleList[source] ~= nil then
    
    			if g_VehicleList[source].radio == true then
    
    				triggerClientEvent("onServerToggleRadio", root, false, nil, source)
    
    				g_VehicleList[source].radio = false
    
    				destroyElement(g_VehicleList[source].radioMarker)
    
    				killTimer(g_VehicleList[source].idleTimer)
    
    				if radioStreams ~= 0 then
    
    					radioStreams = radioStreams - 1
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEventHandler("onElementDestroy", root,
    
    	function()
    
    		if g_VehicleList[source] ~= nil then
    
    			if g_VehicleList[source].radio == true then
    
    				triggerClientEvent("onServerToggleRadio", root, false, nil, source)
    
    				g_VehicleList[source].radio = false
    
    				destroyElement(g_VehicleList[source].radioMarker)
    
    				killTimer(g_VehicleList[source].idleTimer)
    
    				if radioStreams ~= 0 then
    
    					radioStreams = radioStreams - 1
    
    				end
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    addEvent("onPlayerToggleRadio", true)
    
    addEventHandler("onPlayerToggleRadio", root,
    
    	function()
    
    		if source and getElementType(source) == "player" then
    
    			toggleRadio(source)
    
    		end
    
    	end
    
    )
    
    
    
    function toggleRadio(player)
    
    	local veh = getPedOccupiedVehicle(player)
    
    	if veh then
    
    		local occupants = getVehicleOccupants(veh)
    
    		local seats = getVehicleMaxPassengers(veh)
    
    		
    
    		local playerSeat = getPedOccupiedVehicleSeat(player)
    
    		if playerSeat ~= 0 and playerSeat ~= 1 then
    
    			outputChatBox("You can't switch the radio.", player, 255, 255, 255)
    
    			return
    
    		end
    
    
    
    		if g_VehicleList[veh] == nil then
    
    			g_VehicleList[veh] = { }
    
    			g_VehicleList[veh].radio = false
    
    			g_VehicleList[veh].radioStation = defaultRadio
    
    			g_VehicleList[veh].volume = 1.0
    
    		end
    
    		
    
    		if g_VehicleList[veh].radio == false then
    
    			if not get("toggleAntifloodTick") or not get("streamLimit") or not get("radioEnabledIdleTime") then return end
    
    
    
    			local settingToggleAntifloodTick = get("toggleAntifloodTick")
    
    			local settingStreamLimit = get("streamLimit")
    
    			local idleTime = get("radioEnabledIdleTime")
    
    			
    
    			if g_VehicleList[veh].lastTick and (getTickCount() - g_VehicleList[veh].lastTick) <= settingToggleAntifloodTick then return end
    
    
    
    			if radioStreams >= settingStreamLimit then
    
    				outputChatBox("The limit of streams has reached (" .. settingStreamLimit .. ")", player, 255, 255, 255)
    
    				return
    
    			end
    
    			
    
    			local x, y, z = getElementPosition(veh)
    
    			g_VehicleList[veh].radio = true
    
    			g_VehicleList[veh].lastTick = getTickCount()
    
    			g_VehicleList[veh].turnedOnBy = getPlayerName(player)
    
    			g_VehicleList[veh].radioMarker = createMarker(x, y, z, "corona", 0.05, 255, 0, 0)
    
    			attachElements(g_VehicleList[veh].radioMarker, veh)
    
    			g_VehicleList[veh].idleTimer = setTimer(radioIdleTimer, idleTime, 0, veh)
    
    			
    
    			radioStreams = radioStreams + 1
    
    			outputServerLog(getPlayerName(player) .. " has turned the radio on in his vehicle (streams: " .. radioStreams .. ")")
    
    
    
    			for seat = 0, seats do
    
    				local occupant = occupants[seat]
    
    				if occupant and getElementType(occupant) == "player" then
    
    					triggerClientEvent("onServerToggleRadio", root, true, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume)
    
    					
    
    					local r, g, b = getPlayerNametagColor(player)
    
    					colorHex = string.format("%02X%02X%02X", r, g, b)
    
    					outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#00ff00ON#696969]", occupant, 0, 0, 0, true)
    
    				end
    
    			end
    
    		else		
    
    			g_VehicleList[veh].radio = false
    
    			destroyElement(g_VehicleList[veh].radioMarker)
    
    			killTimer(g_VehicleList[veh].idleTimer)
    
    			
    
    			radioStreams = radioStreams - 1
    
    			outputServerLog(getPlayerName(player) .. " has turned the radio off in his vehicle (streams: " .. radioStreams .. ")")
    
    			
    
    			for seat = 0, seats do
    
    				local occupant = occupants[seat]
    
    				if occupant and getElementType(occupant) == "player" then
    
    					triggerClientEvent("onServerToggleRadio", root, false, nil, veh, g_VehicleList[veh].volume)
    
    					
    
    					local r, g, b = getPlayerNametagColor(player)
    
    					colorHex = string.format("%02X%02X%02X", r, g, b)
    
    					outputChatBox("#" .. colorHex .. "" .. getPlayerName(player) .. " #696969Rádio: [#ff0000OFF#696969]", occupant, 0, 0, 0, true)
    
    				end
    
    			end
    
    		end
    
    	end
    
    end
    
    
    
    function radioIdleTimer(veh)
    
    	if not get("radioIdlePlayerDistanceCheck") then return end
    
    	local settingDist = get("radioIdlePlayerDistanceCheck")
    
    	
    
    	if veh then		
    
    		if g_VehicleList[veh] ~= nil then
    
    			if g_VehicleList[veh].radio == true then
    
    				local playerInRange = false
    
    
    
    				local vx, vy, vz = getElementPosition(veh)
    
    				for i,player in ipairs(getElementsByType("player")) do
    
    					local px, py, pz = getElementPosition(player)
    
    					local distance = getDistanceBetweenPoints3D(vx, vy, vz, px, py, pz)
    
    					if distance ~= false and distance < settingDist then
    
    						playerInRange = true
    
    					end
    
    				end
    
    				
    
    				if playerInRange == false then
    
    					triggerClientEvent("onServerToggleRadio", root, false, nil, veh)
    
    					g_VehicleList[veh].radio = false
    
    					destroyElement(g_VehicleList[veh].radioMarker)
    
    					killTimer(g_VehicleList[veh].idleTimer)
    
    					if radioStreams ~= 0 then
    
    						radioStreams = radioStreams - 1
    
    					end
    
    				
    
    					outputServerLog("An " .. getVehicleName(veh) .. "'s radio has been idled (streams: " .. radioStreams .. ")")
    
    				end
    
    			end
    
    		end
    
    	end
    
    end
    
    
    
    addEvent("onPlayerRadioVolumeChange", true)
    
    addEventHandler("onPlayerRadioVolumeChange", root,
    
    	function(currentVol, volumeUp)
    
    		local veh = getPedOccupiedVehicle(source)
    
    		if veh then
    
    			local playerSeat = getPedOccupiedVehicleSeat(source)
    
    			if playerSeat == 0 or playerSeat == 1 then
    
    				if volumeUp == true then
    
    					g_VehicleList[veh].volume = currentVol + 0.05
    
    					if g_VehicleList[veh].volume >= 1.00 then
    
    						g_VehicleList[veh].volume = 1.00
    
    					end
    
    				else
    
    					g_VehicleList[veh].volume = currentVol - 0.05
    
    					if g_VehicleList[veh].volume <= 0.00 then
    
    						g_VehicleList[veh].volume = 0.00
    
    					end
    
    				end
    
    				triggerClientEvent("onServerVolumeChangeAccept", root, veh, g_VehicleList[veh].volume)
    
    			end
    
    		end
    
    	end
    
    )
    
    
    
    function cmdChangeRadioURL(source, commandName, url)
    
    	if not url then
    
    		outputChatBox("Usage: /setradio newurl", source, 255, 255, 255)
    
    		return
    
    	end
    
    
    
    	local veh = getPedOccupiedVehicle(source)
    
    	if veh then
    
    		local occupants = getVehicleOccupants(veh)
    
    		local seats = getVehicleMaxPassengers(veh)
    
    		
    
    		if g_VehicleList[veh] == nil then
    
    			local x, y, z = getElementPosition(veh)
    
    			g_VehicleList[veh] = { }
    
    			g_VehicleList[veh].radio = true
    
    			g_VehicleList[veh].lastTick = getTickCount()
    
    			g_VehicleList[veh].radioStation = defaultRadio
    
    			g_VehicleList[veh].volume = 1.0
    
    			g_VehicleList[veh].radioMarker = createMarker(x, y, z, "corona", 0.1, 255, 0, 0)
    
    			attachElements(g_VehicleList[veh].radioMarker, veh)
    
    			g_VehicleList[veh].idleTimer = setTimer(radioIdleTimer, idleTime, 0, veh)
    
    		end
    
    
    
    		local playerSeat = getPedOccupiedVehicleSeat(source)
    
    		if playerSeat ~= 0 and playerSeat ~= 1 then
    
    			outputChatBox("You can't switch the radio station URL.", source, 255, 255, 255)
    
    			return
    
    		end
    
    		
    
    		for seat = 0, seats do
    
    			local occupant = occupants[seat]
    
    			if occupant and getElementType(occupant) == "player" then
    
    				g_VehicleList[veh].radioStation = url
    
    				g_VehicleList[veh].changedBy = getPlayerName(source)
    
    				
    
    				if g_VehicleList[veh].radio == true then
    
    					triggerClientEvent("onServerRadioURLChange", root, g_VehicleList[veh].radioStation, veh, g_VehicleList[veh].volume)
    
    				end
    
    				
    
    				local r, g, b = getPlayerNametagColor(source)
    
    				colorHex = string.format("%02X%02X%02X", r, g, b)
    
    				outputChatBox("#" .. colorHex .. "" .. getPlayerName(source) .. " #FFFFFFhas changed the radio station.", occupant, 0, 0, 0, true)
    
    				outputConsole(getPlayerName(source) .. " has changed the radio station on his vehicle to: " .. url, occupant)
    
    			end
    
    		end
    
    		outputServerLog(getPlayerName(source) .. " has changed the radio station on his vehicle to: " .. url)
    
    	end
    
    end
    
    
    
    function cmdDumpVehRadioInfo(source, commandName)
    
    	for i,veh in ipairs(getElementsByType("vehicle")) do
    
    		if g_VehicleList[veh] ~= nil then
    
    			if g_VehicleList[veh].radio == true then
    
    				local strOut
    
    				if g_VehicleList[veh].changedBy ~= nil then
    
    					strOut = "Vehicle: " .. getVehicleName(veh) .. ", URL = " .. g_VehicleList[veh].radioStation .. ", Turned on by: " .. g_VehicleList[veh].turnedOnBy .. ", URL changed by: " .. g_VehicleList[veh].changedBy
    
    				else
    
    					strOut = "Vehicle: " .. getVehicleName(veh) .. ", URL = " .. g_VehicleList[veh].radioStation .. ", Turned on by: " .. g_VehicleList[veh].turnedOnBy
    
    				end
    
    				
    
    				if getElementType(source) == "console" then
    
    					outputServerLog(strOut)
    
    				elseif getElementType(source) == "player" then
    
    					outputChatBox(strOut, source, 255, 255, 255)
    
    				end
    
    			end
    
    		end
    
    	end
    
    end
    
    
    
    addCommandHandler("setradio", cmdChangeRadioURL)
    
    addCommandHandler("dumpradio", cmdDumpVehRadioInfo)
    
    <meta>
    
    	<info author="EquipeDS" description="Vehicle radio 3D resource" type="script" version="1.2.0" />
    
    	
    
    	<script src="sVehRadio3D.lua" />
    
    	<script src="cVehRadio3D.lua" type="client" />
    
    	
    
    	<settings>
    
    		<setting name="*streamLimit" value="[4]" />
    
    		<setting name="*toggleAntifloodTick" value="[2000]" />
    
    		<setting name="*radioEnabledIdleTime" value="[60000]" />
    
    		<setting name="*radioIdlePlayerDistanceCheck" value="[100.00]" />
    
    	</settings>
    
    </meta>
    

    Can anyone check if you have a problem with my radio?

  6. <meta>
    	<info name="backfire" author="EquipeDS_Matias" version="1.0" type="script" />
    	<script src="backfire_server.lua" type="server"/>
    	<script src="backfire_client.lua" type="client"/>
    	
    	<file src="sound/backfire1.wav" />
    	
    	<file src="backfire_settings.xml" />
    
    </meta>
    
    local fxShowValTest = false
    local curEngine = 0
    
    function getPositionFromElementOffset(element,offX,offY,offZ)
    	local m = getElementMatrix ( element )
    	local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1]
    	local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2]
    	local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3]
    	return x, y, z
    end
    
    function getElementSpeed(element,unit)
    	if (unit == nil) then unit = 0 end
    	if (isElement(element)) then
    		local x,y,z = getElementVelocity(element)
    		if (unit=="mph" or unit==1 or unit =='1') then
    			return (x^2 + y^2 + z^2) ^ 0.5 * 100
    		else
    			return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100
    		end
    	else
    		outputDebugString("Not an element. Can't get speed")
    		return false
    	end
    end
    
    function getVectors(x, y, z, x2, y2, z2)
    	return x - x2, y - y2, z-z2;
    end
    
    function createBackFire(theVeh, scx, scy, scz)
    	local fireChords={}
    	local dist = 0.04
    	for i = 1, 6 do
    		local x, y, z = getPositionFromElementOffset(theVeh,scx,scy-dist,scz)
    		fireChords[i]= {pX = x, pY = y, pZ = z}
    		dist = dist + 0.2
    	end
    	local x,y,z = getPositionFromElementOffset(theVeh,scx,scy,scz)
    	local x2,y2,z2 = getPositionFromElementOffset(theVeh,scx,0,scz)
    	local v1, v2, v3 = getVectors(x,y,z, x2,y2,z2)
    	for i, val in ipairs(fireChords) do
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1+1.5,v2,v3, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1-1.5,v2,v3, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3-0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+1,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+2,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+10,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-10,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-2,v3+0.8, true)
    		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-1,v3+0.8, true)
    	end
    	local s = playSound3D("sound/backfire1.wav", x,y,z, false)
    	setSoundMaxDistance( s, 80 )	
    	setSoundVolume(s, 0.5)	
    end
    
    
    function chandeMonitoringState(state,veh)
    	if (state) then
    		theVehicle = veh
    		addEventHandler ( "onClientPreRender", root, monitorCurEngine )
    	else
    		removeEventHandler ( "onClientPreRender", root, monitorCurEngine )
    		theVehicle=nil
    		theTestVehicle=nil
    	end
    end
    addEvent ( "chandeMonitoringState", true )
    addEventHandler ( "chandeMonitoringState", getRootElement(), chandeMonitoringState)
    
    --[[
    addEventHandler("onClientPlayerVehicleExit",getRootElement(),
    	function(theVeh, seat)
    		if ( seat==0 ) then
    			theVehicle = nil
    			theTestVehicle=nil
    			removeEventHandler ( "onClientPreRender", root, monitorCurEngine )
    		end
    	end
    )
    ]]
    
    addCommandHandler("devm", function(cmd, val)
    	if tonumber(val) == 0 then
    		removeEventHandler ( "onClientPreRender", root, testMode )
    		removeEventHandler("onClientKey", root, playerPressedKey)
    	else
    		theTestVehicle = getPedOccupiedVehicle ( localPlayer )
    		if theTestVehicle then
    			tpx, tpy, tpz = 0, 0, 1
    			if fxShowValTest then
    				--fxShowValTest = false
    				--removeEventHandler ( "onClientPreRender", root, testMode )
    			else
    				fxShowValTest = true
    				addEventHandler ( "onClientPreRender", root, testMode )
    				addEventHandler("onClientKey", root, playerPressedKey)
    			end
    		else
    			outputChatBox("get in vehicle!!!", 255,0,0)
    		end
    	end
    end)
    
    local step = 0.2
    function playerPressedKey(button, press)
    	if button == "arrow_u" or button == "arrow_d" or button == "arrow_r" or button == "arrow_l" then
    		local curstep = step
    		if (press) then
    			if getKeyState( "lalt" ) == true or getKeyState( "ralt" ) == true then curstep=step/2 end
    			if button == "arrow_u" then
    				if getKeyState( "lctrl" ) == true or getKeyState( "rctrl" ) == true then
    					tpy = tpy+curstep
    				else
    					tpz = tpz+curstep
    				end
    			elseif button == "arrow_d" then
    				if getKeyState( "lctrl" ) == true or getKeyState( "rctrl" ) == true then
    					tpy = tpy-curstep
    				else
    					tpz = tpz-curstep
    				end
    			elseif button == "arrow_l" then
    				tpx = tpx-curstep
    			elseif button == "arrow_r" then
    				tpx = tpx+curstep
    			end
    			outputChatBox("x= "..tostring(tpx).." y= "..tostring(tpy).." z= "..tostring(tpz), 255,255,0)
    		end
    	end
    end
    
    function testMode()
    	local x, y, z = getPositionFromElementOffset(theTestVehicle,tpx, tpy, tpz)
    	local x2, y2, z2 = getPositionFromElementOffset(theTestVehicle,tpx, 0, tpz)
    	local v1, v2, v3 = getVectors(x, y, z, x2, y2, z2)
    	fxAddGunshot(x, y, z, v1,v2,v3, true)
    end
    
    local refreshTime = 50 --ms
    local aLastCheck = 0
    
    function monitorCurEngine()
    	if ( getTickCount() >= aLastCheck ) then
    		local cur = tonumber(getVehicleCurrentGear (theVehicle))
    		if ( cur ~= curEngine ) then
    			if (tonumber(getElementSpeed(theVehicle, "kph")) > 5 ) then
    				triggerServerEvent ( "create3DBackfireSound", root, theVehicle)
    				curEngine = cur
    			end
    		end
    		aLastCheck = getTickCount() + refreshTime
    	end
    end
    
    addEvent ( "create3DBackfireSoundClient", true )
    addEventHandler ( "create3DBackfireSoundClient", getRootElement(), createBackFire)
    
    local CarsSettings = {}
    
    function setElementSpeed(element, unit, speed)
    	if (unit == nil) then unit = 0 end
    	if (speed == nil) then speed = 0 end
    	speed = tonumber(speed)
    	local acSpeed = getElementSpeed(element, unit)
    	if (acSpeed~=false) then
    		local diff = speed/acSpeed
    		local x,y,z = getElementVelocity(element)
    		setElementVelocity(element,x*diff,y*diff,z*diff)
    		return true
    	end
     
    	return false
    end
    
    function getElementSpeed(element,unit)
    	if (unit == nil) then unit = 0 end
    	if (isElement(element)) then
    		local x,y,z = getElementVelocity(element)
    		if (unit=="mph" or unit==1 or unit =='1') then
    			return (x^2 + y^2 + z^2) ^ 0.5 * 100
    		else
    			return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100
    		end
    	else
    		outputDebugString("Not an element. Can't get speed")
    		return false
    	end
    end
    
    addEventHandler ( "onResourceStart", resourceRoot,
    	function ( )
    		local StationsFile = xmlLoadFile ( "backfire_settings.xml" )
    		if ( StationsFile ) then
    			outputDebugString ( "backfire_settings.xml successfully open")
    			for _, data in ipairs ( xmlNodeGetChildren ( StationsFile ) ) do
    				local attrs = xmlNodeGetAttributes ( data )
    				CarsSettings[tostring(attrs.name)] = { x = tonumber(attrs.x), y = tonumber(attrs.y), z = tonumber(attrs.z) }
    			end
    		else
    			outputDebugString ( "Failed to open to backfire_settings.xml", 1 )
    		end
    	end
    )
    
    
    
    addEvent ( "create3DBackfireSound", true )
    addEventHandler ( "create3DBackfireSound", root,
    	function ( theVehicle)
    		if ( theVehicle ) then
    			local vehicleName = getVehicleName( theVehicle )
    			if ( type(CarsSettings[vehicleName]) == "table" ) then
    				local x, y, z = tonumber(CarsSettings[vehicleName].x), tonumber(CarsSettings[vehicleName].y), tonumber(CarsSettings[vehicleName].z);
    				triggerClientEvent(root, "create3DBackfireSoundClient", root, theVehicle, x, y, z)
    			end
    		end
    	end
    )
    
    
    function startMonitoring ( thePlayer, seat, jacked )
    	if (seat == 0) then
    		triggerClientEvent(thePlayer, "chandeMonitoringState", thePlayer, true, source)
    	end
    end
    addEventHandler ( "onVehicleEnter", getRootElement(), startMonitoring )
     
    function stopMonitoring ( thePlayer, seat, jacked )
        if (seat == 0) then
    		triggerClientEvent(thePlayer, "chandeMonitoringState", thePlayer, false)
    	end
    end
    addEventHandler ( "onVehicleExit", getRootElement(), stopMonitoring )

     

    The script ta normal functioning, but errors can cause a server problem?

    Matter of giving lag etc ...?

  7. Hello, I have a radar on my server when I'll turn it does not appear, someone help me?

    local screenW,screenH = guiGetScreenSize()
    local resW,resH = 1366,768
    local sW,sH =  (screenW/resW), (screenH/resH)
    
        local turn = true
        local alpha = 255
    	
    addEventHandler( "onClientResourceStart", resourceRoot,
    	function()
    	    setPlayerHudComponentVisible ( "radar", false )
    		--# Create Textures
            hudMaskFX = dxCreateShader("mask.fx")
    		radarTexture = dxCreateTexture("img/map.png")
    		maskTexture = dxCreateTexture("img/radar_mask.png")
    		checkTextures = ( hudMaskFX and radarTexture and maskTexture )
    
    		if not ( checkTextures ) then
    			outputChatBox( "[Arma II DayZ Radar]: Could not create textures. Please use debugscript 3" )
    		else
    			dxSetShaderValue( hudMaskFX, "sPicTexture", radarTexture )
    			dxSetShaderValue( hudMaskFX, "sMaskTexture", maskTexture )
    		end
    	end
    )
    
        function drawRadar()
    		if not ( checkTextures ) then return end
    	        dxSetShaderValue( hudMaskFX, "sMaskTexture", maskTexture )
    		
    		local x,y = getElementPosition( localPlayer )
    		local zoom = 13		
    		    x = ( x ) / 6000
    		    y = ( y ) / -6000
    		dxSetShaderValue( hudMaskFX, "gUVPosition", x,y )
    		dxSetShaderValue( hudMaskFX, "gUVScale", 1/zoom, 1/zoom )
    
            --# Get rotations
    		local _, _, c_Rot = getElementRotation( getCamera());
    		local _, _, p_Rot = getElementRotation( localPlayer )		
    		    dxSetShaderValue( hudMaskFX, "gUVRotAngle", math.rad( -c_Rot ))			
    		
    		if getElementData(getLocalPlayer(),"GPS") >= 1  then
    		setPlayerHudComponentVisible ( "radar", false )
    		--# Alpha
    		--dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW, 9.2*sH, HP_Alpha)		
    		--dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW, 9.2*sH, tocolor(0, 102, 255, 100))
            --dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW, 9.2*sH, tocolor(255, 255, 0, 100))
    		
    		--# Bars
    		--dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW/maxHealth*playerHealth, 9.2*sH, HP_Colour)		
            --dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW/100*playerArmor, 9.2*sH, tocolor(0, 102, 255, 190))
            --dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW/1000*playerOxygen, 9.2*sH, tocolor(255, 255, 0, 190))			 
    		
    		--# Minimap		x,y,w,h 21
           -- dxDrawImage(-6*sW, 500*sH, 300*sW, 250*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255))
    	 dxDrawImage(0*sW, 592*sH, 216*sW, 183*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
            dxDrawImage(0*sW, 598*sH, 197*sW, 125*sH, hudMaskFX, 0,0,0, tocolor(255,255,255,255))
            dxDrawImage(90*sW, 655*sH, 21*sW, 21*sH, "img/radar_player.png", -p_Rot+c_Rot, 0, 0, tocolor(200, 200, 200, 200))
    		end
    
    		--# Wanted
    		local g_wl = getPlayerWantedLevel( localPlayer )
            if ( g_wl > 0 ) then
                if ( turn == true ) then
                    alpha = alpha + 5
                        if ( alpha > 180 ) then
                            alpha = 180
                            turn = false
            end
            elseif ( turn == false ) then
                alpha = alpha - 5
                    if ( alpha < 0 ) then
                        alpha = 0
                        turn = true
                    end
            end
            --dxDrawRectangle(23*sW, 536*sH, 265*sW, 135*sH, tocolor(0, 102, 255, alpha))
            else return end		
    		end
    addEventHandler( "onClientRender", root, drawRadar)
    
    addEventHandler( "onClientResourceStop", resourceRoot,
    	function()
    	    setPlayerHudComponentVisible ( "radar", true )
    	end)

     

  8. Hello, come take a doubt

    Is there any way I use smoke Cropduster or Stuntplane plane in the car? Today the MTA exists only 2 servers that have a Smoke Drift script that are [Drop Club and Paradise MTA] Smoke Paradise: 

    Even have a smoke Drift on my server but is not so good, vídeo my smoke: Link1: https://www.facebook.com/EquipeDriftShowDSVirtual/videos/639481579541357/  Link2: http://driftshow-ds.blogspot.com.br/2016/08/real-smoke-drift-primeiro-servidor-br.html   -  image my smoke:  My smoke  /  image airplane: Cropduster  /  image airplane: Stuntplane

    If you see, the smoke of paradise seems to be the Cropduster or Stuntplane, Anyway, I would like to know if you can put a function to be able to use the smoke from the plane in the car, in this case, the rear wheels.

     

     

×
×
  • Create New...