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

Wysłany: 2019-02-25, 22:34


Mazeusz







Wiek: 31
Na forum: 2814 dni
Posty: 52
Nick w MP: Mazeusz*



Respekt: 50

Ostrzeżeń: 80%
Cze?? mam problem z tune mechanicznym z gm crpg dok?adnie problem istnieje w tym ?e jak chce co? kupi? to nie pobiera pieni?dzy i nie jest dodane do pojazdu.
DB3:

Kody

Server:

--[[
Autor: Asper
Dla: .newMode
Skrypt: Tuning v?w
Typ: Server
]]

function getVehicleHandlingProperty ( element, property )
    if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then
        local handlingTable = getVehicleHandling ( element )
        local value = handlingTable[property]

        if value then
            return value
        end
    end

    return false
end

local marker = createMarker(2483.53, 1754.61, 10.82-3, "cylinder", 5, 255, 0, 0, 100)
local blip = createBlip(2496.00, 1761.14, 10.82, 23,2,255,0,0,255,0,100) -- PILGRIM LV    

addEvent("mTuning", true)
addEventHandler("mTuning", root, function(v, i, c)
    if not v and not i and not c then return end
    local hand = getVehicleHandlingProperty(v, "driveType")
    local hajs = getElementData(source, "pieniadze")
    local bak = getElementData(v, "bak")
    bak = tonumber(bak)
    if i == "Zawieszenie hydrauliczne" then
        if getElementData(v, "zawieszenie") then
            local cx = c/2
            cx = string.format("%1.2f", cx)
            setElementData(source, "pieniadze", hajs+cx)
            exports["nm-noti"]:noti("Wymontowa?e? zawieszenie hydrauliczne\notrzymujesz "..cx.." PLN", source)
            setElementData(v, "zawieszenie", false)
            exports.mysql:wykonaj("UPDATE pojazdy SET zawieszenie=0 WHERE id=?", getElementData(v, "id"))
        else
            if hajs > c then
                c = string.format("%1.2f", c)
                setElementData(source, "pieniadze", hajs-c)
                exports["nm-noti"]:noti("Zamontowa?e? zawieszenie hydrauliczne\nza cene "..c.." PLN", source)
                setElementData(v, "zawieszenie", 2)
                exports.mysql:wykonaj("UPDATE pojazdy SET zawieszenie=1 WHERE id=?", getElementData(v, "id"))
            else
                exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
            end
        end
    elseif i == "Nap?d FWD" then
        if hand == "fwd" then 
            exports["nm-noti"]:noti("Posiadasz ju? zainstalowany nap?d FWD.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? nap?d FWD\nza cene "..c.." PLN", source)
            setVehicleHandling(v, "driveType", "fwd")
            exports.mysql:wykonaj("UPDATE pojazdy SET naped=? WHERE id=?", "fwd", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
    elseif i == "Nap?d RWD" then
        if hand == "rwd" then 
            exports["nm-noti"]:noti("Posiadasz ju? zainstalowany nap?d RWD.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? nap?d RWD\nza cene "..c.." PLN", source)
            setVehicleHandling(v, "driveType", "rwd")
            exports.mysql:wykonaj("UPDATE pojazdy SET naped=? WHERE id=?", "rwd", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
    elseif i == "Nap?d AWD" then
        if hand == "awd" then 
            exports["nm-noti"]:noti("Posiadasz ju? zainstalowany nap?d AWD.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? nap?d AWD\nza cene "..c.." PLN", source)
            setVehicleHandling(v, "driveType", "awd")
            exports.mysql:wykonaj("UPDATE vy SET naped=? WHERE id=?", "awd", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
    elseif i == "Bak 50L" then
        if bak == 50 then 
            exports["nm-noti"]:noti("Pojazd posiada ju? bak 50L.", source)
            return 
        end
        if bak == 100 or bak == 75 then 
            exports["nm-noti"]:noti("Nie mo?esz zmniejszy? baku vu.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? bak 50L\nza cene "..c.." PLN", source)
            setElementData(v, "bak", 50)
            exports.mysql:wykonaj("UPDATE pojazdy SET bak=50 WHERE id=?", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
    elseif i == "Bak 75L" then
        if bak == 75 then 
            exports["nm-noti"]:noti("Pojazd posiada ju? bak 75L.", source)
            return 
        end
        if bak == 100 then 
            exports["nm-noti"]:noti("Nie mo?esz zmniejszy? baku vu.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? bak 75L\nza cene "..c.." PLN", source)
            setElementData(v, "bak", 75)
            exports.mysql:wykonaj("UPDATE pojazdy SET bak=75 WHERE id=?", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
    elseif i == "Bak 100L" then
        if bak == 100 then 
            exports["nm-noti"]:noti("Pojazd posiada ju? bak 100L.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? bak 100L\nza cene "..c.." PLN", source)
            setElementData(v, "bak", 100)
            exports.mysql:wykonaj("UPDATE pojazdy SET bak=100 WHERE id=?", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end
-- MK1 ----------------------------------------------------------------------------------
-- MK1 ----------------------------------------------------------------------------------
    elseif i == "MK1" then
        if getElementData(v,"veh:mk1") == 1 then 
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Ten pojazd posiada zamontowane MK1!", source)    
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["crpg_powiadomienia"]:noti("#00FF00✔#FFFFFF Zamontowa?e? MK1 za "..c.." PLN!", source)    
            local handling = getVehicleHandling(v)
            setVehicleHandling(v, "engineAcceleration", handling.engineAcceleration+0.75)
            setElementData(v, "veh:mk1", 1)
            exports.mysql:wykonaj("UPDATE pojazdy SET mk1=? WHERE id=?", "1", getElementData(v, "id"))
        else
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Nie posiadasz pieni?dzy na zakup MK1!", source)
        end
-- MK2 ----------------------------------------------------------------------------------
-- MK2 ----------------------------------------------------------------------------------        
    elseif i == "MK2" then
        if getElementData(v,"veh:mk2") == 1 then 
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Ten pojazd posiada zamontowane MK2!", source)    
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["crpg_powiadomienia"]:noti("#00FF00✔#FFFFFF Zamontowa?e? MK2 za "..c.." PLN!", source)    
            local handling = getVehicleHandling(v)
            setVehicleHandling(v, "engineAcceleration", handling.engineAcceleration+1.25)
            setElementData(v, "veh:mk2", 1)
            exports.mysql:wykonaj("UPDATE pojazdy SET mk2=? WHERE id=?", "1", getElementData(v, "id"))
        else
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Nie posiadasz pieni?dzy na zakup MK2!", source)    
        end
-- MK3 ----------------------------------------------------------------------------------
-- MK3 ----------------------------------------------------------------------------------        
            elseif i == "MK3" then
        if getElementData(v,"veh:mk3") == 1 then 
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Ten pojazd posiada zamontowane MK3!", source)            
            return 
        end
        if hajs > kasa then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["crpg_powiadomienia"]:noti("#00FF00✔#FFFFFF Zamontowa?em MK3 za "..kasa.." PLN!", source)            
            local handling = getVehicleHandling(v)
            setVehicleHandling(v, "maxVelocity", handling.maxVelocity+15)
            setVehicleHandling(v, "engineAcceleration", handling.engineAcceleration+2)
            setElementData(v, "veh:mk3", 1)
            exports.mysql:wykonaj("UPDATE pojazdy SET mk3=? WHERE id=?", "1", getElementData(v, "id"))
        else
            exports["crpg_powiadomienia"]:noti("#FF0000✖#FFFFFF Nie posiadasz pieni?dzy na zakup MK3!", source)    
        end
        --[[    elseif i == "UP4 - Przyspieszenie,pr?dko?? maksymalna" then
        if getElementData(v,"up4") then 
            exports["nm-noti"]:noti("Pojazd posiada ju? UP4.", source)
            return 
        end
        if hajs > c then
            c = string.format("%1.2f", c)
            setElementData(source, "pieniadze", hajs-c)
            exports["nm-noti"]:noti("Zamontowa?e? UP4\nza cene "..c.." PLN", source)
            local handling = getVehicleHandling(v)
            setVehicleHandling(v, "maxVelocity", handling.maxVelocity+8)
            setVehicleHandling(v, "engineAcceleration", handling.engineAcceleration+1.2)
            setElementData(v, "up4", true)
            exports.mysql:wykonaj("UPDATE pojazdy SET duklad=1 WHERE id=?", getElementData(v, "id"))
        else
            exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
        end]]
    if i == "CB Radio" then
        if getElementData(v, "veh:cb") then
            local cx = c/2
            setElementData(source, "pieniadze", hajs+cx)
            exports["nm-noti"]:noti("Wymontowa?e? CB-radio\notrzymujesz "..cx.." PLN", source)
            setElementData(v, "veh:cb", false)
            exports.mysql:wykonaj("UPDATE pojazdy SET cb=0 WHERE id=?", getElementData(v, "id"))
        else
            if hajs > c then
                setElementData(source, "pieniadze", hajs-c)
                exports["nm-noti"]:noti("Zamontowa?e? CB-radio\nza cene "..c.." PLN", source)
                setElementData(v, "veh:cb", 1)
                exports.mysql:wykonaj("UPDATE pojazdy SET cb=1 WHERE id=?", getElementData(v, "id"))
            else
                exports["nm-noti"]:noti("Brak wystarczaj?cych funduszy.", source)
            end
        end
    end
    end
end)


Client:

--[[
Autor: Asper
Dla: .newMode
Skrypt: Tuning pojazd?w
Typ: Client
]]

local sx, sy = guiGetScreenSize()
local cuboid = createColCuboid(2135.73, -2192.62, 13.10, 4, 3, 5)  
local wb = guiCreateGridList(0.40, 0.11, 0.19, 0.17, true)
local nazwa = guiGridListAddColumn(wb, "Nazwa", 0.4)
local cena = guiGridListAddColumn(wb, "Cena", 0.2)
guiSetVisible(wb, false)

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local tuning = {
{"MK1", 35000},
{"MK2", 55000},
{"MK3", 75000},
{"CB Radio",10000},
{"Zawieszenie hydrauliczne", 30000},
{"Nap?d FWD", 10000},
{"Nap?d RWD", 10000},
{"Nap?d AWD", 15000},
{"Bak 50L", 15000},
{"Bak 75L", 30000},
{"Bak 100L", 45000},
}

local screenW, screenH = guiGetScreenSize()

local czcionka = dxCreateFont(":crpg_fonty/f.ttf", 14)
if not czcionka then czcionka = "default-bold" end

function dxDrawButton(x, y, w, h, color)
  local color2 = tocolor(0,94,254)
  dxDrawRectangle(x, y, w, h, color, false)
  dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
  dxDrawRectangle(x-0.4660164, y + h-1.6, w+1.5, 2, color2, false)
  dxDrawRectangle(x - 1, y + 2, 1, h - 3, color, false)
  dxDrawRectangle(x + w, y + 2, 1, h - 3, color, false)
end

function gui()
        dxDrawButton(screenW * 0.3792, screenH * 0.0370, screenW * 0.2313, screenH * 0.3346, tocolor(15, 15, 15, 200))
        dxDrawRectangle(screenW * 0.3788, screenH * 0.0360, screenW * 0.2320, screenH * 0.0580, tocolor(0, 94, 254, 200), false)
        dxDrawBorderedText("Tuning Mechaniczny", screenW * 0.7600, screenH * 0.0725, screenW * 0.2320, screenH * 0.0580, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
          if mysz(screenW * 0.3909, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599) then
            dxDrawButton(screenW * 0.3909, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599, tocolor(0, 94, 254, 175), false)
        else
            dxDrawButton(screenW * 0.3909, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599, tocolor(15, 15, 15, 175), false)
        end
           if mysz(screenW * 0.5007, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599) then
            dxDrawButton(screenW * 0.5007, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599, tocolor(0, 94, 254, 175), false)
        else
            dxDrawButton(screenW * 0.5007, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599, tocolor(15, 15, 15, 175), false)
        end      
        dxDrawBorderedText("Akceptuj", screenW * 0.3909, screenH * 0.0948, screenW * 0.4905, screenH * 0.5547, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
        dxDrawBorderedText("Anuluj", screenW * 0.5000, screenH * 0.0948, screenW * 0.5996, screenH * 0.5547, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
end

addEventHandler("onClientClick", root, function(b, s)
    if b ~= "state" and s ~= "down" then return end
    if mysz(screenW * 0.5007, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599) and guiGetVisible(wb) == true then
        setElementData(localPlayer, "hud", false)        
        guiSetVisible(wb, false)
        showCursor(false)    
        showChat(true)
          showPlayerHudComponent("radar", true)            
        local p = getPedOccupiedVehicle(localPlayer)
        setElementFrozen(p, false)
        removeEventHandler("onClientPreRender", root, gui)
    elseif mysz(screenW * 0.3909, screenH * 0.2948, screenW * 0.0996, screenH * 0.0599) and guiGetVisible(wb) == true then
        local wy = guiGridListGetSelectedItem(wb)
        local nazwa = guiGridListGetItemText(wb, wy, 1)
        local cena = guiGridListGetItemText(wb, wy, 2)
        cena = tonumber(cena)
        local p = getPedOccupiedVehicle(localPlayer)
        triggerServerEvent("mTuning", localPlayer, p, nazwa, cena)
    end
end)

addEventHandler("onClientMarkerHit", resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if not isPedInVehicle(hit) then return end
    if #getElementsWithinColShape(cuboid, "vehicle") == 1 then
        exports["nm-noti"]:noti("Tuning jest w tej chwili u?ywany.")
        return
    end
    local p = getPedOccupiedVehicle(hit)
    if getVehicleController(p) ~= hit then return end
    if getElementData(p, "wlasciciel") ~= getElementData(hit, "dbid") then return end
    setElementData(localPlayer, "hud", true)    
    guiSetVisible(wb, true)
    showCursor(true)    
    showChat(false)    
      showPlayerHudComponent("radar", false)        
    setElementFrozen(p, true)
    addEventHandler("onClientPreRender", root, gui)
end)

function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text:gsub('#%x%x%x%x%x%x', ''), x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, true )
end

addEventHandler("onClientResourceStart", resourceRoot, function()
    for k,v in ipairs(tuning) do
        local r = guiGridListAddRow(wb)
        guiGridListSetItemText(wb, r, nazwa, v[1], false, false)
        local cx = v[2]
        cx = string.format("%1.2f", cx)
        guiGridListSetItemText(wb, r, cena, cx, false, false)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-26, 18:19


ReDsKill







Wiek: 25
Na forum: 3397 dni
Posty: 35
Nick w MP: ReDsKill

Piwa: 1581

Respekt: 40,5

Paczka z kt?rej bra?e? owy skrypt mia?a swoje el daty "pieniadze" domy?lam si? ?e masz paczk? ogrpg wi?c spr?buj:
takePlayerMoney
oraz
getPlayerMoney

Podpis
Aktualny projekt: Santori RPG

Discord serwera: https://discord.gg/2BFEuSW
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-26, 18:34


Mazeusz







Wiek: 31
Na forum: 2814 dni
Posty: 52
Nick w MP: Mazeusz*



Respekt: 50

Ostrzeżeń: 80%
Mam paczke pys. Tylko co mam spr?bowa? z tym takePlayerMoney i getPlayerMoney

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-26, 20:44


Gravgor







Wiek: 22
Na forum: 3760 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Musisz te edaty pozamienia? na takePlayerMoney oraz getPlayerMoney, inaczej tego nie rozwi??esz.

Postaw piwo autorowi tego posta
 

 
Tagi: tune :: mechaniczne :: nie :: dziala
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