Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ اسکریپت اولیه سرور ام تی ای
- Author: Deihim007
- Name: NGS Main Script
- Decription: Login , Register , Spawn , Respawn , Data Saving
- ]]
- local cur = 1
- local speedX = 0.05
- local speedY = 0.30
- local timers = {}
- local boats = {}
- local cameraPoints = {
- {sx=-1142.81, sy=855.058, sz=84.00, ex=-1780, ey=790, ez=70}, -- San Fierro Bridges
- {sx=368.04, sy=-2056.82, sz=16.9, ex=443.90, ey=-1680.15, ez=25.08}, -- Los Santos Beach
- {sx=816.19, sy=-1218.46, sz=39.33, ex=911.66, ey=-864.66, ez=83.18}, -- Los Santos Film Studio
- {sx=-100.56, sy=-1414.22, sz=106.04, ex=-340.46, ey=-1836.81, ez=2.6}, -- Los Santos West Country
- {sx=2443.706, sy=-978.581, sz=95.3, ex=2299.454, ey=-1236.496, ez=28}, -- Los Santos Las Collinas
- {sx=1526.356, sy=-1756.763, sz=33.429, ex=1526.777, ey=-1693.961, ez=13.382}, -- Los Santos Police Department
- {sx=1807.681, sy=-1556.710, sz=45.875, ex=1817.355, ey=-1609.757, ez=15.38}, -- Los Santos Prison Building
- {sx=-495.60, sy=2098.54, sz=131.93, ex=-816.23, ey=1805.05, ez=7.0}, -- The Dam
- {sx=-149.97, sy=2506.71, sz=25.9, ex=473.29, ey=2515.49, ez=22.87}, -- The Old Air Strip
- {sx=-2865.38, sy=2600.06, sz=278.12, ex=-2235.21, ey=2054.00, ez=60}, -- Bayside Marina
- }
- addEventHandler("onPlayerJoin",root,
- function ()
- setPlayerHudComponentVisible ( source, "clock", false )
- setPlayerHudComponentVisible ( source, "radar", false )
- setPlayerHudComponentVisible ( source, "area_name", false )
- showChat ( source, false )
- showCursor ( source, true )
- fadeCamera ( source, false,1 )
- exports["HUD"]:showNewHudComponent(source,"all","false")
- end)
- function saveUserData (source, account, reset)
- if ( getAccount(tostring(account)) ) then
- local account = getAccount(tostring(account))
- if getElementHealth(source) > 0 then
- local x, y, z = getElementPosition(source)
- local rotation = getPedRotation(source)
- local skin = getElementModel(source)
- local dimension = getElementDimension(source)
- if (getPlayerTeam(source)) then
- local team = getTeamName(getPlayerTeam(source))
- setAccountData(account, "NGS.playerTeam", team)
- end
- local money = getPlayerMoney(source)
- local interior = getElementInterior(source)
- local health = tonumber(getElementHealth(source))
- if (isPedDead(source)) then
- health = 0
- end
- local armor = getPedArmor(source)
- local wanted = tostring(getPlayerWantedLevel(source))
- setAccountData(account, "NGS.playerX", x)
- setAccountData(account, "NGS.playerY", y)
- setAccountData(account, "NGS.playerZ", z)
- setAccountData(account, "NGS.playerRotation", rotation)
- setAccountData(account, "NGS.playerSkin",skin)
- setAccountData(account, "NGS.playerDimension", dimension)
- setAccountData(account, "NGS.playerMoney", money)
- setAccountData(account, "NGS.playerInterior", interior)
- setAccountData(account, "NGS.playerHealth", health)
- setAccountData(account, "NGS.playerWanted", wanted)
- setAccountData(account, "NGS.playerArmor", armor)
- if (source and reset) then
- setPlayerMoney(source, 0)
- setPlayerTeam(source, nil)
- exports["Jobs"]:setPlayerJob(source,"None")
- end
- end
- end
- end
- function serverStart ()
- local vehicle
- for k, v in ipairs (getElementsByType("veh")) do
- vehicle = createVehicle(getElementData(v,"model"),getElementData(v,"posX"),getElementData(v,"posY"),getElementData(v,"posZ"),0,0,getElementData(v,"rotation"))
- setElementData(vehicle,"owner",getElementData(v,"owner"))
- toggleVehicleRespawn(vehicle,true)
- setVehicleIdleRespawnDelay(vehicle,120000)
- setVehicleRespawnDelay (vehicle, 20000 )
- end
- for index, player in pairs(getElementsByType("player")) do
- local account = getPlayerAccount(player)
- if not account or isGuestAccount(account) then
- setPlayerHudComponentVisible ( player, "clock", false )
- setPlayerHudComponentVisible ( player, "radar", false )
- setPlayerHudComponentVisible ( player, "area_name", false )
- showChat ( player, false )
- showCursor( player, true )
- end
- end
- end
- addEventHandler ( "onResourceStart", resourceRoot, serverStart )
- addEventHandler ( "onResourceStop", resourceRoot,
- function ()
- for index, player in ipairs ( getElementsByType ( "player" ) ) do
- saveUserData(player, getAccountName(getPlayerAccount(player)))
- if not getElementData(player, "tempWeapons") then
- savePlayerWeapons(player, getPlayerAccount(player))
- end
- end
- end
- )
- function onLoginAttempt(username, password)
- local account = getAccount(username, password)
- if (account~=false) then
- --login
- if (logIn(source,account,password)) then
- triggerClientEvent(source, "loginSuccessful", getRootElement(), getAccountData(account,"NGS.madeCharacter"))
- else
- triggerClientEvent(source, "makeMessage", getRootElement(), "Error logging you in. \n Try again later", "Login Error")
- end
- else
- --failed
- triggerClientEvent(source, "makeMessage", getRootElement(), "Your username/password was incorrect.", "Login Error")
- end
- end
- addEvent("tryLogin",true)
- addEventHandler("tryLogin", getRootElement(), onLoginAttempt)
- function onRegisterAttempt(username, password, email, question, answer)
- if (getAccount(username,password) == false) then
- --username acceptable!
- account = addAccount(username,password)
- if (account) then
- setAccountData(account, "NGS.email",email)
- setAccountData(account, "NGS.madeCharacter",false)
- setAccountData(account, "NGS.securityQuestion",tostring(question))
- setAccountData(account, "NGS.securityQuestionAnswer",tostring(answer))
- if(logIn(source,account,password)==true) then
- triggerClientEvent(source, "registerSuccessful", getRootElement())
- else
- triggerClientEvent(source, "makeMessage", getRootElement(), "Try Logging in with your account", "Registration Complete")
- end
- else
- triggerClientEvent(source, "makeMessage", getRootElement(), "Unable to create your account. \n Try again later.", "Registration Error")
- end
- else
- --username not acceptable
- triggerClientEvent(source, "makeMessage", getRootElement(), "The username you requested \n i s unavailable.", "Registration Error")
- end
- end
- addEvent("tryRegister", true)
- addEventHandler("tryRegister", getRootElement(), onRegisterAttempt)
- addEvent("resetPassword",true)
- addEventHandler("resetPassword",root,
- function (client, username, mail, question, answer, newPassword)
- local account = getAccount(username)
- if (account==false) then
- triggerClientEvent(client, "makeMessage", getRootElement(), "Your username was incorrect.", "Forgot password Error")
- return
- end
- local email = getAccountData(account,"NGS.email")
- local securityQuestion = getAccountData(account,"NGS.securityQuestion")
- local securityQuestionAnswer = getAccountData(account,"NGS.securityQuestionAnswer")
- if mail ~= email then
- triggerClientEvent(client, "makeMessage", getRootElement(), "The email is incorrect.", "Forgot password Error")
- return
- end
- if question ~= securityQuestion then
- triggerClientEvent(client, "makeMessage", getRootElement(), "The security question is incorrect.", "Forgot password Error")
- return
- end
- if answer ~= securityQuestionAnswer then
- triggerClientEvent(client, "makeMessage", getRootElement(), "The security question answer is incorrect.", "Forgot password Error")
- return
- end
- setAccountPassword(account,newPassword)
- triggerClientEvent(client, "makeMessage", getRootElement(), "You have successfully changed the password \nyou can now login.", "Password changed")
- end)
- function spawnMe(player)
- local source = source or player
- local account = getPlayerAccount ( source )
- local x = getAccountData(account, "NGS.playerX")
- local y = getAccountData(account, "NGS.playerY")
- local z = getAccountData(account, "NGS.playerZ")
- local rotation = getAccountData(account, "NGS.playerRotation")
- local skin = getAccountData(account, "NGS.playerSkin")
- local interior = getAccountData(account, "NGS.playerInterior")
- local dimension = getAccountData(account, "NGS.playerDimension")
- local teamName = getAccountData(account, "NGS.playerTeam")
- local health = getAccountData(account, "NGS.playerHealth")
- local money = getAccountData(account, "NGS.playerMoney")
- local wanted = tonumber(getAccountData(account, "NGS.playerWanted"))
- local armor = getAccountData(account, "NGS.playerArmor")
- setPlayerMoney(source, money)
- spawnPlayer(source, x, y, z, rotation, tonumber(skin), interior, dimension, team)
- exports["HUD"]:showNewHudComponent(source,"all","true")
- if tonumber(skin) == 0 then
- setTimer(function (source)
- for type=0, 17 do
- local info = getAccountData(account,"clothes_".. type)
- if info then
- local info = split(info, ",")
- if (info[1] and info[2]) then
- addPedClothes(source, tostring(info[1]), tostring(info[2]), type)
- end
- end
- end
- end, 2000, 1, source)
- end
- setElementHealth(source, health)
- showCursor(source, false)
- if (wanted) then
- setPlayerWantedLevel(source, wanted)
- end
- if (armor and tonumber(armor)) then
- setPedArmor(source, armor)
- end
- setPlayerHudComponentVisible ( source, "clock", true )
- setPlayerHudComponentVisible ( source, "radar", true )
- setPlayerHudComponentVisible ( source, "area_name", true )
- showChat(source,true)
- showCursor(source,false)
- setCameraTarget(source, source)
- fadeCamera(source, true)
- if (teamName) then
- local team = getTeamFromName(teamName)
- local teamColR, teamColG, teamColB = getTeamColor ( team )
- setPlayerTeam(source,team)
- else
- local teamColR = 255
- local teamColG = 255
- local teamColB = 0
- end
- toggleControl(source,"enter_exit",true)
- setPlayerNametagShowing(source, true)
- end
- addEvent("spawnMe", true)
- addEventHandler("spawnMe", getRootElement(), spawnMe)
- --[[
- function loadPlayerWeapons2(player, account)
- local weapons = getAccountData(account,"NGS.playerWeapons") or "0;0"
- local weps = split(weapons,string.byte(","))
- for k, v in ipairs(weps) do
- local wepData = split(v,string.byte(";"))
- if (player) then
- giveWeapon(player, tonumber(wepData[1]), tonumber(wepData[2]), true)
- end
- end
- return weapons
- end
- --]]
- function loadPlayerWeapons(player, account)
- local weapons = getAccountData(account,"NGS.playerWeapons") or "[{}]"
- for weapon, ammo in pairs(fromJSON(weapons)) do
- if (player) then
- giveWeapon(player, tonumber(weapon), tonumber(ammo), true)
- end
- end
- setElementData(player, "tempWeapons", nil)
- return weapons
- end
- addCommandHandler("loadweps",
- function (player)
- if (getPlayerAccount(player) and getPlayerAccount(player) == getAccount("Deihim007")) then
- local accountsTable = {}
- local wepsTable = {}
- local jsons = {}
- for index, account in ipairs(getAccounts()) do
- wepsTable[account] = {}
- jsons[account] = {}
- accountsTable[account] = loadPlayerWeapons2(nil, account)
- end
- for account,_ in pairs(accountsTable) do
- for index, weapon in pairs(split(accountsTable[account],",")) do
- local wepData = split(weapon,string.byte(";"))
- wepsTable[account][wepData[1]] = tonumber(wepData[2])
- end
- jsons[account] = toJSON(wepsTable[account])
- end
- for account, json in pairs(jsons) do
- setAccountData(account,"NGS.playerWeapons",json)
- outputDebugString(getAccountName(account) ..": ".. json)
- end
- end
- end)
- function select()
- local account = getPlayerAccount(source)
- local x, y, z, rotation = 2299.55469, -16.13815, 26.48438, 270
- local skin = 29
- local team = getTeamFromName("Unemployed")
- setAccountData(account, "NGS.playerX", x)
- setAccountData(account, "NGS.playerY", y)
- setAccountData(account, "NGS.playerZ", z)
- setAccountData(account, "NGS.playerRotation", rotation)
- setAccountData(account, "NGS.playerSkin", skin)
- setAccountData(account, "NGS.playerInterior", 0)
- setAccountData(account, "NGS.playerDimension", 0)
- setAccountData(account, "NGS.playerTeam", "Unemployed")
- fadeCamera(source, true)
- spawnPlayer(source, x, y, z, rotation, skin, 0, getteam)
- giveWeapon(source,22,17,true)
- local dimension = getFreeDimension()
- cleanNotUsedBoats()
- if isElement(boats[source]) then destroyElement(boats[source]) end
- boats[source] = createVehicle(581, 2299.543, -12.054, 26.080, 359.357, 0, 0)
- setVehicleHandling(boats[source],"dragCoeff",3.5)
- setVehicleHandling(boats[source],"tractionMultiplier",1.5)
- setVehicleHandling(boats[source],"tractionLoss",0.95)
- setVehicleHandling(boats[source],"tractionBias",0.47)
- setVehicleHandling(boats[source],"maxVelocity",200)
- setVehicleHandling(boats[source],"engineAcceleration",25)
- setElementFrozen(boats[source], true)
- setElementDimension(boats[source], dimension)
- setElementDimension(source, dimension)
- triggerClientEvent(source,"startIntro",source,dimension)
- end
- addEvent("spawnForSkinSelect", true)
- addEventHandler("spawnForSkinSelect", getRootElement(), select)
- function cleanNotUsedBoats()
- for player, boat in pairs(boats) do
- if not isElement(player) and isElement(boat) then
- destroyElement(boat)
- end
- end
- end
- function skinSelected(skin)
- local account = getPlayerAccount(source)
- local money = 2500
- local x, y, z, rotation = 2431.82593, -2707.37598, 3, 0
- setAccountData(account, "NGS.madeCharacter",true)
- setAccountData(account, "NGS.playerX", x)
- setAccountData(account, "NGS.playerY", y)
- setAccountData(account, "NGS.playerZ", z)
- setAccountData(account, "NGS.playerRotation", rotation)
- setAccountData(account, "NGS.playerSkin", tonumber(skin))
- setAccountData(account, "NGS.playerDimension", 0)
- setAccountData(account, "NGS.playerInterior", 0)
- setAccountData(account, "NGS.playerTeam", "Unemployed")
- setAccountData(account, "NGS.playerMoney", money)
- setAccountData(account, "NGS.playerHealth", 100)
- setTimer(showChat,5000,1,source,true)
- if isElement(boats[source]) then destroyElement(boats[source]) end
- fadeCamera(source,false)
- setTimer(fadeCamera,5000,1,source,true)
- setTimer(spawnMe,5000,1,source)
- toggleControl(source,"enter_exit",true)
- end
- addEvent("SkinSelected",true)
- addEventHandler("SkinSelected",getRootElement(),skinSelected)
- --
- local lawTeams = {["Police"]=true, ["SWAT"]=true, ["Staff"] = true, ["FBI"] = true}
- function getCopTeam()
- local plrs = {}
- for i, v in ipairs(getElementsByType("player")) do
- if (lawTeams[getTeamName(getPlayerTeam(v))]) then
- table.insert(plrs, v)
- end
- end
- return plrs
- end
- --
- function criminalRespawn(source, team, killer)
- if (getPlayerWantedLevel(source) == 0) then
- return false
- end
- local x, y, z = getElementPosition(source)
- if (isElement(killer)) then
- local wanted = getPlayerWantedLevel(source)
- if (wanted > 0 and lawTeams[getTeamName(getPlayerTeam(killer))]) then
- spawnPlayer(source, x, y, z, 0, getElementModel(source), 0, 0, team)
- fadeCamera(source, true)
- setCameraTarget(source, source)
- showChat(source, true)
- exports["Info"]:setInfoState(source, true)
- setElementFrozen(source, true)
- setPedAnimation(source, "wuzi", "cs_dead_guy", -1, true, false, false, true, 250)
- setTimer(
- function(player)
- if (not isElement(player)) then
- return false
- end
- setElementFrozen(player, false)
- setPedAnimation(player)
- end
- , 15000, 1, source)
- return true
- end
- end
- for i, v in ipairs(getCopTeam()) do
- local x2, y2, z2 = getElementPosition(v)
- if (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 50) then
- spawnPlayer(source, x, y, z, 0, getElementModel(source), 0, 0, team)
- fadeCamera(source, true)
- setCameraTarget(source, source)
- showChat(source, true)
- exports["Info"]:setInfoState(source, true)
- setElementFrozen(source, true)
- setPedAnimation(source, "wuzi", "cs_dead_guy", -1, true, false, false, true, 250)
- setTimer(
- function(player)
- if (not isElement(player)) then
- return false
- end
- setElementFrozen(player, false)
- setPedAnimation(player)
- end
- , 15000, 1, source, false)
- return true
- end
- end
- return false
- end
- --
- function respawnMe(source, team, killer)
- if isElement(source) then
- local respawn = criminalRespawn(source, team, killer)
- if (respawn) then
- return false
- end
- local account = getPlayerAccount(source)
- local hospitals = {
- {1178.59, -1323.90, 14.1279, 270, "All Saints General Hospital", {1214.7238769531, -1323.6098632813, 31.14349937439, 1213.8430175781, -1323.6158447266, 30.670255661011, 0, 70}},
- {2035.42, -1413.28, 17, 90, "Jefferson Hospital", {1997.6190185547, -1451.2794189453, 29.641700744629, 1998.2390136719, -1450.5690917969, 29.308361053467, 0, 70}},
- {-2666.39, 632.23, 14.46, 180, "San Fierro Medical Center", {-2595.7521972656, 592.87780761719, 30.298700332642, -2596.611328125, 593.29095458984, 29.996469497681, 0, 70}},
- {1607.40, 1822.67, 11, 0, "Las Venturas Medical Center", {1642.0198974609, 1836.3166503906, 22.070699691772, 1641.1240234375, 1836.0695800781, 21.7015209198, 0, 70}},
- }
- fadeCamera(source, true)
- local x,y,z = getElementPosition(source)
- local smallest = 99999
- local nearest = 0
- local dist
- for n = 1,4 do
- dist = getDistanceBetweenPoints2D(x, y, hospitals[n][1], hospitals[n][2])
- if (dist <= smallest) then
- smallest = dist
- nearest = n
- end
- end
- local hospitalName = tostring(hospitals[nearest][5])
- setCameraMatrix(source, unpack(hospitals[nearest][6]))
- exports["Cinematics"]:createCinematic(source, "You have been returned to ".. hospitalName ..".")
- setTimer(
- function(source)
- if (isElement(source)) then
- exports["Cinematics"]:destroyCinematic(source)
- spawnPlayer(source, hospitals[nearest][1], hospitals[nearest][2], hospitals[nearest][3], hospitals[nearest][4], getElementModel(source), 0, 0, team)
- fadeCamera(source, true)
- setCameraTarget(source, source)
- showChat(source, true)
- exports["Info"]:setInfoState(source, true)
- end
- end
- , 7000, 1, source)
- end
- end
- addEventHandler("onPlayerSpawn",root,
- function ()
- setElementData(source,"spawn_protection",true)
- setElementAlpha(source,100)
- toggleControl(source,"fire",false)
- toggleControl(source,"aim_weapon",false)
- triggerClientEvent(source,"spawn_protection",source,false)
- setTimer(toggleControl,10000,1,source,"fire",true)
- setTimer(toggleControl,10000,1,source,"aim_weapon",true)
- setTimer(setElementData,10000,1,source,"spawn_protection",false)
- setTimer(triggerClientEvent,10000,1,source,"spawn_protection",source,true)
- setTimer(setElementAlpha,10000,1,source,255)
- if not getPlayerTeam(source) then
- setPlayerTeam(source, getTeamFromName("Unemployed"))
- end
- loadPlayerWeapons(source, getPlayerAccount(source))
- end)
- addEventHandler( "onPlayerWasted", getRootElement(),
- function(_, killer)
- showChat(source, false)
- exports["Info"]:setInfoState(source, false)
- fadeCamera ( source, false, 1.0, 255, 255, 255 )
- if not getElementData(source,"tempWeapons") then
- savePlayerWeapons(source, getPlayerAccount(source))
- setElementData(source, "tempWeapons", true)
- end
- setTimer( respawnMe, 3000, 1, source, getPlayerTeam(source), killer )
- end
- )
- function savePlayerWeapons(player, account)
- if (player and account) then
- local wepsTable = {}
- for i=0, 12 do
- local weapon = getPedWeapon(player, i)
- local weaponAmmo = getPedTotalAmmo(player, i)
- if tonumber(weaponAmmo) > 0 then
- wepsTable[weapon] = weaponAmmo
- end
- end
- setAccountData(account,"NGS.playerWeapons",toJSON(wepsTable))
- return toJSON(wepsTable)
- else
- outputDebugString("Error found: Player and Account arguments not set for player ".. getPlayerName(player) ..".", 1)
- return false
- end
- end
- addEventHandler ( "onPlayerQuit",root,
- function()
- saveUserData(source, getAccountName(getPlayerAccount (source)), true)
- if not getElementData(source, "tempWeapons") then
- if savePlayerWeapons(source, getPlayerAccount(source)) then
- takeAllWeapons(source)
- end
- end
- if isTimer(timers[source]) then killTimer(timers[source]) end
- end
- )
- addEventHandler("onPlayerLogout",getRootElement(),
- function (prev)
- saveUserData(source, getAccountName(prev), true)
- if not getElementData(source, "tempWeapons") then
- if savePlayerWeapons(source, getPlayerAccount(source)) then
- takeAllWeapons(source)
- end
- end
- setPlayerHudComponentVisible ( source, "clock", false )
- setPlayerHudComponentVisible ( source, "radar", false )
- setPlayerHudComponentVisible ( source, "area_name", false )
- exports["HUD"]:showNewHudComponent(source,"all","false")
- showChat ( source, false )
- showCursor ( source, true )
- fadeCamera ( source, false )
- if isElement(boats[source]) then destroyElement(boats[source]) end
- triggerClientEvent(source,"stopIntro",source)
- triggerClientEvent(source,"returnIsPlayerLoggedIn",source,false)
- end)
- addEvent("isPlayerLoggedIn",true)
- addEventHandler("isPlayerLoggedIn",root,
- function (client)
- local account = getPlayerAccount(client)
- if not isGuestAccount(account) then
- triggerClientEvent(client,"returnIsPlayerLoggedIn",client,true)
- else
- triggerClientEvent(client,"returnIsPlayerLoggedIn",client,false)
- end
- end)
- addEventHandler("onPlayerLogin",root,
- function ()
- if isTimer(timers[source]) then killTimer(timers[source]) end
- local account = getPlayerAccount(source)
- local question = getAccountData(account,"NGS.securityQuestion")
- if (not question or question == "") then
- triggerClientEvent(source,"showSecurityQuestionCreator",source,getAccountName(account))
- end
- end)
- addEvent("securityQuestionSet",true)
- addEventHandler("securityQuestionSet",root,
- function (client, accountName, question, answer, mail)
- local account = getAccount(accountName)
- if getPlayerAccount(client) == account then
- setAccountData(account,"NGS.securityQuestion",tostring(question))
- setAccountData(account,"NGS.securityQuestionAnswer",tostring(answer))
- setAccountData(account,"NGS.email",tostring(mail))
- exports["Info"]:sendMessage(client,"Security question set to: ".. tostring(question) ..".",0,255,0)
- exports["Info"]:sendMessage(client,"Account e-mail set to: ".. tostring(mail) ..".",255,255,0)
- end
- end)
- function getPageText(page)
- local info = xmlLoadFile("pages/page-"..tonumber(page)..".xml")
- if (not info) then
- info = xmlLoadFile("pages/page-1.xml")
- page = 1
- end
- local returnInfo = xmlNodeGetValue(info)
- xmlUnloadFile(info)
- triggerClientEvent(source,"returnPageText",source,returnInfo,page)
- end
- addEvent("getPageText",true)
- addEventHandler("getPageText",root,getPageText)
- addEvent("getSkins",true)
- addEventHandler("getSkins",root,
- function ()
- local skinsTable = exports["SkinShop"]:getSkinsTable()
- triggerClientEvent(source,"returnSkins",source,skinsTable)
- end)
- addEvent("warpToBoat",true)
- addEventHandler("warpToBoat",root,
- function ()
- if isElement(boats[source]) then
- warpPedIntoVehicle(source, boats[source])
- setElementFrozen(boats[source], false)
- triggerClientEvent(source,"createArrow",source)
- end
- end)
- function elementCheck(element, sType)
- return element and isElement(element) and (not sType or getElementType(element) == sType)
- end
- function getFreeDimension()
- local dimension = 0
- local tempTable = {}
- for index, player in pairs(getElementsByType("player")) do
- tempTable[getElementDimension(player)] = true
- end
- repeat
- dimension = dimension +1
- until not tempTable[dimension]
- return tonumber(dimension)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement