GTA Közösség - A magyar GTA fórum

Multi Theft Auto (MTA) => MTA: Szerverfejlesztés => Archívum => A témát indította: Scottish - 2014. December 19. - 13:26:13

Cím: Script gombhoz adása
Írta: Scottish - 2014. December 19. - 13:26:13
Hali! Annyi segítségre szorulnék, hogy az alábbi scriptet szeretném rátenni valamelyik billentyű gombra, hogy ne commandos legyen és ki-be lehessen kapcsolni!
 

Client oldal:

 
--client
local sounds = {}
function startSirene ( vehicle )
    local x,y,z = getElementPosition( vehicle )
    local sirene = playSound3D( \"files\\\\siren.mp3\", x, y, z, true)
setSoundVolume(sirene, 0.9)
setSoundMinDistance ( sirene, 90 )
setSoundMaxDistance ( sirene, 150 )
    attachElements ( sirene, vehicle)
    sounds [ vehicle ] = sirene
end
addEvent( \"startSirene\", true )
addEventHandler(\"startSirene\", getRootElement(), startSirene)
function stopSirene( vehicle )
    local sirene = sounds [ vehicle ]
    stopSound ( sirene )
end
addEvent( \"stopSirene\", true )
addEventHandler(\"stopSirene\", getRootElement(), stopSirene)

 
Server oldal:
 
--server
function startSirene( player, cmd )
        local commandant = getPedOccupiedVehicle(player)
        triggerClientEvent ( \"startSirene\", getRootElement(), commandant )
end
addCommandHandler ( \"sirenon\", startSirene)
function stopSirene( player, cmd )
       local commandant = getPedOccupiedVehicle(player)
       triggerClientEvent ( \"stopSirene\", getRootElement(), commandant )
end
addCommandHandler ( \"sirenoff\", stopSirene)
 

 
Válaszotokat előre is köszi!
Cím: Script gombhoz adása
Írta: Robert - 2014. December 19. - 17:07:47
Hello! Ezt a command sort írd bele: https://wiki.multitheftauto.com/wiki/BindKey
Cím: Script gombhoz adása
Írta: Scottish - 2014. December 19. - 17:50:54
Így valahogy?
Client:
 
--client
local sounds = {}
function startSirene ( vehicle )
    local x,y,z = getElementPosition( vehicle )
    local sirene = playSound3D( \"files\\\\siren.mp3\", x, y, z, true)
setSoundVolume(sirene, 0.9)
setSoundMinDistance ( sirene, 90 )
setSoundMaxDistance ( sirene, 150 )
    attachElements ( sirene, vehicle)
    sounds [ vehicle ] = sirene
end
addEvent( \"startSirene\", true )
addEventHandler(\"startSirene\", getRootElement(), startSirene)
function stopSirene( vehicle )
    local sirene = sounds [ vehicle ]
    stopSound ( sirene )
end
addEvent( \"stopSirene\", true )
addEventHandler(\"stopSirene\", getRootElement(), stopSirene)
function bindTheKeys ()
  bindKey ( \"x\", \"down\", startSirene )
  bindKey ( \"x\", \"up\", stopSirene )
end

 
Server:
 
--server
function startSirene( player, cmd )
        local commandant = getPedOccupiedVehicle(player)
        triggerClientEvent ( \"startSirene\", getRootElement(), commandant )
end
addCommandHandler ( \"sirenon\", startSirene)
function stopSirene( player, cmd )
       local commandant = getPedOccupiedVehicle(player)
       triggerClientEvent ( \"stopSirene\", getRootElement(), commandant )
end
addCommandHandler ( \"sirenoff\", stopSirene)
 
function bindTheKeys ( player, commandName )
  bindKey ( player, \"x\", \"down\", startSirene )
  bindKey ( player, \"x\", \"up\", stopSirene )
end
Cím: Script gombhoz adása
Írta: citromhun - 2014. December 31. - 00:47:59
Igen, valahogy úgy.
Cím: Script gombhoz adása
Írta: Toxic - 2015. Január 31. - 10:27:56
[gmod]Elavult, zárom.[/gmod]