Jump to content

my source bugs


Recommended Posts

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  
= { { { { "nothing to see here" } } } } function () return "nope" end ()
--Server start requirements
--serverslots
--gamemodename
--
getResourceRootElement(getThisResource())
function checkResourceRequirements ( res )
    = { { { { "nothing to see here" } } } } function () return "nope" end ()
    if getResourceName(getThisResource()) ~= "DayZ" then
        reason = "Name of resource does not match (DayZ)!"
    end
    if reason ~= false then
        outputServerLog ( "Resource " .. getResourceName(res) .. " wasn't started: ("..tostring(reason)..")." )
        outputChatBox ( "Resource " .. getResourceName(res) .. " wasn't started: ("..tostring(reason)..").", getRootElement(), 255, 255, 255 )
        outputConsole ( "Resource " .. getResourceName(res) .. " wasn't started: ("..tostring(reason)..")." )
        outputDebugString ( "Resource " .. getResourceName(res) .. " wasn't started: ("..tostring(reason)..")." )
        cancelEvent()
    end    
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), checkResourceRequirements )
 
 
local itemTable = {
----------------------
["farm"] = {
{"Wood Pile",1463,0.4,0,13},
{"Bandage",1578,0.5,0,4},
{"Water Bottle",2683,1,0,6},
{"Pasta Can",2770,1,0,6},
{"Beans Can",2601,1,0,6},
{"Burger",2768,1,0,6},
{"Empty Soda Cans",2673,0.5,0,12},
{"Scruffy Burgers",2675,0.5,0,12},
{"Soda Bottle",2647,1,0,9},
{"Empty Gas Canister",1650,1,0,10},
{"Hunting Knife",335,1,90,4},
{"Box of Matches",328,0.4,90,8},
{"Desert Eagle",348,1,90,0.2},
{"Morphine",1579,1,0,4},
{"Tent",1279,1,0,0.5},
{"M1911",346,1,90,4},
{"Painkiller",2709,3,0,3.5},
{"Lee Enfield",357,1,90,0.3},
{"Winchester 1866",349,1,90,0.3},
{"Tire",1073,1,0,2},
{"Tank Parts",1008,1,0.8,2},
{"Civilian Clothing",1241,2,0,2.5},
{"Map",1277,0.8,90,6},
{"GPS",2976,0.15,0,2},
},
----------------------
["residential"] = {
{"Box of Matches",328,0.4,90,5},
{"Wood Pile",1463,0.4,0,5},
{"M1911",346,1,90,1.5},
{"M9 SD",347,1,90,1.9},
{"Winchester 1866",349,1,90,0.1},
{"PDW",352,1,90,1},
{"Hunting Knife",335,1,90,3},
{"Hatchet",339,1,90,1},
{"Pizza",1582,1,0,7},
{"Soda Bottle",2647,1,0,7},
{"Empty Gas Canister",1650,1,0,9},
{"Roadflare",324,1,90,9},
{"Milk",2856,1,0,7},
{"Assault Pack (ACU)",3026,1,0,6},
{"Painkiller",2709,3,0,7},
{"Empty Soda Cans",2673,0.5,0,12},
{"Scruffy Burgers",2675,0.5,0,12},
{"Grenade",342,1,0,0.01},
{"Desert Eagle",348,1,90,0.4},
{"Sawn-Off Shotgun",350,1,90,0.3},
{"SPAZ-12 Combat Shotgun",351,1,90,0.4},
{"MP5A5",353,1,90,0.4},
{"Watch",2710,1,0,3},
{"Heat Pack",1576,5,0,6},
{"Wire Fence",933,0.25,0,1},
{"Lee Enfield",357,1,90,0.3},
{"Alice Pack",1248,1,0,1.5},
{"Tire",1073,1,0,1},
{"Tank Parts",1008,0.8,0,1},
{"Morphine",1579,1,0,2},
{"Civilian Clothing",1241,2,0,9},
{"Map",1277,0.8,90,10},
{"GPS",2976,0.15,0,3},
{"Pasta Can",2770,1,0,7},
{"Beans Can",2601,1,0,7},
--{"TEC-9",372,1,90,0},
{"Burger",2768,1,0,7},
{"Golf Club",333,1,90,3},
{"Baseball Bat",336,1,90,3},
{"Shovel",337,1,90,3},
},
----------------------
["military"] = {
{"Box of Matches",328,0.4,90,2},
{"M1911",346,1,90,5},
{"M9 SD",347,1,90,4},
{"Winchester 1866",349,1,90,3},
{"PDW",352,1,90,4},
{"Hunting Knife",335,1,90,2.4},
{"Hatchet",339,1,90,2.1},
{"Pizza",1582,1,0,2},
{"Soda Bottle",2647,1,0,2},
{"Empty Gas Canister",1650,1,0,4},
{"Roadflare",324,1,90,4},
{"Milk",2856,1,0,1},
{"Painkiller",2709,3,0,4},
{"Empty Soda Cans",2673,0.5,0,12},
{"Scruffy Burgers",2675,0.5,0,12},
{"Grenade",342,1,0,0.5},
{"Sawn-Off Shotgun",350,1,90,2.3},
{"SPAZ-12 Combat Shotgun",351,1,90,2.3},
{"MP5A5",353,1,90,2.8},
{"Watch",2710,1,0,4},
{"Heat Pack",1576,5,0,3},
{"Wire Fence",933,0.25,0,1},
{"Lee Enfield",357,1,90,3.5},
{"Alice Pack",1248,1,0,4},
{"Night Vision Goggles",368,1,90,4},
{"Binoculars",369,1,0,4},
{"Tire",1073,1,0,2},
{"Tank Parts",1008,0.8,0,2},
{"Morphine",1579,1,0,4},
{"Camouflage Clothing",1247,2,0,4.5},
{"Civilian Clothing",1241,2,0,3},
--{"TEC-9",372,1,90,3},
{"AK-47",355,1,90,3.8},
{"GPS",2976,0.15,0,3},
{"Map",1277,0.8,90,7},
{"Toolbox",2969,0.5,0,1},
{"Engine",929,0.3,0,2},
{"Tent",1279,1,0,4.5},
{"Ghillie Suit",1213,2,0,0.3},
{"M4",356,1,90,2.4},
{"CZ 550",358,1,90,0.4},
{"Infrared Goggles",369,1,90,3},
{"Assault Pack (ACU)",3026,1,0,5},
{"Czech Backpack",1239,1,0,2},
{"Radio Device",330,1,0,6},
{"Coyote Backpack",1252,1,0,0.9},
{"Shovel",337,1,90,1},
},
----------------------
["industrial"] = {
{"Wire Fence",933,0.25,0,7},
{"Toolbox",2969,0.5,0,3},
{"Tire",1073,1,0,4},
{"Engine",929,0.3,0,3.5},
{"Tank Parts",1008,1,0.8,4},
{"Winchester 1866",349,1,90,3},
{"Water Bottle",2683,1,0,4},
{"Pasta Can",2770,1,0,4},
{"Beans Can",2601,1,0,4},
{"Burger",2768,1,0,4},
{"Empty Soda Cans",2673,0.5,0,12},
{"Scruffy Burgers",2675,0.5,0,10},
{"Soda Bottle",2647,1,0,4},
{"Empty Gas Canister",1650,1,0,6},
{"Full Gas Canister",1650,1,0,1.5},
{"Map",1277,0.8,90,3},
{"Watch",2710,1,0,2},
{"Box of Matches",328,0.4,90,5},
{"Wood Pile",1463,0.4,0,2},
{"M1911",346,1,90,1.5},
{"PDW",352,1,90,2},
{"Hunting Knife",335,1,90,2},
{"Hatchet",339,1,90,1.5},
{"Pizza",1582,1,0,4},
{"Roadflare",324,1,90,5},
{"Milk",2856,1,0,4},
{"Assault Pack (ACU)",3026,1,0,6},
{"Coyote Backpack",1252,1,0,0.5},
{"Radio Device",330,1,0,6},
{"Golf Club",333,1,90,1.5},
{"Baseball Bat",336,1,90,1.5},
{"Shovel",337,1,90,1.5},
{"Night Vision Goggles",368,1,90,1.5},
},
----------------------
["supermarket"] = {
{"Raw Meat",2804,0.5,90,8},
{"Box of Matches",328,0.4,90,5},
{"Wood Pile",1463,0.4,0,5},
{"M1911",346,1,90,3.5},
{"PDW",352,1,90,2},
{"Hunting Knife",335,1,90,3},
{"Hatchet",339,1,90,2.1},
{"Pizza",1582,1,0,7},
{"Soda Bottle",2647,1,0,7},
{"Empty Gas Canister",1650,1,0,5},
{"Roadflare",324,1,90,6},
{"Milk",2856,1,0,7},
{"Assault Pack (ACU)",3026,1,0,6},
{"Pasta Can",2770,1,0,7},
{"Beans Can",2601,1,0,7},
{"Burger",2768,1,0,7},
{"Painkiller",2709,3,0,7},
{"Empty Soda Cans",2673,0.5,0,12},
{"Scruffy Burgers",2675,0.5,0,12},
{"MP5A5",353,1,90,0.5},
{"Watch",2710,1,0,3},
{"Heat Pack",1576,5,0,6},
{"Wire Fence",933,0.25,0,1},
{"Lee Enfield",357,1,90,0.2},
{"Alice Pack",1248,1,0,0.5},
{"Tire",1073,1,0,1},
{"Tank Parts",1008,1,0.8,2},
{"Morphine",1579,1,0,2},
{"Civilian Clothing",1241,2,0,3.5},
{"Map",1277,0.8,90,4},
{"GPS",2976,0.15,0,1},
{"Radio Device",330,1,0,6},
{"Golf Club",333,1,90,1.9},
{"Baseball Bat",336,1,90,1.4},
{"Shovel",337,1,90,0.3},
},
["other"] = {
{"Raw Meat",2804,0.5,90},
{"Cooked Meat",2806,0.5,90},
{"Full Gas Canister",1650,1,0},
{"Empty Water Bottle",2683,1,0},
{"Survivor Clothing",1577,2,0},
{"Night Vision Goggles",368,1,90},
{"Infrared Goggles",369,1,90},
{"1866 Slug",2358,2,0},
{"2Rnd. Slug",2358,2,0},
{"SPAZ-12 Pellet",2358,2,0},
{"MP5A5 Mag",2358,2,0},
{"AK Mag",1271,2,0},
{"M4 Mag",1271,2,0},
{"M1911 Mag",3013,2,0},
{"M9 SD Mag",3013,2,0},
{"Desert Eagle Mag",3013,2,0},
--{"M136 Rocket",3082,0.7,90},
{"CZ 550 Mag",2358,2,0},
{"Lee Enfield Mag",2358,2,0},
{"PDW Mag",2041,2,0},
{"MP5A5 Mag",2041,2,0},
{"Box of Matches",328,0.4,90,5},
{"Wood Pile",1463,0.4,0,5},
{"M1911",346,1,90,3.5},
{"PDW",352,1,90,2},
{"Hunting Knife",335,1,90,2.5},
{"Hatchet",339,1,90,1.8},
{"Pizza",1582,1,0,7},
{"Soda Bottle",2647,1,0,7},
{"Empty Gas Canister",1650,1,0,5},
{"Roadflare",324,1,90,6},
{"Milk",2856,1,0,5},
Link to comment

Next errors:

ERROR:   DayZ\inventory.lua:579: attempt to compare number with boolean 
WARNING: DayZ\inventory.lua:756: Bad argument @ 'triggerEvent' [Expected string at argument 1, got player] 
WARNING: DayZ\inventory.lua:761: Bad argument @ 'triggerEvent' [Expected string at argument 1, got player] 
WARNING: DayZ\inventory.lua:767: Bad argument @ 'triggerEvent' [Expected string at argument 1, got player] 
WARNING: DayZ\inventory.lua:773: Bad argument @ 'triggerEvent' [Expected string at argument 1, got player] 
ERROR:   DayZ\inventory.lua:1126: C stack overflow 
WARNING: DayZ\menu_client.lua:337: Bad argument @ 'getVehicleName' [Expected vehicle at argument 1, got object] 
WARNING: DayZ\menu_client.lua:340: Bad argument @ 'getVehicleName' [Expected vehicle at argument 1, got object] 
ERROR:   DayZ\menu_client.lua:391: attempt to perform arithmetic on local 'x' (a boolean value) 

inventory.lua

--[[ 
#---------------------------------------------------------------#
----*            DayZ MTA Script inventory.lua                *----
----* This Script is owned by Marwin, you are not allowed to use or own it.
----* Owner: Marwin W., Germany, Lower Saxony, Otterndorf
----* Skype: xxmavxx96
----*                                                        *----
#---------------------------------------------------------------#
]]
 
inventoryItems = {
["Weapons"] = {
["Primary Weapon"] = {
{"M4",3},
{"CZ 550",3},
{"Winchester 1866",3},
{"SPAZ-12 Combat Shotgun",3},
{"Sawn-Off Shotgun",3},
{"AK-47",3},
{"Lee Enfield",3},
--{"Heat-Seeking RPG",5},
--{"M136 Rocket Launcher",5},
},
 
["Secondary Weapon"] = {
{"M1911",2},
{"M9 SD",2},
{"PDW",2},
--{"TEC-9",2},
{"MP5A5",3},
{"Desert Eagle",2},
{"Hunting Knife",1},
{"Hatchet",2},
{"Baseball Bat",2},
{"Shovel",2},
{"Golf Club",2},
},
 
["Specially Weapon"] = {
{"Parachute",1},
{"Tear Gas",1},
{"Grenade",1},
{"Binoculars",1}
},
 
},
["Ammo"] = {
{"M1911 Mag",0.085},
{"M9 SD Mag",0.085},
{"Desert Eagle Mag",0.085},
{"PDW Mag",0.025},
{"MP5A5 Mag",0.025},
{"AK Mag",0.035},
{"M4 Mag",0.035},
{"1866 Slug",0.067},
{"2Rnd. Slug",0.067},
{"SPAZ-12 Pellet",0.067},
{"CZ 550 Mag",0.1},
{"Lee Enfield Mag",0.1},
--{"M136 Rocket",2},
},
 
["Food"] = {
{"Water Bottle",1},
{"Pasta Can",1},
{"Beans Can",1},
{"Burger",1},
{"Pizza",1},
{"Soda Bottle",1},
{"Milk",1},
{"Cooked Meat",1},
},
 
["Items"] = {
{"Wood Pile",2},
{"Bandage",1,"Bandage yourself"},
{"Roadflare",1,"Place"},
{"Empty Gas Canister",2},
{"Full Gas Canister",2},
{"Medic Kit",2,"Use"},
{"Heat Pack",1,"Use"},
{"Painkiller",1,"Use"},
{"Morphine",1,"Use"},
{"Blood Bag",1,"Use"},
{"Wire Fence",1,"Build a wire fence"},
{"Raw Meat",1},
{"Tire",2},
{"Engine",5},
{"Tank Parts",3},
{"Tent",3,"Pitch a tent"},
{"Camouflage Clothing",1,"Put clothes on"},
{"Civilian Clothing",1,"Put clothes on"},
{"Survivor Clothing",1,"Put clothes on"},
{"Ghillie Suit",1,"Put clothes on"},
{"Empty Water Bottle",1,"Fill bottle up"},
{"Empty Soda Cans",1},
{"Scruffy Burgers",1},
{"Assault Pack (ACU)",1},
{"Alice Pack",1},
{"Czech Backpack",1},
{"Coyote Backpack",1},
},
 
["Toolbelt"] = {
{"Night Vision Goggles",1},
{"Infrared Goggles",1},
{"Map",1},
{"Box of Matches",1,"Make a Fire"},
{"Watch",1},
{"GPS",1},
{"Toolbox",1},
{"Radio Device",1},
},
}
 
 
------------------------------------------------------------------------------
--INVENTORY
local headline = {}
local gridlistItems = {}
local buttonItems = {}
 
 
inventoryWindows = guiCreateWindow(0.15, 0.28, 0.72, 0.63, "", true)
-- inventoryWindows = guiCreateStaticImage(0.25,0.25,0.5,0.5,"images/scrollmenu_1.png",true)
 
 
headline["loot"] = guiCreateLabel(0.06, 0.05, 0.34, 0.09,"GEAR",true,inventoryWindows)
guiLabelSetHorizontalAlign (headline["loot"],"center")
guiSetFont (headline["loot"], "default-bold-small" )
 
headline["inventory"] = guiCreateLabel(0.60, 0.05, 0.34, 0.09,"INVENTORY",true,inventoryWindows)
guiLabelSetHorizontalAlign (headline["inventory"],"center")
guiSetFont (headline["inventory"], "default-bold-small" )
 
gridlistItems["loot"] = guiCreateGridList (0.03, 0.10, 0.39, 0.83,true,inventoryWindows)
gridlistItems["loot_colum"] = guiGridListAddColumn( gridlistItems["loot"], "Loot", 0.7 )
gridlistItems["loot_colum_amount"] = guiGridListAddColumn( gridlistItems["loot"], "", 0.2 )
 
gridlistItems["inventory"] = guiCreateGridList (0.57, 0.11, 0.39, 0.83,true,inventoryWindows)
gridlistItems["inventory_colum"] = guiGridListAddColumn( gridlistItems["inventory"], "Inventory", 0.7 )
gridlistItems["inventory_colum_amount"] = guiGridListAddColumn( gridlistItems["inventory"], "", 0.2 )
 
buttonItems["loot"] = guiCreateButton(0.42, 0.17, 0.04, 0.69, "->", true,inventoryWindows)
buttonItems["inventory"] = guiCreateButton(0.53, 0.17, 0.04, 0.69, "<-", true,inventoryWindows)
 
headline["slots"] = guiCreateLabel(0.62, 0.94, 0.29, 0.04,"SLOTS:",true,inventoryWindows)
guiLabelSetHorizontalAlign (headline["slots"],"center")
guiLabelSetVerticalAlign (headline["slots"],"center")
guiSetFont (headline["slots"], "default-bold-small" )
 
headline["slots_loot"] = guiCreateLabel(0.07, 0.94, 0.29, 0.04,"SLOTS:",true,inventoryWindows)
guiLabelSetHorizontalAlign (headline["slots_loot"],"center")
guiLabelSetVerticalAlign (headline["slots_loot"],"center")
guiSetFont (headline["slots_loot"], "default-bold-small" )
 
guiSetVisible(inventoryWindows,false)
 
function showInventory (key,keyState)
if getElementData(getLocalPlayer(),"logedin") then
    if ( keyState == "down" ) then
        guiSetVisible(inventoryWindows,not guiGetVisible(inventoryWindows))
        showCursor(not isCursorShowing())
        refreshInventory()
        if guiGetVisible(inventoryWindows) == true then
            onClientOpenInventoryStopMenu ()
        else
            hideRightClickInventoryMenu ()
        end
        if isPlayerInLoot() then
            local col = getElementData(getLocalPlayer(),"currentCol")
            local gearName = getElementData(getLocalPlayer(),"lootname")
            refreshLoot(col,gearName)
        end
    end
end    
end
bindKey ( "j", "down", showInventory )
 
function showInventoryManual ()
        guiSetVisible(inventoryWindows,not guiGetVisible(inventoryWindows))
        showCursor(not isCursorShowing())
        refreshInventory()
        if guiGetVisible(inventoryWindows) == true then
            onClientOpenInventoryStopMenu ()
        end
end
 
function hideInventoryManual ()
        guiSetVisible(inventoryWindows,false)
        showCursor(false)
        hideRightClickInventoryMenu ()
end
addEvent("hideInventoryManual",true)
addEventHandler("hideInventoryManual",getLocalPlayer(),hideInventoryManual)
 
function refreshInventoryManual ()
        refreshInventory()
end
addEvent("refreshInventoryManual",true)
addEventHandler("refreshInventoryManual",getLocalPlayer(),refreshInventoryManual)
 
function refreshLootManual (loot)
        refreshLoot(loot)
end
addEvent("refreshLootManual",true)
addEventHandler("refreshLootManual",getLocalPlayer(),refreshLootManual)
 
function refreshInventory()
if ( gridlistItems["inventory_colum"] ) then --If the column has been created, fill it with players
    row1,column1 = guiGridListGetSelectedItem ( gridlistItems["inventory"] )
    guiGridListClear(gridlistItems["inventory"])
            local row = guiGridListAddRow ( gridlistItems["inventory"] )
            --guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],"ITEMS", false, false )
            local row = guiGridListAddRow ( gridlistItems["inventory"] )
            guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],"PRIMARY WEAPON", true, false )
        for id, item in ipairs(inventoryItems["Weapons"]["Primary Weapon"]) do
            if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1]) >= 1 then
                local row = guiGridListAddRow ( gridlistItems["inventory"] )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],item[1], false, false )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum_amount"],getElementData(getLocalPlayer(),item[1]), false, false )
            end
        end
                local row = guiGridListAddRow ( gridlistItems["inventory"] )
            guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],"SECONDARY WEAPON", true, false )
        for id, item in ipairs(inventoryItems["Weapons"]["Secondary Weapon"]) do
            if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1]) >= 1 then
                local row = guiGridListAddRow ( gridlistItems["inventory"] )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],item[1], false, false )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum_amount"],getElementData(getLocalPlayer(),item[1]), false, false )
            end
        end
            local row = guiGridListAddRow ( gridlistItems["inventory"] )
            guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],"SPECIAL WEAPON", true, false )
        for id, item in ipairs(inventoryItems["Weapons"]["Specially Weapon"]) do
            if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1]) >= 1 then
                local row = guiGridListAddRow ( gridlistItems["inventory"] )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],item[1], false, false )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum_amount"],getElementData(getLocalPlayer(),item[1]), false, false )
            end
        end
            local row = guiGridListAddRow ( gridlistItems["inventory"] )
            guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],"AMMO", true, false )
        for id, item in ipairs(inventoryItems["Ammo"]) do
            if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1]) >= 1 then
                local row = guiGridListAddRow ( gridlistItems["inventory"] )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum"],item[1], false, false )
                guiGridListSetItemText ( gridlistItems["inventory"], row, gridlistItems["inventory_colum_amount"],getElementData(getLocalPlayer(),item[1]), false, false )
            end
        end
           
