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

Wysłany: 2020-02-15, 18:50


Dawidoo







Wiek: 26
Na forum: 2329 dni
Posty: 3
Nick w MP: Nostress



Respekt: 50

jak ustawi? jak chc? kupi? auto to hajs pobiera z bankomatu

Kod:




addEventHandler("onResourceStart", resourceRoot, function ()
for i,v in ipairs(slots) do
komis_shapes[i] = createColSphere(v[1], v[2], v[3], 3)
setElementData(komis_shapes[i], "i", i)
createKomisVehicle(i)

addEventHandler("onColShapeHit", komis_shapes[i], function (hit,dim)
if getElementType(hit) == "player" and getElementData(komis_shapes[i], "komis:veh") then
triggerClientEvent(hit, "onClientAddNotification", hit,"Zainteresowa? ci? ten pojazd? /kuppojazd", "info")
end
end)

end
end)

addCommandHandler("kuppojazd", function (plr, cmd)
local shape = isPlayerInVehicleColShape(plr)
if not shape then return end
local veh = getElementData(shape, "komis:veh")
if not veh then return end
local slot = getElementData(shape, "komis:slot")

local price = vehicles[slot].price
local money = getPlayerMoney(plr)
if price > money then
triggerClientEvent(plr, "onClientAddNotification", plr,"* Nie sta? ci? na kupno tego pojazdu. Id? zar?b na pracach dorywczych i wr?c p??niej!", "error")
return
end
takePlayerMoney(plr, price)

local x,y,z = getElementPosition(veh)
local rx,ry,rz = getElementRotation(veh)
local i = getElementInterior(veh)
local d = getElementDimension(veh)
local pos = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..i..", "..d

local r1,g1,b1, r2,g2,b2, r3,g3,b3, r4,g4,b4 = getVehicleColor(veh, true)
local color = r1..", "..g1..", "..b1..", "..r2..", "..g2..", "..b2

local owner = getElementData(plr, "player:sid")
local model = getElementModel(veh)
local dist = vehicles[slot].mileage
local poj = vehicles[slot].poj
local rodzaj = vehicles[slot].rodzaj
local gdzie = vehicles[slot].gdzie

destroyElement(veh)
setElementData(shape, "komis:veh", false)
setElementData(shape, "salonowe", false)

local q, num, id = exports["pystories-db"]:dbGet("INSERT INTO pystories_vehicles SET pos=?, fuel=100, bak=100, mileage=?, ownedPlayer=?, parking=1, pojemnosc_silnika=?, rodzaj=?, color=?, model=?", pos, dist, owner, poj, rodzaj, color, model)
if q then
createKomisVehicle(slot)
triggerClientEvent(plr, "onClientAddNotification", plr,"Gratulacje!\nZakupi?e? sw?j pierwszy lub kolejny pojazd na serwerze!\nPojazd zosta? przeniesiony do przechowywalni", "info")
setElementData(plr, "vehicle:desc", false)
setElementData(plr, "vehicle:mileage", vehicles[slot].mileage)
setElementData(plr, "vehicle:rodzaj", vehicles[slot].rodzaj)
setElementData(plr, "vehicle:poj", vehicles[slot].poj2)
else
triggerClientEvent(plr, "onClientAddNotification", plr," Wyst?pi? problem z kupnem pojazdu! Zg?o? to administracji serwera!", "error")
end
end)

function createKomisVehicle(slot)
if #getElementsWithinColShape(komis_shapes[slot]) > 0 then setTimer(createKomisVehicle, 250, 1, slot) return end

vehicles[slot] = {}
vehicles[slot].mileage = math.random(slots[slot].dmin, slots[slot].dmax)
vehicles[slot].price = slots[slot].price

vehicles[slot].veh = createVehicle(slots[slot].model, slots[slot][1], slots[slot][2], slots[slot][3], 0, 0, slots[slot][4])
setElementFrozen(vehicles[slot].veh, true)
setVehicleDamageProof(vehicles[slot].veh, true)
setVehicleLocked(vehicles[slot].veh, true)

