• Location question
    14 replies, posted
Hello, i got a small question is there an way to check if an position is clear? Why? I want to TP an car to an location, i wanna check somehow if theres an other car at this location, i got 5 locations, when the first location is blocked with an car i want to tp the car to the second one... I hope someone can help :>
wow, this is what i was going to ask
-snip-
[CODE] function tp_car(car,location) if #ents.FindInSphere(location,150) > 0 then -- You might have to adjust 150 to another value tp_car(car,another_location) else car:SetPos(location) end [/CODE] Hope this help.
thanks a lot sir. really a lot
When i teleport an car, it goes to that position but when i touch it, it goes back to his old position, and his "object" does stay at the old location help :O
[QUOTE=Spanky123;48538623]When i teleport an car, it goes to that position but when i touch it, it goes back to his old position, and his "object" does stay at the old location help :O[/QUOTE] It shoulds be a problem with the car you use. What addons do you use for vehicles?
I use the normal hl2 jeep....
Then, there must be a problem somewhere from your side. I never seen that kind of problem with anythings teleported including vehicles.
I got a vid btw, im doin all this via serverside if this effect anything <- [video=youtube;iu3osILFAcw]https://www.youtube.com/watch?v=iu3osILFAcw[/video] my code for this command [LUA] local pos1 = Vector(-259.723419, 380.148499, -12285.968750) local ang1 = Angle(0, 0, 0) local pos2 = Vector(-483.160400, -783.340027, -12223.968750) local ang2 = Angle(0, 0, 0) function tp_car(car) if #ents.FindInSphere(pos1,150) > 0 then car:SetPos( pos1 ) car:SetAngles( ang1 ) end if #ents.FindInSphere(pos2,150) > 0 then car:SetPos( pos2 ) car:SetAngles( ang2 ) end end concommand.Add( "confiscate", function( ply ) local tr = util.TraceLine( { start = ply:EyePos(), endpos = ply:EyePos()+(ply:GetAimVector()*100), filter = function( ent ) if ( ent:GetClass() == "prop_vehicle_jeep" ) then return true end end } ) local lol = tr.Entity:GetNetworkedInt( "confi", 0 ) if IsValid(tr.Entity) then if lol == 0 then tr.Entity:SetNWInt( 'confi', 1 ) tp_car(tr.Entity) else ply:ChatPrint( "[FEHLER] Fahrzeug bereits beschlagnahmt!" ) -- for somethin diffrent end else ply:ChatPrint( "[FEHLER] Kein Fahrzeug gefunden!" ) -- no car found end end )[/LUA] [editline]25th August 2015[/editline] Tested this on an new, dedicated Server still do the same shit!
I can confirm there are a problem with jeep teleporting. From what I can see. It seems to be a problem with the fact the jeep use physics parts. I will look if there a workaround for this kind of problem. EDIT: Workaround for now: [CODE] local pos1 = Vector(-259.723419, 380.148499, -12285.968750) local ang1 = Angle(0, 0, 0) local pos2 = Vector(-483.160400, -783.340027, -12223.968750) local ang2 = Angle(0, 0, 0) function tp_car(car) if #ents.FindInSphere(pos1,150) > 0 then local driver = nil if car:GetDriver() != "NULL" then driver = car:GetDriver() end -- If there was a player in the vehicle. Keep the player with it. car:Remove() car = ents.Create("prop_vehicle_jeep_old") car:SetModel("models/buggy.mdl") car:SetKeyValue("vehiclescript","scripts/vehicles/jeep_test.txt") car:SetPos( pos1 ) car:SetAngles( ang1 ) car:Spawn() car:Activate() if driver != nil then timer.Simple(0.1,function() driver:EnterVehicle(car) end) end -- Check for if the vehicle had a player previously. And also quick and dirty method to get player in vehicle. end if #ents.FindInSphere(pos2,150) > 0 then local driver = nil if car:GetDriver() != "NULL" then driver = car:GetDriver() end car:Remove() car = ents.Create("prop_vehicle_jeep_old") car:SetModel("models/buggy.mdl") car:SetKeyValue("vehiclescript","scripts/vehicles/jeep_test.txt") car:SetPos( pos2 ) car:SetAngles( ang2 ) car:Spawn() car:Activate() if driver != nil then timer.Simple(0.1,function() driver:EnterVehicle(car) end) end end end concommand.Add( "confiscate", function( ply ) local tr = util.TraceLine( { start = ply:EyePos(), endpos = ply:EyePos()+(ply:GetAimVector()*100), filter = function( ent ) if ( ent:GetClass() == "prop_vehicle_jeep" ) then return true end end } ) local lol = tr.Entity:GetNetworkedInt( "confi", 0 ) if IsValid(tr.Entity) then if lol == 0 then tr.Entity:SetNWInt( 'confi', 1 ) tp_car(tr.Entity) else ply:ChatPrint( "[FEHLER] Fahrzeug bereits beschlagnahmt!" ) -- for somethin diffrent end else ply:ChatPrint( "[FEHLER] Kein Fahrzeug gefunden!" ) -- no car found end end ) [/CODE]
SetPos doesn't work properly on vehicles. You can't fix that without destroying the vehicle and creating a new one at the new location.
[QUOTE=Robotboy655;48539409]can't fix[/QUOTE] Not even a workaround for that? It is possible from your side to fix this problem for vehicles?
Thanks for that guys, lemme check it, when i get it work i will post you ma stuff
Does still do the same error.
Sorry, you need to Log In to post a reply to this thread.