I keep one "bug".
The problem/bug can be seen in the video below
Any help?
It has never live updated code for me. Try respawning the truck.
I wanna upload it to the Steam workshop.
It doesn't finish the code. It never hits the return part of the function. Unless if i "edit" and save the lua file. Just look and you will see its missing values before i rejoin.
function CreateTowTruck(ply)
if(OwnsTowTruck(ply) == 2)then
SendMessageToPlayer("There is already to many Tow Trucks in use!",ply)
end
if(OwnsTowTruck(ply) == 1)then
SendMessageToPlayer("You already own a Tow Truck!",ply)
end
if(OwnsTowTruck(ply) == 3)then
SendMessageToPlayer("The spawn is blocked!",ply,3)
end
if(OwnsTowTruck(ply) == 0)then
SendMessageToPlayer("You have spawned a Tow Truck!",ply)
local car = ents.Create("prop_vehicle_jeep")
car:SetModel("models/statetrooper/ram_tow.mdl")
car:SetKeyValue("vehiclescript","scripts/vehicles/statetrooper/ram3500_tow.txt")
local X = tonumber(GetSettingOfTowTruck("X"),10)
local Y = tonumber(GetSettingOfTowTruck("Y"),10)
local Z = tonumber(GetSettingOfTowTruck("Z"),10)
car:SetPos(Vector(X,Y + 20,Z))
local RX = tonumber(GetSettingOfTowTruck("RX"),10)
local RY = tonumber(GetSettingOfTowTruck("RY"),10)
local RZ = tonumber(GetSettingOfTowTruck("RZ"),10)
car:SetAngles(Angle(RX,RY,RZ))
local Hook = ents.Create("entity_hook")
Hook:SetPos(car:GetPos() + (car:GetRight() * 0) + (car:GetForward() * -180) +(car:GetUp() * 110))
Hook:SetAngles(Angle(RX,RY,RZ))
local Screen = ents.Create("entity_towscreen")
Screen:SetAngles(Angle(RX,RY,RZ))
Screen:SetPos(car:GetPos() + (car:GetRight() * 45) + (car:GetUp() * 60) + (car:GetForward() *-58))
Screen:SetCollisionGroup(COLLISION_GROUP_WORLD)
local buttonforwinchpull = ents.Create( "entity_towscroll" )
buttonforwinchpull:SetPos(car:GetPos() + (car:GetRight() * 0.5) + (car:GetForward() * -160) +(car:GetUp() * 110))
buttonforwinchpull:SetAngles(Angle(RX,RY,RZ))
buttonforwinchpull:SetCollisionGroup(COLLISION_GROUP_WORLD)
car:SetNWEntity("TowOwner",ply)
Hook:SetNWEntity("TowCar",car)
Screen:SetNWBool("HasHook",true)
Screen:SetNWInt("TowSpeed",1)
buttonforwinchpull:SetNWEntity("TowTrucker",car)
buttonforwinchpull:SetNWEntity("TowingScreen",Screen)
buttonforwinchpull:SetNWInt("TowingScroll",0)
Screen:SetNWBool("TowingOn",false)
Screen:SetNWBool("TowUpwards",true)
Screen:SetNWInt("MaxLenght",tonumber(GetSettingOfTowTruck("MaxLenght",10)))
Screen:SetNWInt("TowDelayTime",CurTime())
Screen:SetNWString("TowTeam",GetSettingOfTowTruck("TeamTow"))
Screen:SetNWEntity("TowOwner",ply)
Screen:SetNWInt("RopeLenght",100)
Screen:SetNWEntity("TowHooker",Hook)
Screen:SetNWEntity("TowTrucker",car)
Screen:SetNWEntity("TowTruckScroller",buttonforwinchpull)
buttonforwinchpull:Spawn()
Screen:Spawn()
car:Spawn()
Hook:Spawn()
constraint.Weld(Screen,car,0,0,0,0,true)
constraint.Weld(buttonforwinchpull,car,0,0,0,0,true)
constraint.Rope(Hook,car,0,0,Vector(0,0,20),Vector(0,-158,100),100,0,0,3,"cable/cable2",false)
end
return "he"
end
Sorry, you need to Log In to post a reply to this thread.