Link to comment

can you explain me how repair this error?

WARNING: [DayZ-MTA]/DayZ/login.lua:130: Bad argument @ 'spawnPlayer' [Expected number at argument 6, got boolean] 

local 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 playerDataTable = {
{"alivetime"},
{"skin"},
{"MAX_Slots"},
{"bandit"},
{"blood"},
{"food"},
{"thirst"},
{"temperature"},
{"currentweapon_1"},
{"currentweapon_2"},
{"currentweapon_3"},
{"bleeding"},
{"brokenbone"},
{"pain"},
{"cold"},
{"infection"},
{"humanity"},
{"zombieskilled"},
{"headshots"},
{"murders"},
{"banditskilled"},
{"Wood Pile"},
{"Bandage"},
{"Water Bottle"},
{"Pasta Can"},
{"Beans Can"},
{"Burger"},
{"Box of Matches"},
{"M1911 Mag"},
{"M9 SD Mag"},
{"Desert Eagle Mag"},
{"M1911"},
{"M9 SD"},
{"Winchester 1866"},
{"PDW"},
{"Hunting Knife"},
{"Hatchet"},
{"Pizza"},
{"Morphine"},
{"Soda Bottle"},
{"Empty Gas Canister"},
{"Full Gas Canister"},
{"Roadflare"},
{"Milk"},
{"PDW Mag"},
{"MP5A5 Mag"},
{"AK Mag"},
{"M4 Mag"},
{"Tear Gas"},
{"Grenade"},
{"Desert Eagle"},
{"Sawn-Off Shotgun"},
{"SPAZ-12 Combat Shotgun"},
{"MP5A5"},
{"Watch"},
{"Medic Kit"},
{"Heat Pack"},
{"Lee Enfield"},
{"PDW"},
--{"TEC-9"},
{"AK-47"},
--{"M136 Rocket Launcher"},
{"Blood Bag"},
{"GPS"},
{"Map"},
{"Toolbox"},
{"Wire Fence"},
{"Tire"},
{"Engine"},
{"Tank Parts"},
{"M136 Rocket"},
{"CZ 550 Mag"},
{"Lee Enfield Mag"},
{"M4"},
{"CZ 550"},
--{"Heat-Seeking RPG"},
{"Satchel"},
{"Infrared Goggles"},
{"Night Vision Goggles"},
{"Tent"},
{"Raw Meat"},
{"Cooked Meat"},
{"Camouflage Clothing"},
{"Ghillie Suit"},
{"Civilian Clothing"},
{"Survivor Clothing"},
{"Painkiller"},
{"Binoculars"},
{"Empty Water Bottle"},
{"Empty Soda Cans"},
{"Scruffy Burgers"},
{"1866 Slug"},
{"2Rnd. Slug"},
{"SPAZ-12 Pellet"},
{"Radio Device"},
{"Baseball Bat"},
{"Shovel"},
{"Golf Club"},
{"Radio Device"},
{"Parachute"},
}
 
