Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end
- local menuGuide = {
- beggining = "Menu 1",
- vehiclespawn = "Menu 2",
- quest = "Menu 3",
- stylist = "Menu 4"
- }
- GuideSpeakerObjectsCached = { }
- GuideTable = {
- {
- location = { 213238, 175583, 1313, 180 },
- spawn = { 212361, 176392, 1308, -90 }
- }
- }
- AddEvent("OnPackageStart", function()
- for k,v in pairs(GuideTable) do
- v.npc = CreateNPC(v.location[1], v.location[2], v.location[3], v.location[4])
- CreateText3D(_("helper").."\n".._("press_e"), 18, v.location[1], v.location[2], v.location[3] + 120, 0, 0, 0)
- table.insert(GuideSpeakerObjectsCached, v.npc)
- end
- end)
- AddEvent("OnPlayerJoin", function(player)
- CallRemoteEvent(player, "guideSetup", GuideSpeakerObjectsCached)
- end)
- AddRemoteEvent("guideInteract", function(player, guidepnjobject)
- local guidepnj = GetGuidePNJByObject(guidepnjobject)
- if guidepnj then
- local x, y, z = GetNPCLocation(guidepnj.npc)
- local x2, y2, z2 = GetPlayerLocation(player)
- local dist = GetDistance3D(x, y, z, x2, y2, z2)
- if dist < 150 then
- CallRemoteEvent(player, "openGuidePNJ", menuGuide)
- end
- end
- end)
- function GetGuidePNJByObject(guidepnjobject)
- for k,v in pairs(GuideTable) do
- if v.npc == guidepnjobject then
- return v
- end
- end
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement