Jump to content

D3vZ

Members
  • Posts

    29
  • Joined

  • Last visited

About D3vZ

  • Birthday 29/08/1996

Details

  • Gang
    xTreme-CM
  • Location
    Switzerland

D3vZ's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  1. Peço imensa desculpa pelo Double Poste. Alguém me pode ajudar?
  2. Boa Noite. Estou usando um script de fuel ( https://community.multitheftauto.com/ind ... ils&id=190 ) mas não estou usando o SQL, estou usando a versão que utiliza o XML mas não consigo entender os erros que ele me tem dado 2_ClientFuelGage 1_ServerFuelGage:
  3. Boa Noite, tenho 2 script totalmente iguais o que muda é a posição dos blinkers e a bindkey, mas tenho um problema cada script deles tem 2 blinkers ambos no mesmo carro, e quando activo os dois scripts eles funcionam juntamente, ou seja anula todo o efeito pretendido. Pretendo que um script faça blinkers de piscas para a direita e o outro script para a esquerda, mas quando activo os dois scripts ele funcionam directamente juntos ou seja ficam 4 piscas ligados Têm teclas diferentes não entendo porque funcionam juntos Script 1 - Esquerda: -- Emergency Lights resource by vovo4ka -- please, do not remove copyright local strobo_interval = 10 -- strobo light freq. 10 = 0.5 sec local is_strobo_enabled = false -- enable/disable stroboscopic lights mode -- lamps local flash_interval = 0.5 -- flash freq -- led blink mode local blink_interval = 10 -- blink interval local blink_duration = 1 -- 1..blink_interval -- Node: If vehicleID what you want to change is not present here, you may add it manually -- There are custom lights count and position for each vehicle is available -- What is phase offset. I'm newbie in english and its hard to explain You can read more about on [url=http://en.wikipedia.org/wiki/Phase_(waves]http://en.wikipedia.org/wiki/Phase_(waves[/url]) -- All you need to know about phase_offset: 0 and 10 values will have opposite intensity (i.e. light with 0 will be on and 10 will be off and vice versa) -- -- dont read below, if youre humanities -- -- For each light source there are light intensity calculation performed at each time. -- There are two lights type are available for vehicles: -- 1. -- Usually, light reflector is rotating and light intensity is proportional to visible part of lamp. -- So, light intensity is approximated by simple model: -- intensity(t, i) = 256*sin (t+PhaseOffset_i) -- where t - is model time, i - light source id -- 2. -- For LED blinking there is simpler model: -- blink 2 times at time moment 0 -- -- So, PhaseOffset - is time difference between triggering lights local car_lights_table = { -- vehicle ID, ["mode"]="led" or "lamp" , [i] = { light offset, light color, light size, phase offset (from [0;10]) } -- FBI - RANCHER [490] = {["mode"]="lamp", [1]={["pos"]={-0.9, -2.6, 0}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=6.0}, -- Pisca traseiro PENDURA [2]={["pos"]={-0.9, -2.6, 0}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=6.0}, -- Pisca traseiro PENDURA [3]={["pos"]={-0.9, 2.4, -0.1}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=6.0}, -- pisca frontal PENDURA [4]={["pos"]={-0.9, 2.4, -0.1}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=6.0}, -- pisca frontal PENDURA }, -- since 0.8 there are no default lights position, because only emergency and pre-defined vehicles can use lights --["default"] = {["mode"]="lamp", [1]={["pos"]={0.5, 0, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={-0.5, 0, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}} } -- do not modify -------------------------------------------- local vehicles = {} local timers = {} local base_freq = 50 -- freq of timer for light change ------------------------------------------------------------- function release_vehicle(vehicle) if (isElement(vehicle)) then if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 0) setVehicleLightState ( vehicle, 0, 1 ) setVehicleLightState ( vehicle, 1, 1 ) setVehicleLightState ( vehicle, 2, 1 ) setVehicleLightState ( vehicle, 3, 1 ) end end if (vehicles[vehicle]~=nil) then -- release the markers for key, value in pairs(vehicles[vehicle]["flist"]) do destroyElement (value["m"]) end vehicles[vehicle] = nil end if (timers[vehicle]~=nil) then -- kill the strobo timer killTimer(timers[vehicle]) timers[vehicle] = nil if (isElement(vehicle)) then if (getElementData( vehicle, "emerlights_source")==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 0 ) end end end end function checkForAbility(vehicle) local veh_model = getElementModel ( vehicle ) if (car_lights_table[veh_model]==nil)or(getElementData( vehicle, "emerlights_enabled" )=="false") then return false end return true end function strobo_state_update (vehicle) -- check for valid vehicle if (isElement(vehicle)) then if (vehicles[vehicle]==nil) then -- check for disallowing to use lights -- its enabled by default if (checkForAbility(vehicle)==false) then release_vehicle(vehicle) return end local veh_model = getElementModel ( vehicle ) --if (car_lights_table[veh_model]==nil) then --veh_model = "default" --end local occupant = getVehicleOccupant( vehicle, 0) if (getElementType(occupant)=="player") then -- peds also can use emerlights local src = getPlayerName(occupant) setElementData( vehicle, "emerlights_source", src, false) if (src==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 1 ) end end -- init state variable vehicles[vehicle] = {} vehicles[vehicle]["lstate"] = 0 -- strobo lights state vehicles[vehicle]["fstate"] = 0 -- flash light state vehicles[vehicle]["flist"] = {} -- flash lights list (marker ids) -- create flash lights local mode = car_lights_table[veh_model]["mode"] if (mode==nil) then mode = "lamp" end local coeff = 0 if (mode=="lamp") then coeff = 3.141592654/10.0 else coeff = blink_interval/20.0 end vehicles[vehicle]["fmode"] = mode for light_id, light_desc in pairs(car_lights_table[veh_model]) do if (light_id~="mode") then vehicles[vehicle]["flist"][light_id] = {} vehicles[vehicle]["flist"][light_id]["m"] = createMarker( 0.0001, 0.0001, 0.0001, "corona", light_desc["size"], light_desc["color"][1], light_desc["color"][2], light_desc["color"][3], 100) vehicles[vehicle]["flist"][light_id]["p"] = light_desc["phase"]*coeff attachElements ( vehicles[vehicle]["flist"][light_id]["m"], vehicle, light_desc["pos"][1], light_desc["pos"][2], light_desc["pos"][3] ) end end end -- strobo light if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 2) if (vehicles[vehicle]["lstate"]) then setVehicleLightState ( vehicle, 0, 1 ) setVehicleLightState ( vehicle, 1, 0 ) setVehicleLightState ( vehicle, 2, 0 ) setVehicleLightState ( vehicle, 3, 1 ) else setVehicleLightState ( vehicle, 0, 0 ) setVehicleLightState ( vehicle, 1, 1 ) setVehicleLightState ( vehicle, 2, 1 ) setVehicleLightState ( vehicle, 3, 0 ) end if (vehicles[vehicle]["lstate"]>=strobo_interval*2) then vehicles[vehicle]["lstate"] = 0 else vehicles[vehicle]["lstate"] = vehicles[vehicle]["lstate"] + 1 end end -- flash light if (vehicles[vehicle]["fmode"]=="lamp") then -- lamp mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor( value["m"] ) setMarkerColor(value["m"], R, G, B, (math.sin(tmp_fstate+value["p"])+1.0)*128.0) end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + flash_interval else -- led mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor(value["m"]) -- blinking mode local tmp_val = tmp_fstate+value["p"] if (tmp_val>blink_interval) then tmp_val = tmp_val - blink_interval end if ((tmp_val>=0)and(tmp_val))or((tmp_val>=blink_duration+1)and(tmp_val2+1)) then setMarkerColor(value["m"], R, G, B, 255) else setMarkerColor(value["m"], R, G, B, 0) end end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + 1 if (vehicles[vehicle]["fstate"]>blink_interval) then vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] - blink_interval end end else -- if vehicle is no more exists release_vehicle(vehicle) end end -- not used anymore function stroboLightOn() playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) -- get the player's vehicle --setElementData( playerVehicle, "emerlights_enabled", "true" ) -- debug if ( playerVehicle ) then -- if player is not a driver if (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then --outputChatBox("you're not a driver!") return end setStroboLightsOn(playerVehicle, nil) end end function isStroboLightsOn (vehicle_id) if (timers[vehicle_id]) then return 1 else return 0 end end function setStroboLightsOn(vehicle_id, value) if ( vehicle_id ) then if (value==nil) then if (isStroboLightsOn(vehicle_id)==1) then value = 0 else value = 1 end; end; if (value==0) then if (timers[vehicle_id]) then release_vehicle(vehicle_id) end
  4. Cara me desculpe, realmente tem razão Eu é que tinha mais um gate com o nome "gate1" e ele não deixava que o script funcionasse correctamente Me desculpe cara! Mas obrigado pelo apoio! Vlw! (:
  5. O bindkey não está funcionando, e assim agora não consigo nem abrir nem fechar o portão
  6. @manawydan Desculpe cara o primeiro código funcionou, eu é que me esqueci de dar restart no resource, desculpe! Eu tentei este script para usar bindkey: local gate = createObject(975,-210.39,1148.0999755859,21.10000038147, 0, 0, 179.98345947266 ) local distanciaMax = 6 -- altere o 5 se quiser function open( player ) local x,y,z = getElementPosition(player) local a,b,c = getElementPosition(gate) local distancia = getDistanceBetweenPoints3D(x,y,z,a,b,c) if (distancia <= distanciaMax) then local playerName = getPlayerName( player ) outputChatBox("#FFFFFF* #0066FF"..playerName.." #FFFFFFabre o portão",source,255,0,0,true) moveObject(gate, 6000, -217.5,1148.0999755859,21.10000038147, 0, 0, 0 ) else outputChatBox("Você esta muito longe",player) end end addCommandHandler("abrir", open) function close( player ) local x,y,z = getElementPosition(player) local a,b,c = getElementPosition(gate) local distancia = getDistanceBetweenPoints3D(x,y,z,a,b,c) if (distancia <= distanciaMax) then local playerName = getPlayerName( player ) outputChatBox("#FFFFFF* #0066FF"..playerName.." #FFFFFFfecha o portão",source,255,0,0,true) moveObject(gate, 6000, -210.39,1148.0999755859,21.10000038147, 0, 0, 0 ) else outputChatBox("Você esta muito longe",player) end end addCommandHandler("fechar", close) function thisResourceStart () local players = getElementsByType ( "player" ) for _,this_player in ipairs(players) do bindKey ( this_player, "mouse2", "down", open, close ) end end addEventHandler ("onResourceStart", resourceRoot, thisResourceStart)
  7. Não funcionou, não apresenta erros, mas não fez o que pretendia
  8. Boa Noite Script: local gate = createObject(975,-210.39,1148.0999755859,21.10000038147, 0, 0, 179.98345947266 ) function open( player ) local playerName = getPlayerName( player ) outputChatBox("#FFFFFF* #0066FF"..playerName.." #FFFFFFabre o portão",source,255,0,0,true) moveObject(gate, 6000, -217.5,1148.0999755859,21.10000038147, 0, 0, 0 ) end addCommandHandler("abrir", open) function close( player ) local playerName = getPlayerName( player ) outputChatBox("#FFFFFF* #0066FF"..playerName.." #FFFFFFfecha o portão",source,255,0,0,true) moveObject(gate, 6000, -210.39,1148.0999755859,21.10000038147, 0, 0, 0 ) end addCommandHandler("fechar", close) O que pretendo?: - O portão abrir / fechar com range ou seja só quando estiver perto do portão é que o posso abrir, se estiver longe do portão não conseguirei abrir. - Criar uma bind com o botão direito do MOUSE para abrir/fechar o portão.
  9. Está perfeito! (: Muito obrigado!
  10. Testei mas não funcionou O fadeCamera e o takePlayerMoney não funcionou Erro ( /debugscript 3 ):
  11. Bom Dia people! Eu gostava que me podessem dar uma ajuda no seguinte script: Server: Client: O que pretendo é que o jogador que está sentado no lugar zero (0) ou seja o condutor que desconte 70$ dele quando passa no marker;
  12. D3vZ

    [Help] Engine

    Script fixed! Thanks! Close topic please!
  13. Script funcional e operacional como desejado! Agradeço a ajuda! Obrigado!
×
×
  • Create New...