function playerLogin(username, pass, player)
    local playerID = getAccountData(getPlayerAccount(player),"playerID")
    account = getPlayerAccount(player)
    -- ORYGINALNA LINIJKA -- local x,y,z =  getAccountData(account,"last_x"),getAccountData(account,"last_y"),getAccountData(account,"last_z") --
    local x,y,z =  getAccountData(account,"last_x") or 0,getAccountData(account,"last_y") or 0,getAccountData(account,"last_z") or 0
    local skin = getAccountData(account,"skin")
    createZombieTable (player)
    if getAccountData(account,"isDead") then
        spawnDayZPlayer(player)
        return
    end
    spawnPlayer (player, x,y,z+0.5, 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 not elementData then
            if data[1] == "brokenbone" or data[1] == "pain" 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
            else
                elementData = 0
            end
        end
        setElementData(player,data[1],elementData)
    end
    setElementData(player,"logedin",true)
    --Weapons
    --Old Weapons
    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, getElementData(player,"skin"))
 
    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), 73, 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)
    ----------------------------------
    -- Player Items on Start
    for i,data in ipairs(playerDataTable) do
        if data[1] =="Bandage" then
            setElementData(player,data[1],2)
        elseif data[1] =="Watch" then
            setElementData(player,data[1],1)
        elseif data[1] =="Map" then
            setElementData(player,data[1],1)
        elseif data[1] =="Painkiller" then
            setElementData(player,data[1],1)
        elseif data[1] =="MAX_Slots" then
            setElementData(player,data[1],8)
        elseif data[1] =="skin" then
            setElementData(player,data[1],73)
        elseif data[1] =="blood" then
            setElementData(player,data[1],12000)
        elseif data[1] =="temperature" then
            setElementData(player,data[1],37)
        elseif data[1] =="brokenbone" then
            setElementData(player,data[1],false)    
        elseif data[1] =="pain" then
            setElementData(player,data[1],false)
        elseif data[1] =="cold" then
            setElementData(player,data[1],false)
        elseif data[1] =="infection" then
            setElementData(player,data[1],false)
        elseif data[1] =="food" then
            setElementData(player,data[1],100)
        elseif data[1] =="thirst" then
            setElementData(player,data[1],100)
        elseif data[1] =="currentweapon_1" then
            setElementData(player,data[1],false)
        elseif data[1] =="currentweapon_2" then
            setElementData(player,data[1],false)    
        elseif data[1] =="currentweapon_3" then
            setElementData(player,data[1],false)    
        elseif data[1] =="bandit" then
            setElementData(player,data[1],false)    
        elseif data[1] =="humanity" then
            setElementData(player,data[1],2500)        
        else
            setElementData(player,data[1],0)
        end    
    end
    account = getAccount(username)
    local value = getAccounts()
    local value = #value
    setElementData(player,"playerID",value+1)
    setAccountData(account,"playerID",value+1)
    setElementData(player,"logedin",true)
    createZombieTable (player)
end
addEvent("onPlayerDayZRegister", true)
addEventHandler("onPlayerDayZRegister", getRootElement(), playerRegister)
 
function saveAccounts () -- Save in the database
    local account = getPlayerAccount(source)
    if account then
   
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...