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

Wysłany: 2016-04-03, 12:21


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

Lock

Ostatnio zmieniony przez Patrix100 2016-04-06, 17:24, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 12:24


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3


Więcej informacji znajdziesz w Wikipedii MTA:

getDistanceBetweenPoints3D


Albo tworzysz na pojazdach colshape lub marker.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 12:29


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

"AteX" napisał/a:


Więcej informacji znajdziesz w Wikipedii MTA:

getDistanceBetweenPoints3D


Albo tworzysz na pojazdach colshape lub marker.

Jakis przyklad czy co?? Bo nie ogarniam :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 12:36


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

addCommandHandler("kuppojazd",function(plr,cmd)
 local x,y,getElementPosition(plr)
 for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do
  if getElementData(v,"vehicle.selling"then
   local x1,y1,z1 getElementPosition(v)
   if getDistanceBetweenPoints3D(x,y,z,x1,y1,z1) < 5 then
    -- tu umiesc kupowanie pojazdu
   return end
  end
 end
end)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 13:17


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

"AteX" napisał/a:

addCommandHandler("kuppojazd",function(plr,cmd)
 local x,y,getElementPosition(plr)
 for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do
  if getElementData(v,"vehicle.selling"then
   local x1,y1,z1 getElementPosition(v)
   if getDistanceBetweenPoints3D(x,y,z,x1,y1,z1) < 5 then
    -- tu umiesc kupowanie pojazdu
   return end
  end
 end
end)

A to nie bedzie przypadkiem tak ze jak wejdzie w marker to bedzie kupowac wszystkie auta?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 13:24


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Tu nie ma markera, to sprawdza tylko odleg?o?? pojazdu. Tak poza tym bez test?w si? nie dowiesz.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 17:31


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

Zrobi?em tak i nie dzia?a. Trzeba wej?? do auta ?eby kupi?.
local positionVehicles = {
    -- nazwamodelprzebiegcenax,y,z,rx,ry,rzsprzeda?
    -- salon 
    --{'Manana'410050002220.04175, -123.3893228.46326359.2360.0129.9},
    {'Ocenic'46708563, -1957.03299.6435.21359.6360.0140.1},
    {'Premier'426016139, -1948.72268.6035.22360.0359.943.6},
    {'Tahoma'566011431, -1951.49260.4235.250.40.140.7},
    {'Vincent'540013794, -1955.89258.1140.91359.7360.01.1},
    {'Clover'54208853, -1946.46261.4840.83360.0360.048.9},
    {'Blista Compact'496021237, -1948.25270.7440.770.0360.053.0},
    {'Tampa'54907653, -1955.07300.7740.74360.0360.0181.7},
    

}

for i,v in pairs(positionVehicles) do
    local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
    setElementData(veh,'pojazd_opis','Model: '..v[1]..'\nCena: '..v[4]..' Eur\nPrzebieg: '..v[3]..' km\nAby kupi? pojazd wsi?dz na miejsce kierowcy i wpisz /kuppojazd')
    setVehicleOverrideLights(veh1)
    setElementFrozen(veh,true)
    setVehicleDamageProof(vehtrue)
    setElementData(veh,'vehicle.selling'true)
    setVehicleLocked(vehtrue)
    setVehicleColor(veh0112141)


    veh:setData('vehsell:info', {
        ['cost']=v[4],
        ['model']=v[2],
        ['mileage']=v[3],
        ['selling']=v[12]
    }, false)
end

addEventHandler('onVehicleEnter'resourceRoot, function(plrseatjacked)
    if seat~=0 then return end
    if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
        plr:outputChat('* Pojazd nie jest dost?pny w sprzeda?y.'25500)
        return
    end

    local data=source:getData('vehsell:info')
    if not data then return end

    plr:setData('vehsell:info', {
        ['cost']=data.cost,
        ['model']=data.model,
        ['mileage']=data.mileage,
    }, false)

    plr:outputChat('* Aby zakupi? ten pojazd wpisz /kuppojazd',0,128,255)
end)

addEventHandler('onVehicleExit'resourceRoot, function(plrseatjackedm)
    if seat~=0 then return end

    local data=plr:getData('vehsell:info')
    if not data then return end

    plr:removeData('vehsell:info')
end)

    Timer(function() 
        destroyElement(blip) 
    end60000*21)

addCommandHandler("kuppojazd",function(plr,cmd)
 local x,y,getElementPosition(plr)
 for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do
  if getElementData(v,"vehicle.selling"then
   local x1,y1,z1 getElementPosition(v)
   if getDistanceBetweenPoints3D(x,y,z,x1,y1,z1) < 5 then
    local data=plr:getData('vehsell:info')
    if not data then return end

    if getPlayerMoney(plr) < data.cost then
        outputChatBox('* Nie posiadasz wystarczaj?cej ilo?ci PLN.'plr25500)
        return
    end

    local vehicle=plr:getOccupiedVehicle()
    if vehicle then
        removePedFromVehicle(vehicle)
    end

    local cost=data.cost
    local model=data.model
    local mileage=data.mileage
    local uid=getElementData(plr,'player:uid') or 0
    takePlayerMoney(plrcost)
    
    exports['db']:dbGet('INSERT INTO ogrpg_vehicles (model, frozen, ownedPlayer, parking, fuel) VALUES (?, ?, ?, ?, ?)'model0getElementData(plr,'player:uid'), 115)
    outputChatBox('* Zakupi?e? sw?j pojazd, id? do przechowalni (Dyskietka na mapie), i odbierz go.'plr,0,175,0,true)
   return end
  end
 end
end)


Podpis
Pomogłem? Wystarczy że podziękujesz albo dasz respekt :D
Wole respekt niz piwka :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-03, 17:33


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

To nie wystarczy kopiuj wklej, skoro to by?o robione pod wsiadanie to trzeba to jeszcze edytowa?.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Tagi: lock
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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