Jump to content

Recommended Posts


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.

Edited by Dumper
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...