Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEventHandler("onResourceStart", resourceRoot,
- function()
- database = dbConnect( "sqlite", "database.db" )
- if auto_load == true then
- loadDataBase()
- end
- end)
- adm_group = "Admin" -- Naleznosc do Grupy.
- backTime = 72000000 -- Raz w ile miliseund robi beckup i namiotow .Teraz kosztuje 20
- auto_load = true -- Automatyczny załadunek danych przy włączeniu Srv
- auto_save = true -- Automatyczne zapisywanie danych
- spawnPositions = {
- {-278.6669921875,-2882.1572265625,32.104232788086},
- {-958.5595703125,-2887.9912109375,64.82421875},
- {-1816.9375,-2748.18359375,1.7327127456665},
- {-2816.166015625,-2439.0546875,2.4004096984863},
- {-2941.5673828125,-1206.2373046875,2.7848854064941},
- {-2911.51171875,-895.22265625,2.4013109207153},
- {-2185.6669921875,2957.380859375,11.474840164185},
- {272.2265625,2928.505859375,1.3713493347168},
- {2803.943359375,595.9365234375,7.7612648010254},
- {2883.7509765625,-178.4658203125,3.2714653015137},
- {-233.46484375,-1735.8173828125,1.5520644187927},
- {-1056.8720703125,2939.068359375,42.311294555664},
- }
- local class_settings = {
- {"VIP:NOCOMMAND",0},
- {"VIP:TIME",0},
- }
- playerDataTable = {
- {"bandit",false},
- {"smeltery",false},
- {"currentweapon_1",false},
- {"currentweapon_2",false},
- {"currentweapon_3",false},
- {"clothBody",false},
- {"clothHead",false},
- {"clothHeadN",false},
- {"pain",false},
- {"cold",false},
- {"infection",false},
- {"brokenbone",false},
- {"alivetime",0},
- {"skin",0},
- {"MAX_Slots",8},
- {"blood",12000},
- {"food",math.random(50,100)},
- {"thirst",math.random(50,100)},
- {"temperature",36},
- {"bleeding",0},
- {"Shirt",0},
- {"Head",0},
- {"Trousers",0},
- {"Shoes",0},
- {"humanity",2500},
- {"zombieskilled",0},
- {"headshots",0},
- {"murders",0},
- {"banditskilled",0},
- ---
- {"Tools",0},
- {"WoodPile",0},
- {"Bandage",1},
- {"Water Bootle",0},
- {"Pasta Can",0},
- {"Beans Can",0},
- {"Hamburger",0},
- {"Box Of Matches",0},
- {"MAG:M1911 ",0},
- {"MAG:M9 SD",0},
- {"MAG:Rewolwer",0},
- {"Pistol:M1911",0},
- {"Pistol:M9 SD",0},
- {"Winchester 1866",0},
- {"Pistol:PDW",0},
- {"Battle Knife",0},
- {"Battle Axe",0},
- {"Pizza",0},
- {"Morphine",0},
- {"Water Bootle",0},
- {"Empty Gas Carnister",0},
- {"Full Gas Carnister",0},
- {"Fire",0},
- {"Milk",0},
- {"MAG:PDW",0},
- {"MAG::MP5A5 ",0},
- {"MAG:G36 ",0},
- {"BELT MAG:PKP ",0},
- {"BELT MAG:PKM ",0},
- {"MAG:AUG ",0},
- {"BELT MAG:M240",0},
- {"BELT MAG:RPK",0},
- {"BELT MAG:MK48 ",0},
- {"BELT MAG:M249",0},
- {"MAG:AS50 ",0},
- {"MAG:M24 ",0},
- {"MAG:DMR ",0},
- {"MAG:KSVK ",0},
- {"MAG:M107 ",0},
- {"MAG:SVD",0},
- {"BELT MAG:MG36",0},
- {"BELT MAG:L85A2 ",0},
- {"MAG:SCAR",0},
- {"MAG:M200",0},
- {"MAG:VSS",0},
- {"MAG:DSR",0},
- {"BELT MAG:PCA ",0},
- {"MAGS:AK",0},
- {"MAGS:M4A1",0},
- {"Automat:M4A1 HWS M203",0},
- {"Automat:AKM",0},
- {"Automat:AKS-74 PSO",0},
- {"Automat:AK-107 GL",0},
- {"Automat:G36 Camo",0},
- {"Automat:AKS Gold",0},
- {"Automat:AKS-74UN Kobra",0},
- {"Automat:G36",0},
- {"Automat:G36C-SD",0},
- {"Heavy:PKP",0},
- {"Heavy:PKM",0},
- {"Automat:AUG",0},
- {"Heavy:M240",0},
- {"Heavy:RPK",0},
- {"Heavy:MK48",0},
- {"Heavy:M249 SAW",0},
- {"Sniper-Rifle:AS50",0},
- {"Sniper-Rifle:M24",0},
- {"Sniper-Rifle:DMR",0},
- {"Sniper-Rifle:KSVK",0},
- {"Sniper-Rifle:M107",0},
- {"Sniper-Rifle:SVD Camo",0},
- {"Heavy:MG36",0},
- {"Automat:L85A2 Holo",0},
- {"Automat:M4A1 CCO SD",0},
- {"Automat:L85A2",0},
- {"Automat:L85A2 ACOG GL",0},
- {"Automat:SCAR-SD",0},
- {"Automat:SCAR",0},
- {"Sniper-Rifle:M200",0},
- {"Sniper-Rifle:VSS",0},
- {"Sniper-Rifleа:DSR50",0},
- {"Heavy:PCA",0},
- {"Pepper Gas",0},
- {"Granade:Hand:Granade",0},
- {"Rewolwer",0},
- {"Sawn-Off Shotgun",0},
- {"Shotgun:SPAZ-12",0},
- {"MP5A5",0},
- {"HOURS",0},
- {"Med Kit",0},
- {"Heat Pack",0},
- {"Rifle:Lee Enfield",0},
- {"Pistol:PDW",0},
- {"Automat AK-74",0},
- {"Blood Bag",0},
- {"GPS",0},
- {"Cart",0},
- {"Tools",0},
- {"Wire Fence",0},
- {"Tire",0},
- {"Engine",0},
- {"Tank Parts",0},
- {"M136 Rocket",0},
- {"MAG:CZ550 ",0},
- {"MAG:Lee Enfield ",0},
- {"Automat:М4А1 CCO",0},
- {"MAG:CZ550",0},
- {"Satchel",0},
- {"Тепловизор",0},
- {"PNW",0},
- {"Tent (Small)",0},
- {"Tent (Military)",0},
- {"Tent (Big)",0},
- {"Cooked Meat",0},
- {"Raw Meat",0},
- {"Painkiller",1},
- {"Binoculars",0},
- {"Empty Water Bootle",0},
- {"Empty Can",0},
- {"Scraffy Burgers",0},
- {"Pack:1866 Slug",0},
- {"Pack:2Rnd. Slug",0},
- {"Pack:SPAZ-12 Pellet",0},
- {"Radio",0},
- {"Battle Axe",0},
- {"Shovel Of Justice",0},
- {"Golf Club",0},
- {"Radio Device",0},
- {"Automat:AK-101",0},
- {"Karambit",0},
- {"Automat:M4A1",0},
- {"Automat:M416",0},
- {"Automat:M16A1",0},
- {"Automat:M16A2",0},
- {"Automat:M16A2 M203",0},
- ---
- {"Battle Kevlar (%.50)",0},
- {"Sniper Kevlarт (%.30)",0},
- {"Kevlar (%.40)",0},
- {"Light Kevlar (%.20)",0},
- {"Heavy Kevlar (%.60)",0},
- {"Sniper Cap",0},
- {"Heavy Helmet (%.80)",0},
- {"Berserker Helmet (%.90)",0},
- {"Striker Helmet (%.70)",0},
- {"Helmet (%.60)",0},
- {"Sniper Helmet (%.50)",0},
- ---
- {"Small Backpack (14)",0},
- {"Tourist Backpack (20)",0},
- {"British Assault Backpack (36)",0},
- {"Coyote Backpack (40)",0},
- {"Military Backpack (48)",0},
- {"Polish Backpack (55)",0},
- {"Moutain Backpack (69)",0},
- {"C.M.R.A Backpack (82)",0},
- ---
- {"Poor Clothing",0},
- {"Police Clothing",0},
- {"Civilian Clothing (4)",0},
- {"G.R.O.M Clothing",0},
- {"Civilian Clothing 2 (3)",0},
- {"Hunter Clothing",0},
- {"Civlian CLothing 3 (2)",0},
- {"Szachid Clothing ",0},
- {"Civilian Clothing 4",0},
- {"Cammo Clithing",0},
- {"Radio",0},
- }
- serverData = {
- ["vehicle"] = {
- {"MAX_Slots"},
- {"Tire_inVehicle"},
- {"Engine_inVehicle"},
- {"Parts_inVehicle"},
- {"Tire_inVehicle_HP"},
- {"Engine_inVehicle_HP"},
- {"Parts_inVehicle_HP"},
- {"spawn"},
- {"fuel"},
- {"receiver"},
- {"vehicle:station"},
- {"armorPoints"},
- {"armorPointsMax"},
- },
- ["items"] = {
- {"Tools"}
- {"WoodPile"}
- {"Bandage"}
- {"Water Bootle"}
- {"Pasta Can"}
- {"Beans Can"}
- {"Hamburger"}
- {"Box Of Matches"}
- {"MAG:M1911 "}
- {"MAG:M9 SD"}
- {"MAG:Rewolwer"}
- {"Pistol:M1911"}
- {"Pistol:M9 SD"}
- {"Winchester 1866"}
- {"Pistol:PDW",}
- {"Battle Knife"}
- {"Battle Axe"}
- {"Pizza"}
- {"Morphine"}
- {"Water Bootle"}
- {"Empty Gas Carnister"}
- {"Full Gas Carnister"}
- {"Fire"},
- {"Milk"},
- {"MAG:PDW"}
- {"MAG::MP5A5 "}
- {"MAG:G36 "}
- {"BELT MAG:PKP "}
- {"BELT MAG:PKM "}
- {"MAG:AUG "},
- {"BELT MAG:M240"}
- {"BELT MAG:RPK"},
- {"BELT MAG:MK48 "}
- {"BELT MAG:M249"}
- {"MAG:AS50 "}
- {"MAG:M24 "}
- {"MAG:DMR "}
- {"MAG:KSVK "}
- {"MAG:M107 "}
- {"MAG:SVD"}
- {"BELT MAG:MG36"}
- {"BELT MAG:L85A2 "}
- {"MAG:SCAR"}
- {"MAG:M200"}
- {"MAG:VSS"}
- {"MAG:DSR"}
- {"BELT MAG:PCA "}
- {"MAGS:AK"}
- {"MAGS:M4A1"}
- {"Automat:M4A1 HWS M203"}
- {"Automat:AKM"},
- {"Automat:AKS-74 PSO"}
- {"Automat:AK-107 GL"}
- {"Automat:G36 Camo"}
- {"Automat:AKS Gold"}
- {"Automat:AKS-74UN Kobra"}
- {"Automat:G36"},
- {"Automat:G36C-SD"}
- {"Heavy:PKP"}
- {"Heavy:PKM"}
- {"Automat:AUG"}
- {"Heavy:M240"
- {"Heavy:RPK"}
- {"Heavy:MK48"}
- {"Heavy:M249 SAW"},
- {"Sniper-Rifle:AS50"}
- {"Sniper-Rifle:M24"}
- {"Sniper-Rifle:DMR"}
- {"Sniper-Rifle:KSVK"}
- {"Sniper-Rifle:M107"}
- {"Sniper-Rifle:SVD Camo"}
- {"Heavy:MG36"}
- {"Automat:L85A2 Holo"}
- {"Automat:M4A1 CCO SD"}
- {"Automat:L85A2"}
- {"Automat:L85A2 ACOG GL"}
- {"Automat:SCAR-SD"}
- {"Automat:SCAR"}
- {"Sniper-Rifle:M200"}
- {"Sniper-Rifle:VSS"}
- {"Sniper-Rifle:DSR50"}
- {"Heavy:PCA"}
- {"Pepper Gas"}
- {"Granade:Hand:Granade"}
- {"Rewolwer"}
- {"Sawn-Off Shotgun"}
- {"Shotgun:SPAZ-12"}
- {"MP5A5"}
- {"HOURS"}
- {"Med Kit"}
- {"Heat Pack"}
- {"Rifle:Lee Enfield"}
- {"Pistol:PDW"}
- {"Automat AK-74"}
- {"Blood Bag"}
- {"GPS"}
- {"Cart"}
- {"Tools"}
- {"Wire Fence"}
- {"Tire"}
- {"Engine"}
- {"Tank Parts"}
- {"M136 Rocket"}
- {"MAG:CZ550 "}
- {"MAG:Lee Enfield "}
- {"Automat:М4А1 CCO"}
- {"MAG:CZ550"}
- {"Satchel"}
- {"Тепловизор"}
- {"PNW"}
- {"Tent (Small)"}
- {"Tent (Military)"}
- {"Tent (Big)"}
- {"Cooked Meat"}
- {"Raw Meat"}
- {"Painkiller"}
- {"Binoculars"}
- {"Empty Water Bootle"}
- {"Empty Can"}
- {"Scraffy Burgers"}
- {"Pack:1866 Slug"},
- {"Pack:2Rnd. Slug"}
- {"Pack:SPAZ-12 Pellet"}
- {"Radio"}
- {"Battle Axe"}
- {"Shovel Of Justice"}
- {"Golf Club"}
- {"Radio Device"}
- {"Automat:AK-101"}
- {"Karambit"}
- {"Automat:M4A1"}
- {"Automat:M416"}
- {"Automat:M16A1"}
- {"Automat:M16A2"}
- {"Automat:M16A2 M203"}
- ---
- {"Battle Kevlar (%.50)"}
- {"Sniper Kevlarт (%.30)"}
- {"Kevlar (%.40)"},
- {"Light Kevlar (%.20)"}
- {"Heavy Kevlar (%.60)"}
- {"Sniper Cap"},
- {"Heavy Helmet (%.80)"}
- {"Berserker Helmet (%.90)"}
- {"Striker Helmet (%.70)"}
- {"Helmet (%.60)"},
- {"Sniper Helmet (%.50)"}
- },
- }
- totalData = {
- "zombieskilled_total",
- "murders_total",
- }
- function playerLogin(username, pass, player)
- local playerID = getAccountData(getPlayerAccount(player),"playerID")
- account = getPlayerAccount(player)
- local x,y,z = getAccountData(account,"last_x"),getAccountData(account,"last_y"),getAccountData(account,"last_z")
- local skin = getAccountData(account,"skin")
- if skin == 73 then skin = 0 end
- for i, v in ipairs ( totalData ) do
- setElementData(player,v,getAccountData(account,v) or 0)
- end
- if getAccountData(account,"isDead") then
- spawnDayZPlayer(player)
- return
- end
- spawnPlayer (player, x,y,z, math.random(0,360), skin, 0, 0)
- setElementFrozen(player, true)
- fadeCamera (player, true)
- setCameraTarget (player, player)
- setTimer( function(player)
- if isElement(player) then
- setElementFrozen(player, false)
- end
- end,500,1,player)
- playerCol = createColSphere(x,y,z,1.5)
- setElementData(player,"playerCol",playerCol)
- attachElements ( playerCol, player, 0, 0, 0 )
- setElementData(playerCol,"parent",player)
- setElementData(playerCol,"player",true)
- for i,data in ipairs(playerDataTable) do
- local elementData = getAccountData(account,data[1])
- -- if data[1] == "alivetime_total" then
- -- local alive = getAccountData(account,"alivetime") or 1
- -- if not elementData or elementData < alive then
- -- elementData = alive
- -- end
- -- end
- if not elementData then
- if data[1] == "brokenbone" or data[1] == "pain" or data[1] == "isPlayerZombie" or data[1] == "cold" or data[1] == "infection" or data[1] == "currentweapon_1" or data[1] == "currentweapon_2" or data[1] == "currentweapon_3" or data[1] == "bandit" then
- elementData = elementData
- elseif data[1] == "zombieskilled_total" then
- elementData = getAccountData(account,"zombieskilled") or 0
- elseif data[1] == "murders_total" then
- elementData = getAccountData(account,"murders") or 0
- else
- elementData = 0
- end
- end
- setElementData(player,data[1],elementData)
- end
- setElementData(player,"logedin",true)
- setElementData(player,"Repairing",false)
- setElementData(player,"isEating",false)
- setElementData(player,"isUseMedic",false)
- setElementData(player,"isDrinking",false)
- setElementData(player,"isSetingTent",false)
- local weapon = getElementData(player,"currentweapon_1")
- if weapon then
- local ammoData,weapID = getWeaponAmmoType (weapon)
- giveWeapon(player,weapID,getElementData(player,ammoData), true )
- end
- local weapon = getElementData(player,"currentweapon_2")
- if weapon then
- local ammoData,weapID = getWeaponAmmoType (weapon)
- giveWeapon(player,weapID,getElementData(player,ammoData), false )
- end
- local weapon = getElementData(player,"currentweapon_3")
- if weapon then
- local ammoData,weapID = getWeaponAmmoType (weapon)
- giveWeapon(player,weapID,getElementData(player,ammoData), false )
- end
- setElementModel(player, skin)
- setElementData ( player, "skin", skin )
- --setElementData(player,gameplayVariables["clothname"],1)
- setElementData(player,"admin",getAccountData(account,"admin") or false)
- setElementData(player,"supporter",getAccountData(account,"supporter") or false)
- triggerClientEvent(player, "onClientPlayerDayZLogin", player)
- end
- addEvent("onPlayerDayZLogin", true)
- addEventHandler("onPlayerDayZLogin", getRootElement(), playerLogin)
- function playerRegister(username, pass, player)
- local number = math.random(table.size(spawnPositions))
- local x,y,z = spawnPositions[number][1],spawnPositions[number][2],spawnPositions[number][3]
- spawnPlayer (player, x,y,z, math.random(0,360), 0, 0, 0)
- fadeCamera (player, true)
- setCameraTarget (player, player)
- playerCol = createColSphere(x,y,z,1.5)
- attachElements ( playerCol, player, 0, 0, 0 )
- setElementData(playerCol,"parent",player)
- setElementData(playerCol,"player",true)
- for i,data in ipairs(playerDataTable) do
- setElementData(player,data[1],data[2])
- end
- account = getAccount(username)
- local value = getAccounts()
- local value = #value
- --setElementData(player,gameplayVariables["clothname"],1)
- setElementData(player,"playerID",value+1)
- setAccountData(account,"playerID",value+1)
- setElementData(player,"logedin",true)
- end
- addEvent("onPlayerDayZRegister", true)
- addEventHandler("onPlayerDayZRegister", getRootElement(), playerRegister)
- function loadDataBase()
- local qh = dbQuery(database, "SELECT * FROM vehicles")
- if qh then
- local result, num_affected_rows, errmsg = dbPoll ( qh, -1 )
- if num_affected_rows > 0 then
- for result, row in pairs ( result ) do
- createNewVehicle(row)
- end
- end
- end
- local qh = dbQuery(database, "SELECT * FROM tents")
- if qh then
- local result, num_affected_rows, errmsg = dbPoll ( qh, -1 )
- if num_affected_rows > 0 then
- for result, row in pairs ( result ) do
- createNewTent(row,"tent")
- end
- end
- end
- end
- function saveDataBased()
- outputChatBox(" ",getRootElement(),255,255,255,true)
- outputChatBox("#FF0000BACKUP:#FFFFFF DATA SAVING COMMING LITTLE LAG...",getRootElement(),255,255,255,true)
- destroyDataBase("tents")
- destroyDataBase("vehicles")
- for i,tent in ipairs(getElementsByType("colshape")) do
- if getElementData(tent,"tent") then
- local x,y,z = getElementPosition(tent)
- local col = getElementData(tent,"parent")
- local rotx,roty,rot = getElementRotation(getElementData(tent,"parent"))
- local dataT = {}
- local noDeleteTent = false
- for i,v in ipairs(serverData["items"]) do
- local data = getElementData(tent,v[1]) or 0
- if data > 0 then
- noDeleteTent = true
- end
- table.insert(dataT,{v[1],data})
- end
- if noDeleteTent == true then
- local result = dbQuery( database, "INSERT INTO `tents` VALUES ('"..x.."', '"..y.."', '"..z.."', '"..rot.."','"..toJSON(dataT).."');")
- dbFree (result)
- else
- destroyElement(tent)
- destroyElement(col)
- end
- end
- end
- for index,element in ipairs(getElementsByType("vehicle")) do
- local x,y,z = getElementPosition(element)
- local col = getElementData(element,"parent")
- local rotx,roty,rot = getElementRotation(element)
- local model = getElementModel(element)
- local health = getElementHealth(element)
- local dataT = {}
- for i,v in ipairs(serverData["items"]) do
- if col ~= false then
- local data = getElementData(col,v[1]) or 0
- table.insert(dataT,{v[1],data})
- end
- end
- for i,v in ipairs(serverData["vehicle"]) do
- if col ~= false then
- local data = getElementData(col,v[1]) or 0
- table.insert(dataT,{v[1],data})
- end
- end
- local result = dbQuery( database, "INSERT INTO `vehicles` VALUES ('"..model.."','"..x.."', '"..y.."', '"..z.."', '"..rot.."','"..health.."', '"..toJSON(dataT).."');")
- dbFree (result)
- end
- outputChatBox("#FF0000BACKUP:#FFFFFF DATA SAVED..",getRootElement(),255,255,255,true)
- baseCopy()
- end
- setTimer(saveDataBased,backTime,0)
- function autoStopSave()
- if auto_save == true then
- saveDataBased()
- end
- end
- addEventHandler("onResourceStop", getResourceRootElement(getThisResource()),autoStopSave)
- addCommandHandler("save",function(player)
- if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup(adm_group)) then
- saveDataBased()
- end
- end)
- addCommandHandler("load",function(player)
- if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup(adm_group)) then
- if auto_load == true then
- outputChatBox("Automatic Data Loading Can't do it by Hand.",player,255,0,0,true)
- outputChatBox("Do it With Team.",player,255,0,0,true)
- return true
- end
- loadDataBase()
- outputChatBox("#00cc00Data base Loading.",player,255,255,255,true)
- end
- end)
- addCommandHandler("autoloadoff",function(player)
- if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup(adm_group)) then
- if auto_load == true then
- auto_load = false
- outputChatBox("Car Spawn Temporarily Blocked!",player)
- else
- auto_load = true
- outputChatBox("Car Spawn Temporaily!",player)
- end
- end
- end)
- addCommandHandler("autolsaveoff",function(player)
- if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup(adm_group)) then
- if auto_save == true then
- auto_save = false
- outputChatBox("Automatic temporarily disconnected maintenance!",player)
- else
- auto_save = true
- outputChatBox("Automatic temporarily included maintenance!",player)
- end
- end
- end)
- function destroyDataBase(base)
- if base == "vehicles" then
- local qh = dbQuery(database, "DELETE FROM vehicles")
- local result = dbPoll( qh, -1 )
- elseif base == "tents" then
- local qh = dbQuery(database, "DELETE FROM tents")
- local result = dbPoll( qh, -1 )
- end
- end
- function createNewVehicle(row)
- local model = tonumber(row['model'])
- local data = fromJSON(row['data'])
- local x = tonumber(row['x'])
- local y = tonumber(row['y'])
- local z = tonumber(row['z'])
- local r = tonumber(row['r'])
- local health = tonumber(row['health'])
- veh = createVehicle(model,x,y,z,0,0,r)
- vehCol = createColSphere(x,y,z,3)
- attachElements(vehCol,veh,0,0,1.5)
- setElementData(vehCol,"parent",veh)
- setElementData(veh,"parent",vehCol)
- setElementData(vehCol,"vehicle",true)
- setElementData(vehCol,"ID",row)
- setElementHealth(veh,health)
- for i,v in pairs(data) do
- setElementData(vehCol,v[1],v[2])
- end
- end
- function createNewTent(row,class)
- local data = fromJSON(row['data'])
- local x = tonumber(row['x'])
- local y = tonumber(row['y'])
- local z = tonumber(row['z'])
- local r = tonumber(row['r'])
- if class == "tent" then
- tent = createObject(3243,x,y,z,0,0,r)
- --setObjectScale(tent,1.3)
- tentCol = createColSphere(x,y,z,3)
- attachElements ( tentCol, tent, 0, 0, 0 )
- setElementData(tentCol,"parent",tent)
- setElementData(tent,"parent",tentCol)
- setElementData(tentCol,"tent",true)
- setElementData(tentCol,"vehicle",true)
- --setElementData(tentCol,"MAX_Slots",100)
- for i,v in pairs(data) do
- setElementData(tentCol,v[1],v[2])
- end
- if getElementData(tentCol,"MAX_Slots") == false or nil then
- setElementData(tentCol,"MAX_Slots",100)
- end
- if getElementData(tentCol,"MAX_Slots") == 100 then
- setElementModel(tent,3243)
- elseif getElementData(tentCol,"MAX_Slots") == 200 then
- setElementModel(tent,1947)
- elseif getElementData(tentCol,"MAX_Slots") == 300 then
- setElementModel(tent,14581)
- end
- end
- end
- function destroyThisVehicle(ps, cmd)
- if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( ps ) ), aclGetGroup ( adm_group ) ) then
- local theVehicle = getPedOccupiedVehicle(ps)
- if (theVehicle) then
- local col = getElementData(theVehicle, "parent")
- destroyElement(col)
- destroyElement(theVehicle)
- else
- outputChatBox("You Should Be In Transport !.",ps,30,144,255,true)
- end
- end
- end
- addCommandHandler("dtv", destroyThisVehicle)
- function destroyVehiclePack(ps, cmd)
- if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount (ps) ), aclGetGroup ( adm_group ) ) then
- vehicles = getElementsByType("vehicle")
- for i,v in ipairs(vehicles) do
- local col = getElementData(v, "parent")
- if isElement (col) then
- destroyElement(col)
- end
- destroyElement(v)
- end
- end
- end
- addCommandHandler("dvp", destroyVehiclePack)
- function saveAccounts ()
- local account = getPlayerAccount(source)
- if account then
- if isElementInWater ( source ) then
- setAccountData(account,"isDead",true)
- end
- for i,data in ipairs(playerDataTable) do
- setAccountData(account,data[1],getElementData(source,data[1]))
- end
- setAccountData(account,"cloth0",getElementData(source,"cloth0") or 0)
- setAccountData(account,"cloth1",getElementData(source,"cloth1") or 0)
- setAccountData(account,"cloth2",getElementData(source,"cloth2") or 0)
- setAccountData(account,"cloth3",getElementData(source,"cloth3") or 0)
- setAccountData(account,"cloth15",getElementData(source,"cloth15") or 0)
- setAccountData(account,"cloth16",getElementData(source,"cloth16") or 0)
- if getElementData(source,"antiRelogWork") then
- createPlayerBody(source)
- setAccountData(account,"isDead",true)
- end
- local x,y,z = getElementPosition(source)
- setAccountData(account,"last_x",x)
- setAccountData(account,"last_y",y)
- setAccountData(account,"last_z",z)
- if isElement(getElementData(source,"playerCol")) then
- destroyElement(getElementData(source,"playerCol"))
- end
- end
- setElementData(source,"logedin",false)
- end
- addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts )
- function saveAccounts2 ()
- for i, player in ipairs(getElementsByType("player")) do
- local account = getPlayerAccount(player)
- if account then
- for i,data in ipairs(playerDataTable) do
- setAccountData(account,data[1],getElementData(player,data[1]))
- end
- local x,y,z = getElementPosition(player)
- setAccountData(account,"last_x",x)
- setAccountData(account,"last_y",y)
- if isElementInWater ( source ) then
- setAccountData(account,"last_z",z+30)
- else
- setAccountData(account,"last_z",z)
- end
- end
- end
- end
- addEventHandler ( "onResourceStop", getRootElement(), saveAccounts2 )
- function baseCopy()
- local randomName = randomString(10)
- local time = getRealTime()
- local second = time.second
- local minute = time.minute
- local hour = time.hour
- local monthday = time.monthday
- local month = time.month
- local year = time.year
- fileCopy("database.db","database_backup/"..monthday.."."..month + 1 ..".".. year + 1900 .."_"..hour.."."..minute.."."..second.."_"..randomName..".db")
- end
- function randomString(sym_num)
- symbols = {"A","a","B","b","C","c","D","d","I","i","J","j","K","k","L","l","M","m","N","n","O","o","P","p","Q","q","R","r","T","t","U","u","V","v","W","w","X","x","Y","y","Z","z"}
- local pass = ""
- for i = 1, sym_num do
- if math.random (1,2) == 1 then
- pass = pass..tostring(math.random(0,9))
- else
- pass = pass..symbols[math.random(1,#symbols)]
- end
- end
- return pass
- end
Advertisement
Add Comment
Please, Sign In to add comment