Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- REPAIR
- for k,v in pairs(cfg.repair) do -- each repair perm def
- -- add missions to users
- local users = vRP.getUsersByPermission({k})
- for l,w in pairs(users) do
- local user_id = w
- local player = vRP.getUserSource({user_id})
- if not vRP.hasMission({player}) then
- if vRP.hasInventoryItem({user_id,"repairkit"}) then
- if math.random(1,v.chance+1) == 1 then -- chance check
- -- build mission
- local mdata2 = {}
- mdata.name = lang.repair({v.title})
- mdata.steps2 = {}
- -- build steps
- for i2=1,v.steps2 do
- local step2 = {
- text = lang.repair({v.title}).."<br />"..lang.reward({v.reward}),
- onenter = function(player, area)
- if vRP.tryGetInventoryItem({user_id,"repairkit",1,true}) then
- vRPclient.playAnim(player,{false,{task="WORLD_HUMAN_WELDING"},false})
- SetTimeout(15000, function()
- vRP.nextMissionStep({player})
- vRPclient.stopAnim(player,{false})
- -- last step
- if i2 == v.steps2 then
- vRP.giveMoney({user_id,v.reward})
- vRPclient.notify(player,{glang.money.received({v.reward})})
- end
- end)
- end
- end,
- position2 = v.positions2[math.random(1,#v.positions2)]
- }
- table.insert(mdata.steps2, step2)
- end
- vRP.startMission({player,mdata2})
- else
- if not vRP.hasMission({player}) then
- if math.random(1,v.chance+1) == 1 then -- chance check
- -- build mission
- local mdata1 = {}
- mdata.name = "Mechanic"
- mdata.steps1 = {}
- -- build steps
- for i1=1,v.steps1 do
- local step1 = {
- text = "You need to get a repair kit, follow my directions",
- onenter = function(player, area)
- vRPclient.notify(player,{"Buy a repair kit here"})
- SetTimeout(15000, function()
- vRP.nextMissionStep({player})
- vRPclient.stopAnim(player,{false})
- -- last step
- if i1 == v.steps1 then
- vRPclient.notify(player,{"Buy a repair kit here"})
- end
- end)
- end,
- position1 = v.positions1[math.random(1,#v.positions1)]
- }
- table.insert(mdata.steps1, step1)
- end
- vRP.startMission({player,mdata1})
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement