Jump to content

Dumper

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by Dumper

  1. Hello, the following conversation bubble does not appear by other people.

    The writer see at the person

    c_chat

    local bubbles = {} -- {text, player, lastTick, alpha, yPos}
    local fontHeight = 22
    local characteraddition = 50
    local maxbubbles = 5
    local selfVisible = true -- Want to see your own message?
    local timeVisible = 5000
    local distanceVisible = 20
    
    function addText(source, text, color, font, sticky, type)
    	if getElementData(localPlayer, "graphic_chatbub") == "0" then
    		return
    	end
    
    	if not bubbles[source] then
    		bubbles[source] = {}
    	end
    
    	local tick = getTickCount()
    	local info = {
    		text = text,
    		player = source,
    		color = color or {255, 255, 255},
    		tick = tick,
    		expires = tick + (timeVisible + #text * characteraddition),
    		alpha = 0,
    		sticky = sticky,
    		type = type
    	}
    
    	if sticky then
    		table.insert(bubbles[source], 1, info)
    	else
    		table.insert(bubbles[source], info)
    	end
    
    	if #bubbles[source] > maxbubbles then
    		for k, v in ipairs(bubbles[source]) do
    			if not v.sticky then
    				table.remove(bubbles[source], k)
    				break
    			end
    		end
    	end
    end
    
    addEvent("addChatBubble", true)
    addEventHandler("addChatBubble", root,
    	function(message, command)
    		if source ~= localPlayer or selfVisible then
    			if command == "ado" or command == "ame" then
    				addText(source, message, { 255, 51, 102 }, "default-bold", false, command)
    			else
    				addText(source, message)
    			end
    		end
    	end
    )
    
    function removeTexts(player, type)
    	local t = bubbles[player] or {}
    	for i = #t, 1, -1 do
    		if t[i].type == type then
    			table.remove(t, i)
    		end
    	end
    
    	if #t == 0 then
    		bubbles[player] = nil
    	end
    end
    
    -- Status
    addEventHandler("onClientElementDataChange", root, function(n)
    	if n == "chat:status" and getElementType(source) == "player" then
    		updateStatus(source, "status")
    	end
    end)
    addEventHandler("onClientResourceStart", resourceRoot, function()
    	for _, player in ipairs(getElementsByType("player")) do
    		if getElementData(player, "chat:status") then
    			updateStatus(player, "status")
    		end
    	end
    end)
    
    function updateStatus(source, n)
    	removeTexts(source, n)
    	if getElementData(source, "chat:status") then
    		addText(source, getElementData(source, "chat:status"), {136, 87, 201}, "default-bold", true, n)
    	end
    end
    
    --
    -- outElastic | Got from https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua
    -- For all easing functions:
    -- t = elapsed time
    -- b = begin
    -- c = change == ending - beginning
    -- d = duration (total time)
    -- a: amplitud
    -- p: period
    local pi = math.pi
    function outElastic(t, b, c, d, a, p)
      if t == 0 then return b end
    
      t = t / d
    
      if t == 1 then return b + c end
    
      if not p then p = d * 0.3 end
    
      local s
    
      if not a or a < math.abs(c) then
        a = c
        s = p / 4
      else
        s = p / (2 * pi) * math.asin(c/a)
      end
    
      return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + b
    end
    
    local function renderChatBubbles()
    	if getElementData(localPlayer, "graphic_chatbub") ~= "0" then
    		local square = getElementData(localPlayer, "graphic_chatbub_square") ~= "0"
    		local tick = getTickCount()
    		local x, y, z = getElementPosition(localPlayer)
    		for player, texts in pairs(bubbles) do
    			if isElement(player) then
    				for i, v in ipairs(texts) do
    					if tick < v.expires or v.sticky then
    						local px, py, pz = getElementPosition(player)
    						local dim, pdim = getElementDimension(player), getElementDimension(localPlayer)
    						local int, pint = getElementInterior(player), getElementInterior(localPlayer)
    
    						if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < distanceVisible and isLineOfSightClear ( x, y, z, px, py, pz, true, not isPedInVehicle(player), false, true) and pdim == dim and pint == int then
    							v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha
    							local bx, by, bz = getPedBonePosition(player, 6)
    							local sx, sy = getScreenFromWorldPosition(bx, by, bz)
    
    							local elapsedTime = tick - v.tick
    							local duration = v.expires - v.tick
    
    							if sx and sy then
    								if not v.yPos then v.yPos = sy end
    								local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold")
    								local yPos = outElastic(elapsedTime, v.yPos - 20, (sy - fontHeight*i ) - v.yPos - 10, 1000, 5, 500)
    
    								if square then
    									dxDrawRectangle(sx - (12 + (0.5 * width)), yPos - 2, width + 23, 19, tocolor(20, 20, 20, 200))
    									dxDrawRectangle(sx - (12 + (0.5 * width)), yPos + 16, width + 23, 1, tocolor(v.color[1], v.color[2], v.color[3], 255))
    										-- All but /say
    										--(v.type == "ado" or v.type == "ame" or v.type == "status") and tocolor(v.color[1], v.color[2], v.color[3], 255) or tocolor(0, 0, 0, 255))
    								else
    									dxDrawRectangle(sx - (3 + (0.5 * width)),yPos - 2,width + 5,19,tocolor(0,0,0,bg_color))
    									dxDrawRectangle(sx - (6 + (0.5 * width)),yPos - 2,width + 11,19,tocolor(0,0,0,40))
    									dxDrawRectangle(sx - (8 + (0.5 * width)),yPos - 1,width + 15,17,tocolor(0,0,0,bg_color))
    									dxDrawRectangle(sx - (10 + (0.5 * width)),yPos - 1,width + 19,17,tocolor(0,0,0,40))
    									dxDrawRectangle(sx - (10 + (0.5 * width)),yPos + 1,width + 19,13,tocolor(0,0,0,bg_color))
    									dxDrawRectangle(sx - (12 + (0.5 * width)),yPos + 1,width + 23,13,tocolor(0,0,0,40))
    									dxDrawRectangle(sx - (12 + (0.5 * width)),yPos + 4,width + 23,7,tocolor(0,0,0,bg_color))
    								end
    								dxDrawText(v.text, sx - (0.5 * width), yPos, sx - (0.5 * width), yPos - (i * fontHeight), tocolor(unpack(v.color)), 1, "default-bold", "left", "top", false, false, false)
    							end
    						end
    					else
    						table.remove(bubbles[player], i)
    					end
    				end
    
    				if #texts == 0 then
    					bubbles[player] = nil
    				end
    			else
    				bubbles[player] = nil
    			end
    		end
    	end
    end
    
    addEventHandler("onClientPlayerQuit", root, function() bubbles[source] = nil end)
    addEventHandler("onClientRender", root, renderChatBubbles)
    --

     

    s_chat.lua
     

    triggerClientEvent(source,"addChatBubble",source,message)

    Help me please...

  2. Server.lua
     

    addEvent("oyuncuBilgisi", true)
    addEventHandler("oyuncuBilgisi", getRootElement(), function(hedef, theVehicle)
    	 for key, value in ipairs(exports.pool:getPoolElementsByType("vehicle")) do
    		local owner = tonumber(getElementData(value, "owner"))
    		
    				local dbid2 = getElementData(theVehicle, "dbid")
    	    local fetchData = mysql:query_fetch_assoc( "SELECT `fiyat` FROM `vehicles` WHERE `id`='"..mysql:escape_string(getElementData(value, "dbid")).."'" )
            local fiyat = fetchData["fiyat"] or 0
    
    
    	end
    		triggerClientEvent(source, "oyuncuBilgisiDevam", source, hedef, fiyat )
    end)

     

    how do i attract this to the client

     

    Client.lua
     

    function showText(hedef,fiyat)
                            local fiyat = getElementData(theVehicle, "fiyat") or 0
    									toBeShowed = toBeShowed.."Arac Fiyatı: "..fiyat.."\n"
    									lines = lines + 1

     

  3. 
    function showText()
    	if not showing then
    		if getKeyState('lalt') then
    			showNearbyVehicleDescriptions()
    		end
    		return false
    	end
    	if not getKeyState('lalt') and getElementData(localPlayer, "enableOverlayDescriptionVehPin") ~= "1" then
    		removeVD()
    		return
    	end
    	for i = 1, #vehiculars, 1 do
    		local theVehicle = vehiculars[i]
    		if isElement(theVehicle) then
    			local x,y,z = getElementPosition(theVehicle)			
    			local cx,cy,cz = getCameraMatrix()
    			if getDistanceBetweenPoints3D(cx,cy,cz,x,y,z) <= viewDistance then --Within radius viewDistance
    				local px,py,pz = getScreenFromWorldPosition(x,y,z+heightOffset,0.05)
    				if px and isLineOfSightClear(cx, cy, cz, x, y, z, true, false, false, true, true, false, false) then				
    					--FETCH FONT IN REAL TIME
    					local fontString = getElementData(localPlayer, "cFontVeh") or "default"
    					local fontElement = fontString
    					if fontElement == "BizNoteFont18" then
    						if not BizNoteFont18 then
    							BizNoteFont18 = dxCreateFont ( ":resources/BizNote.ttf" , 18 )
    						end
    						fontElement = BizNoteFont18
    					end
    					--INITIAL :~
    					local toBeShowed = ""
    					local fontWidth = 90
    					local toBeAdded = ""
    					local lines = 0
    					local textColor = tocolor(255,255,255,255)
    					if getElementData(theVehicle, "carshop") then
    						local brand, model, year = false, false, false
    						brand = getElementData(theVehicle, "brand") or false
    						if brand then
    							model = getElementData(theVehicle, "maximemodel")
    							year = getElementData(theVehicle, "year")
    							local line = year.." "..brand.." "..model
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							if toBeShowed == "" then
    								toBeShowed = toBeShowed..line.."\n"
    								lines = lines + 1
    							else
    								toBeShowed = toBeShowed.."-~-\n"..line.."\n"
    								lines = lines + 2
    							end
    						else
    							if toBeShowed == "" then
    								toBeShowed = toBeShowed..getVehicleName(theVehicle).."\n"
    								lines = lines + 1
    							else
    								toBeShowed = toBeShowed.."-~-\n"..getVehicleName(theVehicle).."\n"
    								lines = lines + 2
    							end
    						end
    						local price = getElementData(theVehicle, "carshop:cost") or 0
    						local taxes = getElementData(theVehicle, "carshop:taxcost") or 0
    						toBeShowed = toBeShowed.."Price: $"..exports.global:formatMoney(price).."\n Taxes: $"..exports.global:formatMoney(taxes)
    						lines = lines+ 2
    					else
    						--GET DESCRIPTIONS + SIZE
    						local descToBeShown = ""
    						local job = getElementData(theVehicle, "job")
    						if job == 1 then
    							descToBeShown = "RS Haul - We'll dump your load."
    							lines = lines + 1
    						elseif job == 2 then
    							descToBeShown = "Yellow Cab Co.\nCall #8294 for a pickup!"
    							lines = lines + 2
    						elseif job == 3 then
    							descToBeShown = "Los Santos Bus"
    							lines = lines + 1
    						else
    							for j = 1, 5 do
    								local desc = getElementData(theVehicle, "description:"..j)
    								if desc and desc ~= "" and desc ~= "\n" and desc ~= "\t" then
    									local len = dxGetTextWidth(desc)
    									if len > fontWidth then
    										fontWidth = len
    									end
    									descToBeShown = descToBeShown..desc.."\n"
    									lines = lines + 1
    								end				
    							end
    						end
    						
    						if descToBeShown ~= "" then
    							descToBeShown = "-~-\n"..descToBeShown
    							lines = lines + 1
    						end
    					
    						--GET BRAND, MODEL, YEAR
    						local brand, model, year = false, false, false
    						brand = getElementData(theVehicle, "brand") or false
    						if brand then
    							model = getElementData(theVehicle, "maximemodel")
    							year = getElementData(theVehicle, "year")
    							
    							local line = year.." "..brand.." "..model
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							
    							toBeShowed = toBeShowed..line.."\n"
    							lines = lines + 1
    						end
    						
    						--GET VIN+PLATE
    						local fiyatt = getElementData(theVehicle, "fiyat")
    						
    						local plate = ""
    						local vin = getElementData(theVehicle, "dbid")
    						if vin < 0 then
    							plate = getVehiclePlateText(theVehicle)
    						else
    							plate = getElementData(theVehicle, "plate")
    						end
    
    						--Following edited by Adams 27/01/14 to accomodate VIN/PLATE hiding.
    						if not noPlateVehs[getElementModel(theVehicle)] then
    							if getElementData(theVehicle, "show_plate") == 0 then
    								if getElementData(localPlayer, "duty_admin") == 1 then
    									toBeShowed = toBeShowed.."((Plate: "..fiyatt.."))\n"
    									lines = lines + 1
    								else
    									--toBeShowed = toBeShowed.."* NO PLATE *\n"
    								end
    							else
    								toBeShowed = toBeShowed.."Plate: "..fiyatt.."\n"
    								lines = lines + 1
    							end
    						end
    						if getElementData(theVehicle, "show_vin") == 0 then
    							if getElementData(localPlayer, "duty_admin") == 1 then
    								toBeShowed = toBeShowed.."((VIN: "..vin.."))"
    								lines = lines + 1
    							else
    								--toBeShowed = toBeShowed.."* NO VIN *"
    							end
    						else
    							toBeShowed = toBeShowed.."VIN: "..vin
    							lines = lines + 1
    						end
    
    						--GET IMPOUND
    						if (exports["vehicle-system"]:isVehicleImpounded(theVehicle)) then
    							local days = getRealTime().yearday-getElementData(theVehicle, "Impounded")
    							toBeShowed = toBeShowed.."\n".."Impounded: " .. days .. " days"
    							lines = lines + 1
    						end
    
    						local vowner = getElementData(theVehicle, "owner") or -1
    						local vfaction = getElementData(theVehicle, "faction") or -1
    						if vowner == getElementData(localPlayer, "account:id") or exports.global:isStaffOnDuty(localPlayer) or exports.integration:isPlayerScripter(localPlayer) or exports.integration:isPlayerVCTMember(localPlayer) then
    							toBeShowed = toBeShowed.."\nShop ID: "..(getElementData(theVehicle, "vehicle_shop_id") or "None")
    							lines = lines + 1
    
    							local ownerName = 'No-one'
    							if vowner > 0 then
    								ownerName = exports.cache:getCharacterNameFromID(vowner)
    							elseif vfaction > 0 then
    								ownerName = exports.cache:getFactionNameFromId(vfaction)
    							end
    							local line = "\nOwner: "..(ownerName or "Loading..")
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							toBeShowed = toBeShowed..line
    							lines = lines + 1
    
    							--Activity / MAXIME
    							local protectedText, inactiveText = nil
    							if vowner > 0 then 
    								local protected, details = exports['vehicle-system']:isProtected(theVehicle) 
    					            if protected then
    					                textColor = tocolor(0, 255, 0,255)
    					                protectedText = "[Inactivity protection remaining: "..details.."]"
    					                local toBeAdded = "\n"..protectedText
    									toBeShowed = toBeShowed..toBeAdded
    									local len = dxGetTextWidth(toBeAdded)
    									if len > fontWidth then
    										fontWidth = len
    									end
    									lines = lines + 1
    					            else
    					                local active, details2, secs = exports['vehicle-system']:isActive(theVehicle)
    					                if active and (powner == getElementData(localPlayer, "dbid") or exports.integration:isPlayerStaff(localPlayer)) then
    					                    --textColor = tocolor(150,150,150,255)
    					                    inactiveText = "[Active | "
    					                    local owner_last_login = getElementData(theVehicle, "owner_last_login")
    										if owner_last_login and tonumber(owner_last_login) then
    											local owner_last_login_text, owner_last_login_sec = exports.datetime:formatTimeInterval(owner_last_login)
    											inactiveText = inactiveText.." Owner last seen "..owner_last_login_text.." "
    										else
    											inactiveText = inactiveText.." Owner last seen is irrelevant | "
    										end
    					                    local lastused = getElementData(theVehicle, "lastused")
    										if lastused and tonumber(lastused) then
    											local lastusedText, lastusedSeconds = exports.datetime:formatTimeInterval(lastused)
    											inactiveText = inactiveText.."Last used "..lastusedText.."]"
    										else
    											inactiveText = inactiveText.."Last used is irrelevant]"
    										end
    						                local toBeAdded = "\n"..inactiveText
    										toBeShowed = toBeShowed..toBeAdded
    										local len = dxGetTextWidth(toBeAdded)
    										if len > fontWidth then
    											fontWidth = len
    										end
    										lines = lines + 1
    									elseif not active then
    										textColor = tocolor(150,150,150,255)
    					                    inactiveText = "["..details2.."]"
    						                local toBeAdded = "\n"..inactiveText
    										toBeShowed = toBeShowed..toBeAdded
    										local len = dxGetTextWidth(toBeAdded)
    										if len > fontWidth then
    											fontWidth = len
    										end
    										lines = lines + 1
    					                end
    					            end
    						    end
    						end
    						toBeShowed = toBeShowed.."\n"..descToBeShown
    					end
    					
    					if fontWidth < 90 then
    						fontWidth = 90
    					end
    					
    					--START DRAWING
    					local marg = 5
    					local oneLineHeight = dxGetFontHeight(1, fontElement)
    					local fontHeight = oneLineHeight * lines
    					fontWidth = fontWidth*fontType[fontString][2] --Fix custom fonts
    					px = px-(fontWidth/2)
    					if getElementData(localPlayer, "bgVeh") ~= "0" then
    						dxDrawRectangle(px-marg, py-marg, fontWidth+(marg*2), fontHeight+(marg*2), tocolor(0, 0, 0, 10))
    					end
    					if getElementData(localPlayer, "borderVeh") ~= "0" then
    						dxDrawRectangleBorder(px-marg, py-marg, fontWidth+(marg*2), fontHeight+(marg*2), 1, tocolor(255, 255, 255, 10), true)
    					end
    					dxDrawText(toBeShowed, px, py, px + fontWidth, (py + fontHeight), textColor, 1, fontElement, "center")
    				end
    			end
    		end
    	end
    end

     

    Problem Line : 117

    local fiyatt = getElementData(theVehicle, "fiyat")

     

    ERROR : attempt to concatenate loca 'fiyatt' (a boolean value)

     

    Helpme pls.

    Help Me Quickly pls.
  4. 
    function showText()
    	if not showing then
    		if getKeyState('lalt') then
    			showNearbyVehicleDescriptions()
    		end
    		return false
    	end
    	if not getKeyState('lalt') and getElementData(localPlayer, "enableOverlayDescriptionVehPin") ~= "1" then
    		removeVD()
    		return
    	end
    	for i = 1, #vehiculars, 1 do
    		local theVehicle = vehiculars[i]
    		if isElement(theVehicle) then
    			local x,y,z = getElementPosition(theVehicle)			
    			local cx,cy,cz = getCameraMatrix()
    			if getDistanceBetweenPoints3D(cx,cy,cz,x,y,z) <= viewDistance then --Within radius viewDistance
    				local px,py,pz = getScreenFromWorldPosition(x,y,z+heightOffset,0.05)
    				if px and isLineOfSightClear(cx, cy, cz, x, y, z, true, false, false, true, true, false, false) then				
    					--FETCH FONT IN REAL TIME
    					local fontString = getElementData(localPlayer, "cFontVeh") or "default"
    					local fontElement = fontString
    					if fontElement == "BizNoteFont18" then
    						if not BizNoteFont18 then
    							BizNoteFont18 = dxCreateFont ( ":resources/BizNote.ttf" , 18 )
    						end
    						fontElement = BizNoteFont18
    					end
    					--INITIAL :~
    					local toBeShowed = ""
    					local fontWidth = 90
    					local toBeAdded = ""
    					local lines = 0
    					local textColor = tocolor(255,255,255,255)
    					if getElementData(theVehicle, "carshop") then
    						local brand, model, year = false, false, false
    						brand = getElementData(theVehicle, "brand") or false
    						if brand then
    							model = getElementData(theVehicle, "maximemodel")
    							year = getElementData(theVehicle, "year")
    							local line = year.." "..brand.." "..model
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							if toBeShowed == "" then
    								toBeShowed = toBeShowed..line.."\n"
    								lines = lines + 1
    							else
    								toBeShowed = toBeShowed.."-~-\n"..line.."\n"
    								lines = lines + 2
    							end
    						else
    							if toBeShowed == "" then
    								toBeShowed = toBeShowed..getVehicleName(theVehicle).."\n"
    								lines = lines + 1
    							else
    								toBeShowed = toBeShowed.."-~-\n"..getVehicleName(theVehicle).."\n"
    								lines = lines + 2
    							end
    						end
    						local price = getElementData(theVehicle, "carshop:cost") or 0
    						local taxes = getElementData(theVehicle, "carshop:taxcost") or 0
    						toBeShowed = toBeShowed.."Price: $"..exports.global:formatMoney(price).."\n Taxes: $"..exports.global:formatMoney(taxes)
    						lines = lines+ 2
    					else
    						--GET DESCRIPTIONS + SIZE
    						local descToBeShown = ""
    						local job = getElementData(theVehicle, "job")
    						if job == 1 then
    							descToBeShown = "RS Haul - We'll dump your load."
    							lines = lines + 1
    						elseif job == 2 then
    							descToBeShown = "Yellow Cab Co.\nCall #8294 for a pickup!"
    							lines = lines + 2
    						elseif job == 3 then
    							descToBeShown = "Los Santos Bus"
    							lines = lines + 1
    						else
    							for j = 1, 5 do
    								local desc = getElementData(theVehicle, "description:"..j)
    								if desc and desc ~= "" and desc ~= "\n" and desc ~= "\t" then
    									local len = dxGetTextWidth(desc)
    									if len > fontWidth then
    										fontWidth = len
    									end
    									descToBeShown = descToBeShown..desc.."\n"
    									lines = lines + 1
    								end				
    							end
    						end
    						
    						if descToBeShown ~= "" then
    							descToBeShown = "-~-\n"..descToBeShown
    							lines = lines + 1
    						end
    					
    						--GET BRAND, MODEL, YEAR
    						local brand, model, year = false, false, false
    						brand = getElementData(theVehicle, "brand") or false
    						if brand then
    							model = getElementData(theVehicle, "maximemodel")
    							year = getElementData(theVehicle, "year")
    							
    							local line = year.." "..brand.." "..model
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							
    							toBeShowed = toBeShowed..line.."\n"
    							lines = lines + 1
    						end
    						
    						--GET VIN+PLATE
    						local fiyatt = getElementData(theVehicle, "fiyat")
    						
    						local plate = ""
    						local vin = getElementData(theVehicle, "dbid")
    						if vin < 0 then
    							plate = getVehiclePlateText(theVehicle)
    						else
    							plate = getElementData(theVehicle, "plate")
    						end
    
    						--Following edited by Adams 27/01/14 to accomodate VIN/PLATE hiding.
    						if not noPlateVehs[getElementModel(theVehicle)] then
    							if getElementData(theVehicle, "show_plate") == 0 then
    								if getElementData(localPlayer, "duty_admin") == 1 then
    									toBeShowed = toBeShowed.."((Plate: "..fiyatt.."))\n"
    									lines = lines + 1
    								else
    									--toBeShowed = toBeShowed.."* NO PLATE *\n"
    								end
    							else
    								toBeShowed = toBeShowed.."Plate: "..fiyatt.."\n"
    								lines = lines + 1
    							end
    						end
    						if getElementData(theVehicle, "show_vin") == 0 then
    							if getElementData(localPlayer, "duty_admin") == 1 then
    								toBeShowed = toBeShowed.."((VIN: "..vin.."))"
    								lines = lines + 1
    							else
    								--toBeShowed = toBeShowed.."* NO VIN *"
    							end
    						else
    							toBeShowed = toBeShowed.."VIN: "..vin
    							lines = lines + 1
    						end
    
    						--GET IMPOUND
    						if (exports["vehicle-system"]:isVehicleImpounded(theVehicle)) then
    							local days = getRealTime().yearday-getElementData(theVehicle, "Impounded")
    							toBeShowed = toBeShowed.."\n".."Impounded: " .. days .. " days"
    							lines = lines + 1
    						end
    
    						local vowner = getElementData(theVehicle, "owner") or -1
    						local vfaction = getElementData(theVehicle, "faction") or -1
    						if vowner == getElementData(localPlayer, "account:id") or exports.global:isStaffOnDuty(localPlayer) or exports.integration:isPlayerScripter(localPlayer) or exports.integration:isPlayerVCTMember(localPlayer) then
    							toBeShowed = toBeShowed.."\nShop ID: "..(getElementData(theVehicle, "vehicle_shop_id") or "None")
    							lines = lines + 1
    
    							local ownerName = 'No-one'
    							if vowner > 0 then
    								ownerName = exports.cache:getCharacterNameFromID(vowner)
    							elseif vfaction > 0 then
    								ownerName = exports.cache:getFactionNameFromId(vfaction)
    							end
    							local line = "\nOwner: "..(ownerName or "Loading..")
    							local len = dxGetTextWidth(line)
    							if len > fontWidth then
    								fontWidth = len
    							end
    							toBeShowed = toBeShowed..line
    							lines = lines + 1
    
    							--Activity / MAXIME
    							local protectedText, inactiveText = nil
    							if vowner > 0 then 
    								local protected, details = exports['vehicle-system']:isProtected(theVehicle) 
    					            if protected then
    					                textColor = tocolor(0, 255, 0,255)
    					                protectedText = "[Inactivity protection remaining: "..details.."]"
    					                local toBeAdded = "\n"..protectedText
    									toBeShowed = toBeShowed..toBeAdded
    									local len = dxGetTextWidth(toBeAdded)
    									if len > fontWidth then
    										fontWidth = len
    									end
    									lines = lines + 1
    					            else
    					                local active, details2, secs = exports['vehicle-system']:isActive(theVehicle)
    					                if active and (powner == getElementData(localPlayer, "dbid") or exports.integration:isPlayerStaff(localPlayer)) then
    					                    --textColor = tocolor(150,150,150,255)
    					                    inactiveText = "[Active | "
    					                    local owner_last_login = getElementData(theVehicle, "owner_last_login")
    										if owner_last_login and tonumber(owner_last_login) then
    											local owner_last_login_text, owner_last_login_sec = exports.datetime:formatTimeInterval(owner_last_login)
    											inactiveText = inactiveText.." Owner last seen "..owner_last_login_text.." "
    										else
    											inactiveText = inactiveText.." Owner last seen is irrelevant | "
    										end
    					                    local lastused = getElementData(theVehicle, "lastused")
    										if lastused and tonumber(lastused) then
    											local lastusedText, lastusedSeconds = exports.datetime:formatTimeInterval(lastused)
    											inactiveText = inactiveText.."Last used "..lastusedText.."]"
    										else
    											inactiveText = inactiveText.."Last used is irrelevant]"
    										end
    						                local toBeAdded = "\n"..inactiveText
    										toBeShowed = toBeShowed..toBeAdded
    										local len = dxGetTextWidth(toBeAdded)
    										if len > fontWidth then
    											fontWidth = len
    										end
    										lines = lines + 1
    									elseif not active then
    										textColor = tocolor(150,150,150,255)
    					                    inactiveText = "["..details2.."]"
    						                local toBeAdded = "\n"..inactiveText
    										toBeShowed = toBeShowed..toBeAdded
    										local len = dxGetTextWidth(toBeAdded)
    										if len > fontWidth then
    											fontWidth = len
    										end
    										lines = lines + 1
    					                end
    					            end
    						    end
    						end
    						toBeShowed = toBeShowed.."\n"..descToBeShown
    					end
    					
    					if fontWidth < 90 then
    						fontWidth = 90
    					end
    					
    					--START DRAWING
    					local marg = 5
    					local oneLineHeight = dxGetFontHeight(1, fontElement)
    					local fontHeight = oneLineHeight * lines
    					fontWidth = fontWidth*fontType[fontString][2] --Fix custom fonts
    					px = px-(fontWidth/2)
    					if getElementData(localPlayer, "bgVeh") ~= "0" then
    						dxDrawRectangle(px-marg, py-marg, fontWidth+(marg*2), fontHeight+(marg*2), tocolor(0, 0, 0, 10))
    					end
    					if getElementData(localPlayer, "borderVeh") ~= "0" then
    						dxDrawRectangleBorder(px-marg, py-marg, fontWidth+(marg*2), fontHeight+(marg*2), 1, tocolor(255, 255, 255, 10), true)
    					end
    					dxDrawText(toBeShowed, px, py, px + fontWidth, (py + fontHeight), textColor, 1, fontElement, "center")
    				end
    			end
    		end
    	end
    end

     

    Problem Line : 117

    local fiyatt = getElementData(theVehicle, "fiyat")

     

    ERROR : attempt to concatenate loca 'fiyatt' (a boolean value)

     

    Helpme pls.

  5. function adminDutyStart()
    	local result = mysql:query("SELECT id, name FROM factions WHERE type >= 2 ORDER BY id ASC")
    	local max = mysql:query("SELECT id FROM duty_allowed ORDER BY id DESC LIMIT 0, 1")
    	if result and max then
    		dutyAllow = { }
    		dutyAllowChanges = { }
    		i = 0
    
    		local maxrow = mysql:fetch_assoc(max)
    		maxIndex = tonumber(maxrow.id) or 0
    			
    		while true do
    			local row = mysql:fetch_assoc(result)
    			if not row then break end
    
    			table.insert(dutyAllow, { row.id, row.name, { --[[Duty information]] } })
    			i = i+1
    				
    			local result1 = mysql:query("SELECT * FROM duty_allowed WHERE faction="..tonumber(row.id))
    			if result1 then
    				while true do
    					local row1 = mysql:fetch_assoc(result1)
    					if not row1 then break end
    
    					table.insert(dutyAllow[i][3], { row1.id, tonumber(row1.itemID), row1.itemValue })
    				end
    			end
    		end
    
    		setElementData(resourceRoot, "maxIndex", maxIndex)
    		setElementData(resourceRoot, "dutyAllowTable", dutyAllow)
    		mysql:free_result(result)
    		mysql:free_result(result1)
    		mysql:free_result(max)
    	else
    		outputDebugString("[Factions] ERROR: Duty allow permissions failed.")
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, adminDutyStart)--]]

    r2lAR3.png

    Line 9 - 10 

  6. 17 hours ago, 3aGl3 said:

    I think it's the comma in front of the where, so the mysql query line should be like this instead:

    
    mysql:query_free("UPDATE `characters` SET `etiket`="..mysql:escape_string(etiketLevel).." WHERE `id`='"..mysql:escape_string(getElementData(targetPlayer, "dbid")).."'")
    

     

    Thank You Bro <3

  7.  

    What is the problem with this system ? 

    Why is not sql writing?
     

    mysql = exports.mysql
    function setetiket(thePlayer, commandName, targetPlayerName, etiketLevel)
    local targetName = exports.global:getPlayerFullIdentity(thePlayer, 1)
    	if exports.integration:isPlayerLeadAdmin(thePlayer) then
    		if not targetPlayerName or not tonumber(etiketLevel)  then
    			outputChatBox("Kullanım: #ffffff/" .. commandName .. " [İsim/ID] [VİP]", thePlayer, 255, 194, 14, true)
    		else
    			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick( thePlayer, targetPlayerName )
    			if not targetPlayer then
    				
    			elseif getElementData( targetPlayer, "loggedin" ) ~= 1 then
    				outputChatBox( "Player is not logged in.", thePlayer, 255, 0, 0 )
    			else
    				mysql:query_free("UPDATE `characters` SET `etiket`="..mysql:escape_string(etiketLevel)..", WHERE `id`='"..mysql:escape_string(getElementData(targetPlayer, "dbid")).."'")
    				setElementData(targetPlayer, "etiket", tonumber(etiketLevel))
    				outputChatBox("[!]#ffffff".. targetPlayerName .. " adlı kişinin vip seviyesini " .. etiketLevel .. " yaptın.", thePlayer, 0, 255, 0, true)
    			    outputChatBox("[!]#ffffff"..targetName.." tarafından vip seviyeniz " .. etiketLevel .. " yapıldı.", targetPlayer, 0, 255, 0,true)
    			
    			end
    		end
    	else
    	    outputChatBox( "[!]#ffffffBu işlemi yapmaya yetkiniz yok.", thePlayer, 255, 0, 0, true)
    	end
    end
    addCommandHandler("etiketver", setetiket)

    ERoM3B.png

×
×
  • Create New...