Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local towed_vehicle = {}
- local function ch_tow(player,choice)
- vRP.getUserId({player}, function(user_id)
- print('userid ch_tow ' .. user_id)
- vRPclient.getNearestOwnedVehicle(player,{7},function(ok,vtype,name)
- if towed_vehicle[user_id] == nil then
- print('tow ' .. ok)
- if ok then
- vRPclient.getNearestVehicle(player, {5}, function(veh)
- print('found car ' .. veh)
- vRPclient.towVehicle(player, {})
- vRP.closeMenu({player})
- end)
- else
- vRPclient.notify(player, {"No tow truck found."})
- end
- else
- vRPclient.untowVehicle(player, {})
- vRP.closeMenu({player})
- end
- end)
- end)
- end
- function vRP.vehicleTowed()
- print('vehicle towed')
- vRPclient.notify(source, {"Vehicle towed!"})
- vRP.getUserId({source}, function(user_id)
- towed_vehicle[user_id] = true
- end)
- end
- function vRP.vehicleunTowed()
- vRPclient.notify(source, {"Vehicle detached!"})
- vRP.getUserId({source}, function(user_id)
- towed_vehicle[user_id] = nil
- end)
- end
- AddEventHandler("vRP:buildMainMenu",function(player)
- vRP.getUserId({player}, function(user_id)
- print('userid buildMainMenu ' .. user_id .. ' ' .. tostring(towed_vehicle[user_id]))
- if user_id ~= nil then
- local choices = {}
- print('tow menu')
- vRP.hasPermission({user_id, "repair.tow"}, function (permission)
- if permission then
- if (towed_vehicle[user_id] ~= nil) then
- choices["UnTow"] = { ch_tow, "Untow vehicle"}
- else
- choices["Tow"] = { ch_tow, "Tow vehicle"}
- end
- end
- vRP.buildMainMenu({player,choices}) -- add choices to the player main menu
- end)
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement