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

Wysłany: 2014-11-23, 22:32


Terr9909

Skrypter LUA






Wiek: 26
Na forum: 4234 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

Witam, mam pewien problem ot?? chce zrobi? sprzedawanie gracza z ofert? lecz mi nie wychodzi, podaje dobr? komend?, jestem w?a?cicielem pojazdu oraz w nim siedz? mimo to nic si? nie wy?wietla.

addCommandHandler("sprzedaj.pojazd", function(plrcmdidcel)
    if not id or not cel then
        outputChatBox("* U?yj: /sprzedaj.pojazd <id> <nick/ID>"plr)
        return
    end
    
    if not getPedOccupiedVehicle(plrthen
        outputChatBox("* Nie znajdujesz si? w poje?dzie kt?ry chcesz sprzeda?."plr)
        return
    end
    
    local target znajdzGracza(plrcel)
    
    for i,v in ipairs(getElementsByType("vehicle")) do
        if id == getElementData(v"pojazd_id"then
            if getElementData(plr"gracz_id") == getElementData(v"pojazd_wlasciciel"then
                outputChatBox("* Oups Oups"plr)
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-23, 22:35


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Mam tu kodzik z mojego starego GM, lecz na leczenie :)

addCommandHandler("leczenie", 
    function(plrcmdtrg)
    if not getAccountData(getPlayerAccount(plr), "medyk"then
    outputChatBox("Nie posiadasz funkcji Doktora!"plr255255255)
        return
    end
    skin getElementModel plr )
    if skin ~= 71 then
    outputChatBox "Nie posiadasz stroju odpowiedniego do wykonywanego przez Ciebie zawodu!"plr255255255 ) return end
    if not trg then
        outputChatBox("[U?ycie] /leczenie <gracz>"plr25500)
        return
    else 
        local target=getPlayerFromName(trg)
        if not target then
            outputChatBox("Nie ma takiego gracza!"plr)
            return
        end
        if getElementHealth target ) >=80 then
        outputChatBox "Dany gracz nie potrzebuje leczenia. Jego ?ycie musi by? ni?sze ni? 80%!"plr255255255 ) return end
        
        setElementData(target"leczenie:zgoda"true)
        setElementData(target"leczenie:medyk"plr)
        outputChatBox("Doktor " .. getPlayerName(plr) .. " oferuje Ci leczenie. Wpisz /przyjmij, aby si? zgodzi?."target255255255)
        outputChatBox("Wyslano oferte leczenia do " .. getPlayerName(target), plr)
    end
end)

addCommandHandler("przyjmij",
    function(plrcmd)
    if not getElementDataplr"leczenie:zgoda"then return end
        
        local medyk=getElementData(plr"leczenie:medyk")
        if not medyk then return end
        if medyk==plr then
        outputChatBox "Uleczy?e? Siebie lecz nie dosta?e? za to funt?w."plr255255255 setElementHealth(plr100removeElementData(plr"leczenie:zgoda"removeElementData(plr"leczenie:medyk") return end
        removeElementData(plr"leczenie:zgoda")
        removeElementData(plr"leczenie:medyk")
        
        outputChatBox("Uleczyles gracza " .. getPlayerName(plr) .. ". Swoje nale?ne 25.00 funt?w mo?esz odebra? w punkcie odbioru wyp?at!"medyk255255255)
        outputChatBox("Doktor " .. getPlayerName(medyk) .. " uleczy? Ciebie!"plr255255255)
        konto getPlayerAccount medyk )
        ilosc1 getAccountData konto"zarobekmedyk" )
        setAccountData konto"zarobekmedyk"tonumber(ilosc1)+tonumber(2500) )
        setElementHealth(plr100)
end)


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-23, 22:40


Terr9909

Skrypter LUA






Wiek: 26
Na forum: 4234 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

