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

Wysłany: 2015-06-02, 18:15


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

local allow_vehs={
    [420]=true,
}

local vehs={
    {-166.73339843751013.02929687519.52188873291},
    {-178.0644531251013.118164062519.522001266479},
    {-166.7949218751019.00585937519.521606445312},
    {-178.04785156251019.041992187519.521175384521},
}

taxi={}

for k,v in ipairs(vehs)do
    taxi[k]=createVehicle(420,v[1],v[2],v[3])
    setElementData(taxi[k],"vehicle:taxi",true)
end

addEventHandler("onPlayerVehicleEnter",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                outputChatBox("*Zosta?e?(a?) taks?wkarzem. Dostaniesz informacj? o po?o?eniu klienta po wezwaniu us?ugi.",source,255,255,255)
                setElementData(source,"player:taxi",true)
            end
        end
    end
    if allow_vehs[getElementModel(veh)] then
        if getElementData(veh,"vehicle:taxi"then
            setElementData(source,"taxi",false)
        end
    end
end)

addEventHandler("onPlayerVehicleExit",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                respawnVehicle(veh)
                setElementData(source,"player:taxi",false)
            end
        end
    end
end)



addCommandHandler("taxi",function(plr)
    if getElementData(plr,"taxi"then
        return outputChatBox("*Zam?wi?e?(a?) ju? us?ug?. Poczekaj cierpliwie na taks?wk?",plr,255,255,0)
    end
    count={}
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    table.insert(count,v)
                end
            end
        end
    end
    if #count==0 then
        return outputChatBox("*Brak taks?wkarzy na s?u?bie.",plr,255,255,0)
    end
    local x,y,z=getElementPosition(plr)
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    outputChatBox("--NOWE ZLECENIE--",v,255,255,0)
                    outputChatBox("*Gracz "..getPlayerName(plr).." zam?wi?(a) us?ug? taxi.",v,255,255,0)
                    local miasto=getZoneName(x,y,z)
                    local strefa=getZoneName(x,y,z,true)
                    outputChatBox("*Po?o?enie : "..miasto..", "..strefa,v,255,255,0)
                end
            end
        end
    end
    outputChatBox("*Zam?wi?e?(a?) us?ug? taxi. Czekaj cierpliwie w tym miejscu, taks?wkarz nie b?dzie cie szuka?.",plr,255,255,0)
    setElementData(plr,"taxi",true)
end)


addCommandHandler("oplata",function(plr,cmd,gracz,ilosc)
    if getElementData(plr,"player:taxi"then
        local cel=getPlayerFromName(gracz)
        if cel then
            setElementData(cel,"TaxiInfo",{plr,ilosc})
            outputChatBox("*Gracz "..getPlayerName(plr).." poda?(a) Ci kwitek do zap?aty "..ilosc.." $. Aby podpisa? wpisz /akceptuj",cel,255,255,255)
            outputChatBox("*Poda?e?(a?) kwitek klientowi do zap?aty.",plr,255,255,255)
        end
    end
end)

addCommandHandler("akceptuj",function(plr)
    if getElementData(plr,"TaxiInfo"then
        local taksowkarz,ilosc=unpack(getElementData(plr,"TaxiInfo"))
        local taksowkarz=getPlayerFromName(getPlayerName(taksowkarz))
        if not taksowkarz then
            return outputChatBox("*Taks?wkarz nie jest ju? online",plr,255,255,255)
        end
        if tonumber(getPlayerMoney(plr))<tonumber(iloscthen
            return outputChatBox("*Nie posiadasz pieni?dzy aby podpisa? kwitek z kwot? "..ilosc.." $",plr,255,255,255)
        end
        givePlayerMoney(taksowkarz,tonumber(ilosc))
        takePlayerMoney(plr,tonumber(ilosc))
        outputChatBox("*Podpisa?e? kwitek. Zabrano Ci "..ilosc.." $",plr,255,255,255)
        outputChatBox("*Gracz "..getPlayerName(plr).." podpisa? kwitek. Otrzymujesz "..ilosc.." $",taksowkarz,255,255,255)
    end
end)


jak zrobi? aby pojazd by? obr?cony
0089.538452148438


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 18:39


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
local vehs={
    {-166.73339843751013.02929687519.52188873291},
    {-178.0644531251013.118164062519.522001266479},
    {-166.7949218751019.00585937519.521606445312},
    {-178.04785156251019.041992187519.521175384521},
}

dopisujesz jeszcze rotacje, czyli kolejne 3 warto?ci


A tu dajesz bodaj?e:


for k,v in ipairs(vehs)do
    taxi[k]=createVehicle(420,v[1],v[2],v[3])
    setElementRotation(taxi[k],v[4],v[5],v[6])
    setElementData(taxi[k],"vehicle:taxi",true)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 18:52


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

DestroY, m?g? by? da? gotowca ??

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 18:56


THEGizmo

Modeler/Uczeń Lua






Wiek: 27
Na forum: 4141 dni
Posty: 255
Nick w MP: THEGizmo

Piwa: 3072

Respekt: 200
Respekt: 200Respekt: 200

Mo?na i tak jak ja poda?em

local allow_vehs={
    [420]=true,
}

local vehs={
    {-166.73339843751013.02929687519.521888732910090},
    {-178.0644531251013.118164062519.5220012664790090},
    {-166.7949218751019.00585937519.5216064453120090},
    {-178.04785156251019.041992187519.5211753845210090},
}

taxi={}

for k,v in ipairs(vehs)do
    taxi[k]=createVehicle(420,v[1], v[2], v[3], v[4], v[5], v[6], v[7])
    setElementData(taxi[k],"vehicle:taxi",true)
end

addEventHandler("onPlayerVehicleEnter",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                outputChatBox("*Zosta?e?(a?) taks?wkarzem. Dostaniesz informacj? o po?o?eniu klienta po wezwaniu us?ugi.",source,255,255,255)
                setElementData(source,"player:taxi",true)
            end
        end
    end
    if allow_vehs[getElementModel(veh)] then
        if getElementData(veh,"vehicle:taxi"then
            setElementData(source,"taxi",false)
        end
    end
end)

addEventHandler("onPlayerVehicleExit",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                respawnVehicle(veh)
                setElementData(source,"player:taxi",false)
            end
        end
    end
end)



addCommandHandler("taxi",function(plr)
    if getElementData(plr,"taxi"then
        return outputChatBox("*Zam?wi?e?(a?) ju? us?ug?. Poczekaj cierpliwie na taks?wk?",plr,255,255,0)
    end
    count={}
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    table.insert(count,v)
                end
            end
        end
    end
    if #count==0 then
        return outputChatBox("*Brak taks?wkarzy na s?u?bie.",plr,255,255,0)
    end
    local x,y,z=getElementPosition(plr)
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    outputChatBox("--NOWE ZLECENIE--",v,255,255,0)
                    outputChatBox("*Gracz "..getPlayerName(plr).." zam?wi?(a) us?ug? taxi.",v,255,255,0)
                    local miasto=getZoneName(x,y,z)
                    local strefa=getZoneName(x,y,z,true)
                    outputChatBox("*Po?o?enie : "..miasto..", "..strefa,v,255,255,0)
                end
            end
        end
    end
    outputChatBox("*Zam?wi?e?(a?) us?ug? taxi. Czekaj cierpliwie w tym miejscu, taks?wkarz nie b?dzie cie szuka?.",plr,255,255,0)
    setElementData(plr,"taxi",true)
end)


addCommandHandler("oplata",function(plr,cmd,gracz,ilosc)
    if getElementData(plr,"player:taxi"then
        local cel=getPlayerFromName(gracz)
        if cel then
            setElementData(cel,"TaxiInfo",{plr,ilosc})
            outputChatBox("*Gracz "..getPlayerName(plr).." poda?(a) Ci kwitek do zap?aty "..ilosc.." $. Aby podpisa? wpisz /akceptuj",cel,255,255,255)
            outputChatBox("*Poda?e?(a?) kwitek klientowi do zap?aty.",plr,255,255,255)
        end
    end
end)

addCommandHandler("akceptuj",function(plr)
    if getElementData(plr,"TaxiInfo"then
        local taksowkarz,ilosc=unpack(getElementData(plr,"TaxiInfo"))
        local taksowkarz=getPlayerFromName(getPlayerName(taksowkarz))
        if not taksowkarz then
            return outputChatBox("*Taks?wkarz nie jest ju? online",plr,255,255,255)
        end
        if tonumber(getPlayerMoney(plr))<tonumber(iloscthen
            return outputChatBox("*Nie posiadasz pieni?dzy aby podpisa? kwitek z kwot? "..ilosc.." $",plr,255,255,255)
        end
        givePlayerMoney(taksowkarz,tonumber(ilosc))
        takePlayerMoney(plr,tonumber(ilosc))
        outputChatBox("*Podpisa?e? kwitek. Zabrano Ci "..ilosc.." $",plr,255,255,255)
        outputChatBox("*Gracz "..getPlayerName(plr).." podpisa? kwitek. Otrzymujesz "..ilosc.." $",taksowkarz,255,255,255)
    end
end)


EDIT: Poprawi?em troch? kod tera rotacja dzia?a :P

Je?li pomog?em daj piwo :D

Ostatnio zmieniony przez THEGizmo 2015-06-02, 19:22, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 18:59


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
"THEGizmo" napisał/a:

Mo?na i tak jak ja poda?em

local allow_vehs={
    [420]=true,
}

local vehs={
    {-166.73339843751013.02929687519.521888732910089.538452148438},
    {-178.0644531251013.118164062519.5220012664790089.538452148438},
    {-166.7949218751019.00585937519.5216064453120089.538452148438},
    {-178.04785156251019.041992187519.5211753845210089.538452148438},
}

taxi={}

for k,v in ipairs(vehs)do
    taxi[k]=createVehicle(420,v[1],v[2],v[3])
    setElementData(taxi[k],"vehicle:taxi",true)
end

addEventHandler("onPlayerVehicleEnter",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                outputChatBox("*Zosta?e?(a?) taks?wkarzem. Dostaniesz informacj? o po?o?eniu klienta po wezwaniu us?ugi.",source,255,255,255)
                setElementData(source,"player:taxi",true)
            end
        end
    end
    if allow_vehs[getElementModel(veh)] then
        if getElementData(veh,"vehicle:taxi"then
            setElementData(source,"taxi",false)
        end
    end
end)

addEventHandler("onPlayerVehicleExit",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                respawnVehicle(veh)
                setElementData(source,"player:taxi",false)
            end
        end
    end
end)



addCommandHandler("taxi",function(plr)
    if getElementData(plr,"taxi"then
        return outputChatBox("*Zam?wi?e?(a?) ju? us?ug?. Poczekaj cierpliwie na taks?wk?",plr,255,255,0)
    end
    count={}
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    table.insert(count,v)
                end
            end
        end
    end
    if #count==0 then
        return outputChatBox("*Brak taks?wkarzy na s?u?bie.",plr,255,255,0)
    end
    local x,y,z=getElementPosition(plr)
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    outputChatBox("--NOWE ZLECENIE--",v,255,255,0)
                    outputChatBox("*Gracz "..getPlayerName(plr).." zam?wi?(a) us?ug? taxi.",v,255,255,0)
                    local miasto=getZoneName(x,y,z)
                    local strefa=getZoneName(x,y,z,true)
                    outputChatBox("*Po?o?enie : "..miasto..", "..strefa,v,255,255,0)
                end
            end
        end
    end
    outputChatBox("*Zam?wi?e?(a?) us?ug? taxi. Czekaj cierpliwie w tym miejscu, taks?wkarz nie b?dzie cie szuka?.",plr,255,255,0)
    setElementData(plr,"taxi",true)
end)


addCommandHandler("oplata",function(plr,cmd,gracz,ilosc)
    if getElementData(plr,"player:taxi"then
        local cel=getPlayerFromName(gracz)
        if cel then
            setElementData(cel,"TaxiInfo",{plr,ilosc})
            outputChatBox("*Gracz "..getPlayerName(plr).." poda?(a) Ci kwitek do zap?aty "..ilosc.." $. Aby podpisa? wpisz /akceptuj",cel,255,255,255)
            outputChatBox("*Poda?e?(a?) kwitek klientowi do zap?aty.",plr,255,255,255)
        end
    end
end)

addCommandHandler("akceptuj",function(plr)
    if getElementData(plr,"TaxiInfo"then
        local taksowkarz,ilosc=unpack(getElementData(plr,"TaxiInfo"))
        local taksowkarz=getPlayerFromName(getPlayerName(taksowkarz))
        if not taksowkarz then
            return outputChatBox("*Taks?wkarz nie jest ju? online",plr,255,255,255)
        end
        if tonumber(getPlayerMoney(plr))<tonumber(iloscthen
            return outputChatBox("*Nie posiadasz pieni?dzy aby podpisa? kwitek z kwot? "..ilosc.." $",plr,255,255,255)
        end
        givePlayerMoney(taksowkarz,tonumber(ilosc))
        takePlayerMoney(plr,tonumber(ilosc))
        outputChatBox("*Podpisa?e? kwitek. Zabrano Ci "..ilosc.." $",plr,255,255,255)
        outputChatBox("*Gracz "..getPlayerName(plr).." podpisa? kwitek. Otrzymujesz "..ilosc.." $",taksowkarz,255,255,255)
    end
end)


Je?li pomog?em daj piwo :D


I gdzie ty masz tutaj setElementRotation czy chocia?by kolejne 3 argumenty przy tworzeniu pojazdu ?? ?

A to by? gotowiec, przecie? nie wys?a?em ci link?w do wiki i nie kazalem samemu si? m?czy?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 19:50


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

local allow_vehs={
    [420]=true,
}

local vehs={
    {-166.73339843751013.02929687519.52188873291},
    {-178.0644531251013.118164062519.522001266479},
    {-166.7949218751019.00585937519.521606445312},
    {-178.04785156251019.041992187519.521175384521},
}

taxi={}

for k,v in ipairs(vehs)do
    taxi[k]=createVehicle(420,v[1],v[2],v[3])
    setElementRotation taxi[k], 0089.538452148438 )
    setElementData(taxi[k],"vehicle:taxi",true)
end

addEventHandler("onPlayerVehicleEnter",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                outputChatBox("*Zosta?e?(a?) taks?wkarzem. Dostaniesz informacj? o po?o?eniu klienta po wezwaniu us?ugi.",source,255,255,255)
                setElementData(source,"player:taxi",true)
            end
        end
    end
    if allow_vehs[getElementModel(veh)] then
        if getElementData(veh,"vehicle:taxi"then
            setElementData(source,"taxi",false)
        end
    end
end)

addEventHandler("onPlayerVehicleExit",root,function(veh,seat)
    if seat==0 then
        if allow_vehs[getElementModel(veh)] then
            if getElementData(veh,"vehicle:taxi"then
                respawnVehicle(veh)
                setElementData(source,"player:taxi",false)
            end
        end
    end
end)



addCommandHandler("taxi",function(plr)
    if getElementData(plr,"taxi"then
        return outputChatBox("*Zam?wi?e?(a?) ju? us?ug?. Poczekaj cierpliwie na taks?wk?",plr,255,255,0)
    end
    count={}
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    table.insert(count,v)
                end
            end
        end
    end
    if #count==0 then
        return outputChatBox("*Brak taks?wkarzy na s?u?bie.",plr,255,255,0)
    end
    local x,y,z=getElementPosition(plr)
    for _,v in ipairs(getElementsByType("player"))do
        if getPedOccupiedVehicle(vthen
            if getElementData(getPedOccupiedVehicle(v),"vehicle:taxi"then
                if allow_vehs[getElementModel(getPedOccupiedVehicle(v))] then
                    outputChatBox("--NOWE ZLECENIE--",v,255,255,0)
                    outputChatBox("*Gracz "..getPlayerName(plr).." zam?wi?(a) us?ug? taxi.",v,255,255,0)
                    local miasto=getZoneName(x,y,z)
                    local strefa=getZoneName(x,y,z,true)
                    outputChatBox("*Po?o?enie : "..miasto..", "..strefa,v,255,255,0)
                end
            end
        end
    end
    outputChatBox("*Zam?wi?e?(a?) us?ug? taxi. Czekaj cierpliwie w tym miejscu, taks?wkarz nie b?dzie cie szuka?.",plr,255,255,0)
    setElementData(plr,"taxi",true)
end)


addCommandHandler("oplata",function(plr,cmd,gracz,ilosc)
    if getElementData(plr,"player:taxi"then
        local cel=getPlayerFromName(gracz)
        if cel then
            setElementData(cel,"TaxiInfo",{plr,ilosc})
            outputChatBox("*Gracz "..getPlayerName(plr).." poda?(a) Ci kwitek do zap?aty "..ilosc.." $. Aby podpisa? wpisz /akceptuj",cel,255,255,255)
            outputChatBox("*Poda?e?(a?) kwitek klientowi do zap?aty.",plr,255,255,255)
        end
    end
end)

addCommandHandler("akceptuj",function(plr)
    if getElementData(plr,"TaxiInfo"then
        local taksowkarz,ilosc=unpack(getElementData(plr,"TaxiInfo"))
        local taksowkarz=getPlayerFromName(getPlayerName(taksowkarz))
        if not taksowkarz then
            return outputChatBox("*Taks?wkarz nie jest ju? online",plr,255,255,255)
        end
        if tonumber(getPlayerMoney(plr))<tonumber(iloscthen
            return outputChatBox("*Nie posiadasz pieni?dzy aby podpisa? kwitek z kwot? "..ilosc.." $",plr,255,255,255)
        end
        givePlayerMoney(taksowkarz,tonumber(ilosc))
        takePlayerMoney(plr,tonumber(ilosc))
        outputChatBox("*Podpisa?e? kwitek. Zabrano Ci "..ilosc.." $",plr,255,255,255)
        outputChatBox("*Gracz "..getPlayerName(plr).." podpisa? kwitek. Otrzymujesz "..ilosc.." $",taksowkarz,255,255,255)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 19:59


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

THX panowie
Temat do zamkni?cia !!


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-02, 20:00


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

[clo]

Podpis

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

 
Tagi: praca :: shuffle
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