Jump to content

Impound script not working


Jani1337

Recommended Posts

Posted

Why is this script broken ?
 

function impoundVehicle(thePlayer, commandName)
	if tonumber(getElementData(thePlayer, "acc:admin") or 0) >= 8 or exports.exg_dashboard:isPlayerInFaction(thePlayer, 7) then
		
		if getElementData(thePlayer, "loggedin") then
			
			for k, v in ipairs(getElementsByType("vehicle")) do
				local x, y, z = getElementPosition(thePlayer)
				local tx, ty, tz = getElementPosition(v)
				local int, dim = getElementInterior(thePlayer), getElementDimension(thePlayer)
				local tint, tdim = getElementInterior(v), getElementDimension(v)
				local distance = getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)
				if distance <= 3 and int == tint and dim == tdim then
					local veh = v
					local ownerID = getElementData(veh, "veh:owner") or 0
					local ownerName = getElementData(veh, "veh:oname") or ""
					local vehName = exports.exg_carshop:getVehicleRealName(getElementModel(veh))
					local plate = getVehiclePlateText(veh)
					local vehID = getElementData(veh, "veh:id")
					
					setElementDimension(veh, 10000+ownerID)
					setElementData(veh, "veh:impounded", 1)
					dbExec(con, "UPDATE vehicle SET lefoglalva='1' WHERE id='" .. vehID .. "'")
					
					for key, value in ipairs(getElementsByType("player")) do
						if getElementData(value, "loggedin") and getElementData(value, "acc:id") == ownerID then
							outputChatBox(" ", value)
							--outputChatBox("#0094ffLos Santos Police Department:#ffffff Egy járművét szabálytalan parkolás miatt lefoglaltuk. További információkért fáradjon be a postára, és vegye át a hivatalos értesítőt.", value, 255, 255, 255, true)
							--outputChatBox("#0094ffTípus: #ffffff"..vehName .. "", value, 255, 255, 255, true)
							--outputChatBox("#0094ffRendszám: #ffffff"..plate .. "", value, 255, 255, 255, true)
							outputChatBox("================ #0094ffLos Santos Police Department értesítés#ffffff ================", value, 255, 255, 255, true)
							outputChatBox("#ffffffEgy járművét lefoglaltuk. Amennyiben szeretné kiváltani, forduljon a rendőrséghez.", value, 255, 255, 255, true)
							outputChatBox(" ", value)
							sendGroupMessage(7, getPlayerName(thePlayer) .. " lefoglalt egy járművet.")
							sendGroupMessage(7, "Rendszám: " .. plate .. " | Típus: " .. vehName .. "")
							sendGroupMessage(7, "Tulajdonosként nyílvántartott: " .. ownerName .. "")
							exports.mta_admin:outputAdminMessage("#7cc576" .. getPlayerName(thePlayer):gsub("_"," ") .. "#ffffff lefoglalt egy járművet. (" .. plate .. " | " .. vehID .. ")")
						end
					end
				end
			end
			
		end
		
	end
end
addCommandHandler("lefoglal", impoundVehicle)

It works. But the cars dimension doesent change

Posted

And are we code whisperers to just "know"?

Does it give an error? no? yes? if yes, which line? if no, then the only obvious reason I can see is that

getElementData(veh, "veh:owner")

is 0

Posted
20 hours ago, SP3CTR3 said:

And are we code whisperers to just "know"?

Does it give an error? no? yes? if yes, which line? if no, then the only obvious reason I can see is that


getElementData(veh, "veh:owner")

is 0

Line 20... Invalid dimension range

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...