Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2013-08-25, 18:38


mrmay4141

KOR Gaming Innovator






Wiek: 28
Na forum: 4860 dni
Posty: 86
Nick w MP: Sexyvise

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Witam, ?ci?gn??em skrypt z zak?adki "Poradniki" i jest w nim jaki? problem.
Prosze o wykrycie i wys??nie gotowego ni?ej.

Kod:


SWIATLA

local root = getRootElement ()
local thisResourceRoot = getResourceRootElement(getThisResource())

function thisResourceStart ()
local players = getElementsByType ( "player" )
for k,v in ipairs(players) do
bindKey ( v, "l", "down", toggleVehicleLights, "Swiatla ON/OFF" )
end
end

function playerJoin ()
outputChatBox ( "Wcisnij L aby wlaczyc lub wylaczyc swiatla", source )
bindKey ( source, "l", "down", toggleVehicleLights, "Swiatla ON/OFF" )
end

addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart )
addEventHandler ( "onPlayerJoin", root, playerJoin )

function toggleVehicleLights ( player, key, state )
if ( getPlayerOccupiedVehicleSeat ( player ) == 0 ) then
local veh = getPlayerOccupiedVehicle ( player )
if ( getVehicleOverrideLights ( veh ) ~= 2 ) then
setVehicleOverrideLights ( veh, 2 )
else
setVehicleOverrideLights ( veh, 1 )
end
end
end



SILNIK

function engineOffOn(source)
if isPedInVehicle(source) then
local sourceVehicle = getPedOccupiedVehicle( source )
if getVehicleEngineState ( sourceVehicle ) then
setVehicleEngineState ( sourceVehicle, false )
else
setVehicleEngineState ( sourceVehicle, true )
end
end
end

function changeLightsState(source)
if isPedInVehicle(source) then
local sourceVehicle = getPedOccupiedVehicle( player )
if getVehicleOverrideLights ( sourceVehicle ) ~= 2 then
setVehicleOverrideLights( sourceVehicle, 2 )
else
setVehicleOverrideLights( sourceVehicle, 1 )
end
end
end

addEventHandler ( "onPlayerVehicleEnter",root,function( theVehicle, driver, jackerPlayer )
if driver == 0 and not jackerPlayer then
setVehicleEngineState ( theVehicle, true )
end
end)
addEventHandler ( "onPlayerVehicleExit",root,function( theVehicle, driver, jackerPlayer )
if driver == 0 and not jackerPlayer then
setVehicleEngineState ( theVehicle, false )
setVehicleOverrideLights ( theVehicle, 1 )
end
end)

addEventHandler ( "onResourceStart",resourceRoot,function()
if res~= getThisResource() then return end
local engineKey = get("@jengine.engineKey")
local lightsKey = get("@jengine.lightsKey")
for _, player in ipairs(getElementsByType("player")) do
bindKey (player, engineKey, "down", engineOffOn )
bindKey(player,lightsKey, "down", changeLightsState )
end
end)
addEventHandler("onResourceStop",resourceRoot,function(res)
if res~= getThisResource() then return end
for _, player in ipairs(getElementsByType("player")) do
unbindKey (player, engineKey, "down", engineOffOn )
unbindKey(player,lightsKey, "down", changeLightsState )
end
end)
addEventHandler ( "onPlayerJoin",root,function()
bindKey (source,engineKey, "down", engineOffOn)
bindKey(source,lightsKey, "down", changeLightsState)
end)
addEventHandler ( "onPlayerQuit",root,function()
unbindKey (source,engineKey, "down", engineOffOn)
unbindKey(source,lightsKey, "down", changeLightsState)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-08-25, 22:21


vipSEBOvip

A poor begginer






Wiek: 26
Na forum: 5178 dni
Posty: 597
Nick w MP: xSebaPL

Piwa: 77

Respekt: 140
Respekt: 140

mrmay4141 napisał/a:

i jest w nim jaki? problem.


Jaki problem dok?adnie ? U?yj /debugscript 3

Postaw piwo autorowi tego posta
 

 
Tagi: gdzie?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Gdzie? Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku