Jump to content

NieZnanyUserOk

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by NieZnanyUserOk

  1.     local vehicle=plr:getOccupiedVehicle()
        if vehicle then
            removePedFromVehicle(vehicle)
        end
    
        local cost=vehicle:getData("cost")
        local model=getElementModel(vehicle)
        local mileage=vehicle:getData("vehicle:mileage")
        local pojemnosc=vehicle:getData("vehicle:poj")
        local uid=getElementData(plr,'player:sid') or 0
        if getElementData(plr, "salon:payment:cash") == true then 
        takePlayerMoney(plr, cost)
        else 
            local ilosc_kasy = exports["pystories-db"]:dbGet("SELECT bank_money FROM pystories_users WHERE id=" .. getElementData(plr, "player:sid") .. " LIMIT 1")
            local kasa=ilosc_kasy[1]
            if kasa.bank_money < cost then
                triggerClientEvent(plr, "createNotif",plr,"Nie posiadasz "..cost.." $!",3,"error")
                return
            end
            exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-" .. cost .. " WHERE id=" .. uid .. " LIMIT 1")
        end
        exports["pystories-db"]:dbSet("INSERT INTO pystories_vehicles (model,ownedPlayer,mileage,registered,parking,engine,color,fuel) VALUES (?,?,?,?,1,?,?,?)", model, getElementData(plr,"player:sid"),przebieg,"false",typSilnika,rgb,paliwo) -- Error Here!!!!!!!!!!!!!!!!!!!!!!
        end
        exports["pystories-db"]:dbSet("INSERT INTO logi_salon (Model,Cena,Kto) VALUES (?,?,?)",getVehicleNameFromModel(model),cost,getPlayerName(plr):gsub("#%x%x%x%x%x%x",""))
    end)

     

    Please help me.
    Debugscript 3 - 

    1. ')' expected (to close ')' near exports
  2. My point is that after entering the marker, the player receives a message on the custom chat
    In addition, I gave the contents of the c.lua file from the chat and from the script to which I want to add it.

  3. If resource start console error

    ERROR: Loading script failed: [ Main ]/[ Factions ]/[ LSPD ]/VCSMTA_LSPD-Frakcja/s_duty.lua:64: '=' expected near '-'

    addEvent("RozpocznijSAPD",true)
    addEventHandler("RozpocznijSAPD",root,function(el)
        if isPlayerInPoliceFaction(el) then
             if not getElementData(el,'player:faction') then
    			exports['psrpg-frakcja-ustawienia']:rozpocznijnaliczanie(el)
    			setElementData(el,'player:faction','SAPD')
    			local rank = exports['psrpg-frakcja-ustawienia']:getPlayerFactionRank(el,'SAPD')
    			setElementData(el,"player:rank",rank)
    			setPedStat(el,78,1000)
    			setPedStat(el,70,1000)
    			setElementData(el,"last:nick",getPlayerName(el))
    			setElementData(el,"last:color",tostring(getPlayerNametagColor(el)))
    			setPlayerName(el,"#0000FF"..getPlayerName(el):gsub("#%x%x%x%x%x%x",""))
    			outputChatBox ("✔ #FFFFFFRozpocząłeś/aś służbe we frakcji: #00c005SAPD #FFFFFF(#00c005San Andreas Police Department#FFFFFF)",el, 0, 255, 0, true)
    			local desc = "[Służba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." rozpoczął służbe we frakcji: SAPD"
    			triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
    			triggerEvent("admin:logs", root, desc)
    			outputServerLog(desc)
    			exports["pystories-db"]:dbSet("UPDATE pystories_factions set actived=NOW() WHERE code=? AND sid=? LIMIT 1;", "SAPD", getElementData(el,"player:sid"))
    			else
    			exports["pystories-db"]:dbSet("insert into Logi_minuty_frakcja (uid,minuty,data) VALUES(?,?,NOW())", getElementData(el,"player:sid"), getElementData(el,"player:workinjob"))
    			removeElementData(el,"player:workinjob69")
    			takeAllWeapons(el)
    			exports['psrpg-frakcja-ustawienia']:zatrzymajnaliczanie(el)
    			setElementData(el, 'player:faction', false)
    			setElementData(el,"player:rank",false)
    			local skin=getElementData(el,"player:skin")
    			setElementModel(el, skin)
    			setPlayerName(el,getElementData(el,"last:nick"))
    			outputChatBox ("✘ #FFFFFFZakończyłeś/aś służbe we frakcji: #00c005SAPD #FFFFFF(#00c005San Andreas Police Department#FFFFFF)",el, 255, 0, 0, true)
    			local desc = "[Służba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." zakończył służbe we frakcji: SAPD"
    			triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
    			triggerEvent("admin:logs", root, desc)
    			outputServerLog(desc)
    	end
    else
    			outputChatBox ("✘ #FFFFFFNie jesteś zatrudniony/a we frakcji: #bf0101SAPD #FFFFFF(#bf0101San Andreas Police Department#FFFFFF)",el, 255, 0, 0, true)
    			exports.VCSMTA-Chat.sendMessage("Work"); -- Export here
    	end
    end)

     

  4. I've already tried mta wiki but it failed. Would you help?

     

    local screenW, screenH = guiGetScreenSize()
    local resW, resH = 1360,768
    local x, y = (screenW/resW), (screenH/resH)
    showChat(false)
    
    function vazernImage(posX, posY, width, height, image, rotation, rotationX, rotationY, color, postGUI)
        dxDrawImage(x*posX, y*posY, x*width, y*height, image, rotation, rotationX, rotationY, color, postGUI)
    end
    
    function vazernText(text, posX, posY, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning)
        dxDrawText(text, x*posX, y*posY, x*width, y*height, color, x*scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning)
    end
    
    chatEdit = {}
    chatEdit.dxEdit = false
    
    local chatBox = createElement("dxEditBox")
    
    AllKeys = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u",
     "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
     "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5",
     "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "num_enter", "F1", "F2", "F3", "F4", "F5",
     "F6", "F7", "F8", "F9", "F10", "F11", "F12", "escape", "backspace", "tab", "lalt", "ralt", "space", "pgup", "pgdn", "end", "home",
     "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" }
    
    addEventHandler("onClientKey", root, 
        function(button, press)
            for index, keys in pairs(AllKeys) do
                if getElementData(chatBox,"state") == true then
                    if button == keys then
                        cancelEvent()
                    end
                end
            end
        end
    )
    
    setTimer(function()
        if isChatVisible() then
            showChat(false)
        end
    end, 500, 0)
    local teclaText = ""
    function renderEdit()
        dxDrawEditBox("Uzywasz teraz chatu "..teclaText, x*4, y*220, x*504, y*25, false, 49, chatBox)
    end
    
    function onStart()
        showCursor(false)
        showChat(false)
        chatEdit.dxEdit = false
        setElementData(chatBox, "state", false)    
    end
    addEventHandler("onClientResourceStart", resourceRoot, onStart)
    local tecla = nil
    function renderDx(key, state)
        if state ~= "down" then return end
        if chatEdit.dxEdit == false then
            if key == "u" then teclaText = "Globalnego" end
            if key == "n" then teclaText = "Jako nie znajomy" end
            if key == "t" then teclaText = "Lokalnego" end
            chatEdit.dxEdit = true
            addEventHandler("onClientRender", root, renderEdit)
            setElementData(chatBox, "text", false)
            setElementData(chatBox, "state", true)
            showCursor(true)
            tecla = key
        end
    end
    bindKey("u", "down", renderDx) -- Global
    bindKey("n", "down", renderDx) -- Nieznany
    bindKey("t", "down", renderDx) -- Local
    
    function sendMessage()
        if chatEdit.dxEdit == true then
                chatEdit.dxEdit = false
                if getElementData(chatBox, "text") == "" then
                else
                    if string.find(getElementData(chatBox, "text"), "@") then
                        addMessageInChatBox('#8A2BE2[ INFORMACJA ] #ffffffNie możesz aktualnie nikogo #8A2BE2Oznaczać', "16")
                    else
                        if string.find(getElementData(chatBox, "text"), "z neta") or string.find(getElementData(chatBox, "text"), "staff") then
                            addMessageInChatBox("#8A2BE2[ INFORMACJA ] #ffffff"..getPlayerName(localPlayer).." #ffffffSłuchaj, jak Ci coś nie pasuje to #8A2BE2Wypierdalaj!", "16")
                        else
                            if string.find(getElementData(chatBox, "text"), "mtasa://") then
                                addMessageInChatBox("#8A2BE2[ INFORMACJA ] #ffffff"..getPlayerName(localPlayer).." #ffffffTutaj się nie zareklamujesz, idź grać w  #8A2BE2Fortnita", "16")
                            else
                                if string.find(getElementData(chatBox, "text"), "/") then
                                    addMessageInChatBox("#8A2BE2[ INFORMACJA ] #ffffff"..getPlayerName(localPlayer).." #ffffffUżywanie komend jest dostępne tylko pod klawiszem #8A2BE2'F8'", "16")
                                    addMessageInChatBox("#ffffffAnimacje dostepne sa pod klawiszem #8A2BE2'F7'", "16")
                            else
                                triggerServerEvent("onSendMessage", localPlayer, getElementData(chatBox, "text"), tecla)
    		            end
                            end
                        end
                    end
                end
                setElementData(chatBox, "text", false)
                setElementData(chatBox, "state", false)
                removeEventHandler("onClientRender", root, renderEdit)
                showCursor(false)
                tecla = nil
        end
    end
    bindKey("enter", "down", sendMessage)
    
    
    local sx,sy = guiGetScreenSize()
    local px,py = 1360,768
    local x2,y2 = (sx/px), (sy/py)
    local dxfont2_font = dxCreateFont("font/fonte.ttf", x2*10, false, "cleartype_natural")
    
    messages = {}
    
    function renderMensages()       
        tickJ = getTickCount()
        
        if #messages > 7 then
            table.remove(messages, 1)
        end 
        
        for i, v in ipairs(messages) do
            
            local xx = dxGetTextWidth(v[1], 1, dxfont2_font, true)
            _dxDrawRectangle( x2*35, y2*2 + (i*y2*27), xx + 13, y2*25, 20, tocolor(0, 0, 0, 90), false )  
            dxDrawText(v[1], x2*42, y2*6 + (i*y2*27), (x2*42)+(xx + 13), (y2*6 + (i*y2*27))+(y2*17), tocolor(255, 255, 255, 255), 1, dxfont2_font, "left", "center", false, false, false, true, false)      
            if tickJ >= v[2] then
                messages[i][3] = v[3]-2
                if v[3] <= 25 then
                    table.remove(messages,i)
                end
            end
        end
    end
    addEventHandler("onClientRender", root, renderMensages) 
    
    function _dxDrawRectangle( posX, posY, width, height, radius, color, postGUI )  
        local posX, posY, width, height = round( posX ), round( posY ), round( width ), round( height )
        local radius = radius and math.min( radius, math.min( width, height ) / 2 )  or 12
        
        dxDrawRectangle( posX, posY + radius, width, height - radius * 2, color, postGUI )
        dxDrawRectangle( posX + radius, posY, width - 2 * radius, radius, color, postGUI )
        dxDrawRectangle( posX + radius, posY + height - radius, width - 2 * radius, radius, color, postGUI )
        
        dxDrawCorner( posX + radius, posY + radius, radius, color, 1, postGUI )
        dxDrawCorner( posX + radius, posY + height - radius, radius, color, 2, postGUI )
        dxDrawCorner( posX + width - radius, posY + radius, radius, color, 3, postGUI )
        dxDrawCorner( posX + width - radius, posY + height - radius, radius, color, 4, postGUI )
    end
    
    function round(num) 
        if ( num >= 0 ) then return math.floor( num + .5 ) 
        else return math.ceil( num - .5 ) end
    end
    
    function dxDrawCorner( x, y, r, color, corner, postGUI )
        local corner = corner or 1
        local start = corner % 2 == 0 and 0 or -r
        local stop = corner % 2 == 0 and r or 0
        local m = corner > 2 and -1 or 1
        local h = ( corner == 1 or corner == 3 ) and -1 or 1
        for yoff = start, stop do
            local xoff = math.sqrt( r * r - yoff * yoff ) * m
            dxDrawRectangle( x - xoff, y + yoff, xoff, h, color, postGUI )
        end 
    end
    
    function addMessageInChatBox(message, avatar)
        tickJ = getTickCount()
        table.insert(messages, {message, tickJ+99999999, 90, avatar})
    end
    addEvent("addMessageInChatBox", true)
    addEventHandler("addMessageInChatBox", resourceRoot, addMessageInChatBox)
    
    function removeAllMessage()
        messages = {}
        tickJ = getTickCount()
        table.insert(messages, {"#fca903* #ffffffChat został wyczyszczony przez #ff0000Administratora #fca903*", tickJ+99999999, 90, "i"})
    end
    addEvent("removeAllMessage", true)
    addEventHandler("removeAllMessage", resourceRoot, removeAllMessage)
    
    function isCursorOnElement( posX, posY, width, height )
      if isCursorShowing( ) then
        local mouseX, mouseY = getCursorPosition( )
        local clientW, clientH = guiGetScreenSize( )
        local mouseX, mouseY = mouseX * clientW, mouseY * clientH
        if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then
          return true
        end
      end
      return false
    end
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    C.lua ( CHat )

  5. Hello, I would like to export custom chat instead of outputchatbox

    c.lua ( Chat )
    https://www19.zippyshare.com/v/0uuzYmdN/file.html

    replace chatoutput
     

    addEvent("RozpocznijSAPD",true)
    addEventHandler("RozpocznijSAPD",root,function(el)
        if isPlayerInPoliceFaction(el) then
             if not getElementData(el,'player:faction') then
    			exports['psrpg-frakcja-ustawienia']:rozpocznijnaliczanie(el)
    			setElementData(el,'player:faction','SAPD')
    			local rank = exports['psrpg-frakcja-ustawienia']:getPlayerFactionRank(el,'SAPD')
    			setElementData(el,"player:rank",rank)
    			setPedStat(el,78,1000)
    			setPedStat(el,70,1000)
    			setElementData(el,"last:nick",getPlayerName(el))
    			setElementData(el,"last:color",tostring(getPlayerNametagColor(el)))
    			setPlayerName(el,"#0000FF"..getPlayerName(el):gsub("#%x%x%x%x%x%x",""))
    			outputChatBox ("✔ #FFFFFFRozpocząłeś/aś służbe we frakcji: #00c005SAPD #FFFFFF(#00c005San Andreas Police Department#FFFFFF)",el, 0, 255, 0, true)
    			local desc = "[Służba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." rozpoczął służbe we frakcji: SAPD"
    			triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
    			triggerEvent("admin:logs", root, desc)
    			outputServerLog(desc)
    			exports["pystories-db"]:dbSet("UPDATE pystories_factions set actived=NOW() WHERE code=? AND sid=? LIMIT 1;", "SAPD", getElementData(el,"player:sid"))
    			else
    			exports["pystories-db"]:dbSet("insert into Logi_minuty_frakcja (uid,minuty,data) VALUES(?,?,NOW())", getElementData(el,"player:sid"), getElementData(el,"player:workinjob"))
    			removeElementData(el,"player:workinjob69")
    			takeAllWeapons(el)
    			exports['psrpg-frakcja-ustawienia']:zatrzymajnaliczanie(el)
    			setElementData(el, 'player:faction', false)
    			setElementData(el,"player:rank",false)
    			local skin=getElementData(el,"player:skin")
    			setElementModel(el, skin)
    			setPlayerName(el,getElementData(el,"last:nick"))
    			outputChatBox ("✘ #FFFFFFZakończyłeś/aś służbe we frakcji: #00c005SAPD #FFFFFF(#00c005San Andreas Police Department#FFFFFF)",el, 255, 0, 0, true)
    			local desc = "[Służba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." zakończył służbe we frakcji: SAPD"
    			triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
    			triggerEvent("admin:logs", root, desc)
    			outputServerLog(desc)
    	end
    else
    			outputChatBox ("✘ #FFFFFFNie jesteś zatrudniony/a we frakcji: #bf0101SAPD #FFFFFF(#bf0101San Andreas Police Department#FFFFFF)",el, 255, 0, 0, true)
    	end
    end)



    In short, my point is to swap all outputs PutChatBox To message about custom chat.

    How to export cutom chat message?

    @The_GTA

  6. Could you send lightly ready code? As I am new and I do not understand too much, please send only the beginning of the code

     

    TrybInterakcji = false
    
    local sx, sy = guiGetScreenSize()
    local px, py = (sx/1920), (sy/1080)
    
    function isMouseIn ( x, y, width, height )
    	if ( not isCursorShowing( ) ) then
    		return false
    	end
        local sx, sy = guiGetScreenSize ( )
        local cx, cy = getCursorPosition ( )
        local cx, cy = ( cx * sx ), ( cy * sy )
        if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
            return true
        else
            return false
        end
    end
    
    local font = dxCreateFont("font.ttf", 15)
    
    function gui()
        dxDrawImage(0*px, 0*py, 1920*px, 1080*py, "screen.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Test", 255*px, 268*py, 100*px, 40*py, tocolor(255, 255, 255), 1.0*px, font, "center", "top",false,false,false,true)
    end
    
    bindKey("F2", "down", function()
            TrybInterakcji = true
            addEventHandler("onClientRender", root, gui)
            showCursor(true)
    	end
        end
    end

    Where is problem?

     

    unknown.png

×
×
  • Create New...