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

Wysłany: 2018-09-06, 10:04


adisonboss







Wiek: 23
Na forum: 3472 dni
Posty: 237

Piwa: 6

Respekt: 50

Witam mam problem ze skryptem na wzi?cie skina. Ot?? w og?le skrypt nie pojawia znacznika do wzi?cia skina. Dodam i? robi?em ju? podobny skrypt i dzia?a? on bez problemowo. Za pomoc piwko i respekt

KOD

pickup = createPickup ( -2569.14282, 479.92026, 14.56875, 0, 1275, 0, 0 ) --Policja

addEventHandler ( "onPickupHit", pickup, function(element)
    if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( element ) ), aclGetGroup ( "PR" ) ) then
            cywilt = getTeamFromName ( "CYWILE" )
            setPlayerTeam ( element, cywilt )
        if getAccountData ( getPlayerAccount ( element ), "stary:skin" ) then
            id = tonumber ( getAccountData ( getPlayerAccount ( element ), "stary:skin" ) )
            setElementModel ( element, id ) 
            setAccountData ( getPlayerAccount ( element ), "stary:skin", false )
        else
            skin = tonumber ( getElementModel ( element ) )
            setAccountData ( getPlayerAccount ( element ), "stary:skin", skin )
            setElementModel ( element, 118 )
end
    end
    end)





DB3
https://imgur.com/a/X27ZnOI

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 11:52


mtm

</3






Wiek: 26
Na forum: 3856 dni
Posty: 181

Piwa: 252

Respekt: 70

hej

spr?buj:

cside:

pickup = createPickup ( -2569.14282, 479.92026, 14.56875, 0, 1275, 0, 0 ) --Policja
setElemendData(pickup, "policepickup", true)


sside:

addEventHandler ( "onPickupHit", root,
    function(element)
        if getElementData(source, 'policepickup') then
            if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( element ) ), aclGetGroup ( "PR" ) ) then
                    cywilt = getTeamFromName ( "CYWILE" )
                    setPlayerTeam ( element, cywilt )
                if getAccountData ( getPlayerAccount ( element ), "stary:skin" ) then
                    id = tonumber ( getAccountData ( getPlayerAccount ( element ), "stary:skin" ) )
                    setElementModel ( element, id ) 
                    setAccountData ( getPlayerAccount ( element ), "stary:skin", false )
                else
                    skin = tonumber ( getElementModel ( element ) )
                    setAccountData ( getPlayerAccount ( element ), "stary:skin", skin )
                    setElementModel ( element, 118 )
                end
            end
        end
    end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 16:04


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

@mtm: je?li nie wiesz w czym polega problem, nie pomagaj na si??, tym bardziej je?li masz problemy z LUA.

Problem polega na tym, ?e w typie pickupa ustawi?e? typ na 'zdrowie' a nie na typ 'custom'.

Jest to czwarty argument (3 to custom, 0 to zdrowie).
Wtedy tworzysz event onPickupUse i funkcj? do niego co ma sie zdarzy? po u?yciu owego pickup'u.

Gotowy kod po stronie 'server':


local pickup = createPickup(-2569.14282, 479.92026, 14.56875, 3, 1275, 0) --Policja

addEventHandler("onPickupUse", pickup, function(element)
    if isObjectInACLGroup ("user." .. getAccountName ( getPlayerAccount ( element ) ), aclGetGroup ( "PR" ) ) then
        setPlayerTeam ( element, getTeamFromName ( "CYWILE" ) )
        if getAccountData ( getPlayerAccount ( element ), "stary:skin" ) then
            local id = tonumber ( getAccountData ( getPlayerAccount ( element ), "stary:skin" ) )
            setElementModel ( element, id ) 
            setAccountData ( getPlayerAccount ( element ), "stary:skin", false )
        else
            local skin = tonumber ( getElementModel ( element ) )
            setAccountData ( getPlayerAccount ( element ), "stary:skin", skin )
            setElementModel ( element, 118 )
        end
    end
end)



Więcej informacji znajdziesz w Wikipedii MTA:

createPickup



Więcej informacji znajdziesz w Wikipedii MTA:

onPickupUse


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
adisonboss
Wysłany: 2018-09-06, 17:40


adisonboss







Wiek: 23
Na forum: 3472 dni
Posty: 237

Piwa: 6

Respekt: 50

Dzi?ki dzia?a do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: pickup :: skina
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