setElementData(komis_shapes[slot], "komis:veh", vehicles[slot].veh)
setElementData(komis_shapes[slot], "komis:slot", slot)
setElementData(vehicles[slot].veh, "komis:veh", true)
setElementData(vehicles[slot].veh, "salonowe", true)
--setVehicleOverrideLights ( vehicles[slot].veh, 2 )
setVehicleColor(vehicles[slot].veh, 0,90,242)
setVehicleHeadLightColor(vehicles[slot].veh, 255, 255, 255)

if slots[slot].gdzie == "dohertysf" then --zwykly salon
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(2,3)
vehicles[slot].gdzie = "dohertysf"
elseif slots[slot].gdzie == "dohertysf2" then -- sportowy salon
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(3,4)
vehicles[slot].gdzie = "dohertysf2"
elseif slots[slot].gdzie == "cygan" then -- salon cygan
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(1,2)
vehicles[slot].gdzie = "cygan"
elseif slots[slot].gdzie == "sf" then -- salon motory
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(2,3)
elseif slots[slot].gdzie == "sf" then
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(6,7)
vehicles[slot].gdzie = "unikat"
elseif slots[slot].gdzie == "unikat" then
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(7,8)
vehicles[slot].gdzie = "unikat"
elseif slots[slot].gdzie == "unikat2" then
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(9,10)
vehicles[slot].gdzie = "unikat2"
elseif slots[slot].gdzie == "unikat3" then
vehicles[slot].rodzaj = "Benzyna"
vehicles[slot].poj = math.random(11,12)
vehicles[slot].gdzie = "unikat3"
end

if vehicles[slot].poj == 1 then
vehicles[slot].poj2 = 1.2
elseif vehicles[slot].poj == 2 then
vehicles[slot].poj2 = 1.6
elseif vehicles[slot].poj == 3 then
vehicles[slot].poj2 = 1.8
elseif vehicles[slot].poj == 4 then
vehicles[slot].poj2 = 2.0
elseif vehicles[slot].poj == 5 then
vehicles[slot].poj2 = 2.2
elseif vehicles[slot].poj == 6 then
vehicles[slot].poj2 = 2.5
elseif vehicles[slot].poj == 7 then
vehicles[slot].poj2 = 2.6
elseif vehicles[slot].poj == 8 then
vehicles[slot].poj2 = 2.7
elseif vehicles[slot].poj == 9 then
vehicles[slot].poj2 = 2.8
elseif vehicles[slot].poj == 10 then
vehicles[slot].poj2 = 2.9
elseif vehicles[slot].poj == 11 then
vehicles[slot].poj2 = 3.0
elseif vehicles[slot].poj == 12 then
vehicles[slot].poj2 = 3.1
end

setElementData(vehicles[slot].veh, "vehicle:desc", "Pojazd na sprzeda?!\n\nPojazd: "..getVehicleName(vehicles[slot].veh).."\nKoszt: "..slots[slot].price.." PLN\nPrzebieg: "..vehicles[slot].mileage.." km\nPojemno?? Silnika: "..vehicles[slot].poj2.." cm3\nRodzaj paliwa: "..vehicles[slot].rodzaj.."\nPojemno?? Baku: 100 L")
end

function isPlayerInVehicleColShape(player)
for i,v in ipairs(komis_shapes) do
if isElementWithinColShape(player, v) then return v end
end
return false
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-02-15, 20:02


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Przy komendzie /kuppojazd wykonaj zapytanie do bazy danych MySQL z funkcj? UPDATE.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-02-16, 13:05


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

Dawidoo, w paczce PSRPG lub CrazyRPG jest owy kod poszukaj i wklej go sobie lub zmie? skrypt na salon tylko zale?y jak? masz podstaw? aby zmieni? Skrypt.

Postaw piwo autorowi tego posta
 

 
Tagi: pobieranie :: hajsu :: banku
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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