Jump to content

[HELP] Vehicle = Boolean


Kazafka

Recommended Posts

This one got me on disappointment, It is like 10th time! When I delete a vehicle from my user's list (my vehicle system, "VaporCars", 99% of completement) script SHOULD remove a blip, that is moving within a car, but it says, that this car, that I'm in, is a boolean. Any idea? Code:

--Attached elements: BLIP
--Im in car: YES
--Player is: ME

local veh = getPedOccupiedVehicle(player)
local vehTable = getAttachedElements(veh)
destroyElement(vehTable[1])

--Why this ain't work?

 

Link to comment
11 minutes ago, stPatrick said:

paste full code

Lua:

addCommandHandler("usun.pojazd", function(player)
	local veh = getPedOccupiedVehicle(player)
	if veh then
		if(getElementData(veh, "owner") == getPlayerName(player)) then
			local xml = xmlLoadFile("saved.xml")
				
				if xml then
					local branch = xmlFindChild(xml, "vehs", 0)
					local table_ = xmlNodeGetChildren(branch)
					local customID = getElementData(veh, "id")
					
					for i, node in ipairs(table_) do
						if(customID == xmlNodeGetAttribute(node, "customID")) then
							xmlDestroyNode(node)
						end
					end
					
					xmlSaveFile(xml)
					xmlUnloadFile(xml)
				end
			destroyElement(veh)
			local vT = getAttachedElements(veh)
			destroyElement(vT[1])
			outputChatBox("#007FFF[VaporCars] #4a4a4aCar successfully #007FFFdeleted#4a4a4a!", player, 255, 255, 255, true)
		end
	end
end)

 

Link to comment
  • Moderators
2 hours ago, VaporZ said:

SHOULD remove a blip, that is moving within a car, but it says, that this car, that I'm in, is a boolean. Any idea?

First get the blip, then destroy the vehicle. Line 21, 22

 

Where is the blip creation part?

 

Also, never trust values, so always add value checks.

Edited by IIYAMA
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...