hii guys, I'm making a mod where players can steal Ped's car, but here I have a problem, maybe this is a serious problem for me..
so can you see where is the error in this Script?, I am 100% sure there is nothing wrong with this Script but why is the code "if not PedIsInVehicle(NPC, VEH) then" not working?
but if I remove the word no, and it becomes "if PedIsInVehicle(NPC, VEH) then", it's safe, works fine..
can someone know where is the error in this Script?, I will be very happy if any of you can find where the error is, because I myself can't solve this mod despite using many ways.
function Car()
while true do
Wait(0)
local FIND = VehicleFindInAreaXYZ(0, 0, 0, 999999)
if type(FIND) == "table" then
for V, VEH in ipairs(FIND) do
if VehicleIsValid(VEH) then
if not VehicleIsModel(VEH, 272) and not VehicleIsModel(VEH, 273) and not VehicleIsModel(VEH, 274) and not VehicleIsModel(VEH, 275) and not VehicleIsModel(VEH, 276) and not VehicleIsModel(VEH, 277) and not VehicleIsModel(VEH, 278) and not VehicleIsModel(VEH, 279) and not VehicleIsModel(VEH, 280) and not VehicleIsModel(VEH, 281) and not VehicleIsModel(VEH, 282) and not VehicleIsModel(VEH, 283) and not VehicleIsModel(VEH, 284) and not VehicleIsModel(VEH, 289) then
for N, NPC in {PedFindInAreaXYZ(0, 0, 0, 999999)} do
if not PedIsInVehicle(NPC, VEH) then
VX, VY, VZ = VehicleGetPosXYZ(VEH)
X, Y, Z = PlayerGetPosXYZ()
if math.abs(VX - X) + math.abs(VY - Y) + math.abs(VZ - Z) <= 4.2 and not PlayerIsInAnyVehicle() and not PedHasWeapon(gPlayer, 437) and IsButtonBeingPressed(15,0) then
repeat
Wait(0)
PedWarpIntoCar(gPlayer, VEH)
until PedIsInVehicle(gPlayer, VEH)
end
end
end
end
end
end
end
end
end