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

Wysłany: 2018-08-15, 20:08


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Witam all . Mam pytanie odno?nie tego ?e jak kto? wyjdzie z graczy to torba znika , nie wiem dlaczego , naprawicie mi to ?


function pacholek(localPlayer)
if getElementData (localPlayer,"frakcja") == "PR" then
        pacholekk createObject(12100,0,0,0,0,0)
        attachElements(pacholekklocalPlayer0.2,-0.09,-0.3,0,0,90)
        end
    end
addCommandHandler("torba",pacholek)

function usuntorbe(localPlayer)
    destroyElement(pacholekk,localPlayer)
end
addCommandHandler("usuntorbe",usuntorbe)

function postaw (localPlayer)
        detachElements(pacholekklocalPlayer)
end
addCommandHandler("postawtorbe",postaw)

addEventHandler "onPlayerQuit",getRootElement(), function(source)
        destroyElement(pacholekk,source)
end)


Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-15, 20:55


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70


function pacholek(localPlayer)
if getElementData (localPlayer,"frakcja") == "PR" then
        pacholekk createObject(12100,0,0,0,0,0)
        attachElements(pacholekklocalPlayer0.2,-0.09,-0.3,0,0,90)
        end
    end
addCommandHandler("torba",pacholek)

function usuntorbe(localPlayer)
    destroyElement(pacholekk,localPlayer)
end
addCommandHandler("usuntorbe",usuntorbe)

function postaw (localPlayer)
        detachElements(pacholekklocalPlayer)
end
addCommandHandler("postawtorbe",postaw)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-15, 23:19


Remix110

Pewna osóbka :3






Wiek: 40
Na forum: 3663 dni
Posty: 291
Nick w MP: GoodNight

Piwa: 15

Respekt: 51

BoomEq, co to mia?o zmieni?? Usun??e? tylko, ?e po wyj?ciu dowolnego gracza usuwa si? ;p A co do tego masz ustawione getRootElement i b?dzie ci bra? jak dowolny gracz wyjdzie we? gracza kt?ry to postawi? aby usuwa?o.

Podpis
pomogłem? :P Możesz dać piwko, przyda się na imprezę :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-16, 03:58


Adis.exe

LUA Developer






Wiek: 23
Na forum: 3498 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 997

Respekt: 110,3
Respekt: 110,3


Więcej informacji znajdziesz w Wikipedii MTA:

OnPlayerQuit


Poczytaj, tam jest napisane co to jest source, z reszt? z przyk?adu mo?esz wywnioskowa? dlaczego usuwa si? jak kto? wyjdzie z serwera

I ten dzia? jest po to aby ci kto? pom?g? podpowiedzia?, a nie "naprawi? ci" i odwali? za Ciebie robot?.

Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-16, 09:26


Qwertick

Coming soon...






Wiek: 23
Na forum: 3577 dni
Posty: 472
Nick w MP: Qwertick

Piwa: 2726

Respekt: 215,8
Respekt: 215,8Respekt: 215,8

Zobacz to
function pacholek(localPlayer)
    if getElementData (localPlayer,"frakcja") == "PR" then
        pacholekk createObject(12100,0,0,0,0,0)
        attachElements(pacholekklocalPlayer0.2,-0.09,-0.3,0,0,90)
        pacholek[source] = pacholekk
    end
end
addCommandHandler("torba"pacholek)

function usuntorbe()
    destroyElement(pacholek[source])
end
addCommandHandler("usuntorbe"usuntorbe)

function postaw()
        detachElements(pacholek[source])
end
addCommandHandler("postawtorbe"postaw)

pacholek[source] = {}

addEventHandler ("onPlayerQuit"getRootElement(), function()
     if pacholek[sourcethen
        if isElement(pacholek[source]) then destroyElement(pacholek[sourceend
     end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-16, 20:22


Hemoglobina

Tylko Hema






Wiek: 29
Na forum: 3397 dni
Posty: 89
Nick w MP: Answer

Piwa: 1386

Respekt: 90

Polecam pisa? po stronie serwera.

Na jednym przyk?adzie poka?e Tobie jak poradzi? sobie z reszt?.

torba = {}

torbamodel 1210

addCommandHandler("torba", function(playercmd)
    if tostring(getElementData(player"frakcja")) == "PR" then
        torba[player] = createObject(torbamodel0,0,0,0,0,0)
        attachElements(torba[player], player0.2,-0.09,-0.3,0,0,90)
    end
end)


addEventHandler("onPlayerQuit"getRootElement(), function()
    if tostring(getElementData(source"frakcja")) == "PR" then
        for _,obj in ipairs(getElementsByType("object"resourceRoot)) do
            if getElementModel(obj) == torbamodel then
                destroyElement(torba[source])
            end
        end
    end
end)


Masz praktycznie to co chcia?e?.

Postaw piwo autorowi tego posta
 

 
Tagi: torba :: która :: zle :: znika
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