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

Wysłany: 2019-08-05, 16:48


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? mam problem z dodani? eventu onPlayerWasted
kod
s.side

local praca1surowiec = {}
praca1surowiec.__index praca1surowiec

local vehicles = {}

function praca1surowiec:Load()

    self.Quit = function() self:onQuit() end
    
    addEventHandler('onPlayerQuit',resourceRoot,self.Quit)

    --self.dummy_car createVehicle(498, -99999.54, -99999.56, -99999.350.000.000.00)
    --setElementFrozen(self.dummy_car,true)
    --setVehicleColor(self.dummy_car2552000000)    
    --addVehicleUpgrade(self.dummy_car1025)
    --setVehiclePlateText(self.dummy_car"KOKAINA")
    
    addEventHandler('onVehicleStartEnter',resourceRoot,function(player)
        if source == self.dummy_car then
            cancelEvent()
        elseif source == vehicles[playerthen
            cancelEvent()
        end
    end)
    
    addEventHandler('onVehicleStartExit',resourceRoot,function(player)
        if source == vehicles[playerthen
            cancelEvent()
        end
    end)
    
end

function praca1surowiec:onQuit()
    if vehicles[source] and isElement(vehicles[source]) then destroyElement(vehicles[source]); end
    if Chest2s[source] and isElement(Chest2s[source]) then destroyElement(Chest2s[source]); end
end

praca1surowiec:Load()

local Chest2s = {}

addEvent('givesurowiecChest2',true)
addEventHandler('givesurowiecChest2',root,function()
    --local x,y,getElementPosition(source)
    --Chest2s[source] = createObject(2912,x,y,z)
--    exports.bone_attach:attachElementToBone(Chest2s[source],source,11,-0.15,0.00,0.10,-92.00,-5.00,5.00)
--    setObjectScale(Chest2s[source],0.6)
--    setPedAnimation(source,'CARRY','crry_prtial',0,true,true,false,true)
    setElementData(vehicles[source], "vehciel:olej"10)
    setElementData(vehicles[source], "vehciel:fuel"90)    
end)

addEvent('destroysurowiecChest2',true)
addEventHandler('destroysurowiecChest2',root,function()
    setPedAnimation(source,'ped','facanger',-1,false,true,true,false)
    if Chest2s[source] and isElement(Chest2s[source]) then destroyElement(Chest2s[source]) end
    vehicles[source] = createVehicle(573, -529.90,-500.72,25.67,5.0,359.8,0.7)
    setElementData(vehicles[source], "vehciel:olej"10)
    setElementData(vehicles[source], "vehciel:fuel"90)    
    warpPedIntoVehicle(source,vehicles[source])    
end)



addEvent('destroyPlayerVehicle',true)
addEventHandler('destroyPlayerVehicle',root,function()
    if vehicles[source] and isElement(vehicles[source]) then destroyElement(vehicles[source]) end
end)

addEvent('givePlayerhajsik',true)
addEventHandler('givePlayerhajsik',root,function(hajsik)
    givePlayerMoney(source,tonumber(hajsik))
end)


ja pr?bow???m tak, lecz nie dzia?a :(
addEvent('onPlayerWasted',true)
addEventHandler('onPlayerWasted',root,function()
    if vehicles[source] and isElement(vehicles[source]) then destroyElement(vehicles[source]) end
    if Chest2s[source] and isElement(Chest2s[source]) then destroyElement(Chest2s[source]); end    
end)


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-05, 17:03


Malentas

Koder mirofali w lua






Wiek: 24
Na forum: 3681 dni
Posty: 146
Nick w MP: Malentas

Piwa: 1626

Respekt: 47,3


addEvent('onPlayerWasted',true)
addEventHandler('onPlayerWasted',root,function(gracz)
    if vehicles[gracz] and isElement(vehicles[gracz]) then destroyElement(vehicles[gracz]) end
    if Chest2s[gracz] and isElement(Chest2s[gracz]) then destroyElement(Chest2s[gracz]) end    
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-05, 19:17


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Niestety nie dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-05, 21:36


Szypki_exe







Wiek: 21
Na forum: 3239 dni
Posty: 172

Piwa: 1426

Respekt: 150
Respekt: 150Respekt: 150

addEventHandler("onPlayerWasted"root, function(gracz)
       praca1surowiec:onQuit()
end)


spr?buj tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-05, 22:26


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Szypki_exe taki blad w db3
Kod:

attempt to index global 'Chest2s' (a nil value)


Postaw piwo autorowi tego posta
 

 
Tagi: dodanie :: eventu :: onplayerwasted
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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