wiem, widzia?em na pewnym forum jak prosi?e? o pomoc kilka miesi?cy temu ale mi chodzi z systemem pojazd?w, bo chc? aby dla jakiego? pojazdu si? zmienia?y zmienne po kupnie i oferty, pr?bowa?em te? zrobi? z ofertami ale nie dzia?a?o bo zazwyczaj albo nie pokazuje nic graczowi i nic nie zmienia albo nie dzia?a w og?le tak jak by? m?g? powiedzia? by? mi jak to mog? zrobi??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-23, 23:18


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Wykorzystaj ten kod, kt?ry Ci da?em. Wystarczy go lekko przerobi? i b?dzie ?miga?.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-27, 16:51


Terr9909

Skrypter LUA






Wiek: 26
Na forum: 4234 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

Okej, zastosowa?em tw?j kod troch?, lecz gracz wpisuj?cy /kupojazd nie mo?e go zakupi? bo ta komenda nie reaguje a b??d?w db3 brak.

addCommandHandler("vsprzedaj", function(plrcmdcelvalue)
    if not cel or not tonumber(valuethen
        outputChatBox("* U?yj: /vsprzedaj <nick/ID> <cena>"plr)
        return
    end

    local cost tonumber(value)
    local target znajdzGracza(plrcel)
    local vehicle getPedOccupiedVehicle(plr)

    if not vehicle then
        outputChatBox("* Musisz siedzie? w poje?dzie, kt?ry chcesz sprzeda?."plr)
        return
    end

    if not getElementData(vehicle"pojazd_zrespiony"then return end

    if getElementData(plr"gracz_id") ~= getElementData(vehicle"pojazd_wlasciciel"then
        outputChatBox("* Nie jeste? w?a?cicielem tego pojazdu."plr)
        return
    end

    if not target then
        outputChatBox("* Nie znaleziono podanego gracza."plr)
        return
    end

    setElementData(target"vsprzedarz:gracz"plr)
    setElementData(target"vsprzedarz:zgoda"true)
    setElementData(target"vsprzedarz:koszt"cost)
    setElementData(target"vsprzedarz:id"getElementData(vehicle"pojazd_id"))
    outputChatBox("* Wys?ano ofert? do gracza: "..getPlayerName(target)..""plr)
    outputChatBox("* Otrzyma?e? ofert? od gracza "..getPlayerName(plr).." | Pojazd: "..getVehicleName(vehicle)..""target)
    outputChatBox("* ID Pojazdu: "..getElementData(vehicle"pojazd_id").." | Przebieg: "..math.floor(getElementData(vehicle"pojazd_przebieg")).." | Cena: "..cost.." PLN"target)
    outputChatBox("* Aby zakupi? pojazd wpisz: /kuppojazd"target)
end)

addCommandHandler("kuppojazd", function(plrcmd)
    if not getElementData(plr"vsprzedarz:zgoda"then return end
    
    if getPlayerMoney(plr) < getElementData(plr"vsprzedarz:koszt"then
        outputChatBox("* Nie posiadasz wystarczaj?cej ilo?ci pieni?dzy."plr25500)
        return
    end

    for i,v in ipairs(getElementsByType("vehicle")) do
        if not getElementData(v"pojazd_zrespiony"then return end
        if getElementData(v"pojazd_id") == getElementData(plr"vsprzedarz:id"then
            if getElementData(v"pojazd_wlasciciel") == getElementData(plr"vsprzedarz:gracz"then
                setElementData(v"pojazd_wlasciciel"getElementData(plr"gracz_id"))
            end
        end
    end

    outputChatBox("* Sprzeda? przeprowadzona pomy?lnie!"plr)
    takePlayerMoney(plrgetElementData(plr"vsprzedarz:koszt"))
    outputChatBox("* Sprzeda? zako?czona"getElementData(plr"vsprzedarz:gracz"))
    givePlayerMoney(getElementData(plr"vsprzedarz:gracz"), getElementData(plr"vsprzedarz:koszt"))

    removeElementData(plr"vsprzedarz:id")
    removeElementData(plr"vsprzedarz:gracz")
    removeElementData(plr"vsprzedarz:zgoda")
    removeElementData(plr"vsprzedarz:koszt")
end)


Postaw piwo autorowi tego posta
 

 
Tagi: sprzedawanie :: pojazdów
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