Szerző Téma: Script gombhoz adása  (Megtekintve 842 alkalommal)

Script gombhoz adása
« Dátum: 2014. December 19. - 13:26:13 »
0
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!
« Utoljára szerkesztve: 2014. December 19. - 13:45:40 írta Scottish »

Script gombhoz adása
« Válasz #1 Dátum: 2014. December 19. - 17:07:47 »
0
Hello! Ezt a command sort írd bele: https://wiki.multitheftauto.com/wiki/BindKey

Script gombhoz adása
« Válasz #2 Dátum: 2014. December 19. - 17:50:54 »
0
Í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

Script gombhoz adása
« Válasz #3 Dátum: 2014. December 31. - 00:47:59 »
0
Igen, valahogy úgy.

Nem elérhető Toxic

  • 798
  • #elfújalágyszellő
    • Profil megtekintése
Script gombhoz adása
« Válasz #4 Dátum: 2015. Január 31. - 10:27:56 »
0
[gmod]Elavult, zárom.[/gmod]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal