--[[
#---------------------------------------------------------------#
---- DayZ MTA Script survivorSystem.lua ----
----* This Script is owned by TioSaam, you are not allowed to use or own it.
----* Owner: TioSaam
----* Skype: colombiano.colombiano3
----* *----
#---------------------------------------------------------------#
]]
local vehicleDataTableForTent = {
{"vaga"},
{"Toxic"},
{"M1911"},
{"ACR"},
{"M9 SD"},
{"Benelli M3"},
{"PDW"},
{"Hunting knife"},
{"Axe"},
{"Grenade"},
{"Desert Deagle"},
{"Sawn-Off Shotgun"},
{"SPAZ-12"},
{"G36K"},
{"Lee Enfield"},
{"PDW"},
{"FN SCAR"},
{"Crossbow"},
{"M136 Rocket"},
{"M4A1 Holo"},
{"ACR"},
--{"M4"},
{"AK-107"},
{"MK48"},
{"G36C SD"},
{"AKS"},
{"AS50"},
{"SVD Camo"},
{"CZ 550"},
{"DMR"},
{"KVSK"},
{"M24"},
{"M249 SAW"},
{"M107"},
{"M4A03"},
{"M14"},
{"JNG-90"},
{"SA-58 ACOG"},
{"M240"},
--{"AKM GP"},
{"Baseball bat"},
{"Shovel"},
{"Golf club"},
{"Watch"},
{"Radio"},
{"Parachute"},
{"Radio"},
{"Satchel"},
{"Infared goggles"},
{"Night vision goggles"},
{"Toolbox"},
{"Tear Gas"},
{"Binoculars"},
{"GPS"},
{"Map"},
{"M1911 Mag"},
{"M9 SD Mag"},
{"Desert Deagle Mag"},
{"ACR Mag"},
{"PDW Mag"},
{"G36K Mag"},
{"FN SCAR Mag"},
--{"M4 Mag"},
{"AK-107 Mag"},
{"AKS Mag"},
{"MK48 Mag"},
{"G36C SD Mag"},
{"AS50 Mag"},
{"SVD Camo Mag"},
{"M4A1 Holo Mag"},
{"ACR Mag"},
{"CZ 550 Mag"},
{"DMR Mag"},
{"KVSK Mag"},
{"M24 Mag"},
{"M249 SAW Mag"},
{"M107 Mag"},
{"M4A03 Mag"},
{"M14 Mag"},
{"JNG-90 Mag"},
{"SA-58 ACOG Mag"},
{"M240 Mag"},
--{"AKM GP Mag"},
{"Lee Enfield Mag"},
{"Benelli M3 Mag"},
{"2Rnd. Slug"},
{"SPAZ-12 Mag"},
{"Wood Pile"},
{"Box of Matches"},
{"Roadflare"},
{"Empty Soda Bottle"},
{"scrap"},
{"Painkiller"},
{"Medic Kit"},
{"Heat Pack"},
{"Blood Bag"},
{"Bandage"},
{"Morphine"},
{"Pizza"},
{"Soda Bottle"},
{"Canteen"},
{"Pasta Can"},
{"Beans Can"},
{"Burger"},
{"Cooked Meat"},
{"Raw meat"},
{"Milk"},
{"Empty Canteen"},
{"Wire Fence"},
{"Tent"},
{"Anti-tank hedgehog"},
{"Sandbags"},
{"Mine"},
{"Empty Gas Canister"},
{"Full Gas Canister"},
{"Tire"},
{"Engine"},
{"Tank Parts"},
{"Survivor Clothing"},
{"Ghillie Suit"},
{"Army Clothing"},
{"Ghilli Suit Woman"},
{"BAT Clothing"},
{"Army[F] Clothing"},
{"Bag"},
{"Drybag Backpack (Black)"},
{"Drybag Backpack (Blue)"},
{"Drybag Backpack (Green)"},
{"Drybag Backpack (Red)"},
{"Drybag Backpack (White)"},
{"Drybag Backpack (Yellow)"},
{"Coyote Backpack"},
{"Coyote Camo Backpack"},
{"Coyote Desert Backpack"},
{"Mountain Backpack (Green)"},
{"Mountain Backpack (Blue)"},
{"Mountain Backpack (Red)"},
{"Alone Backpack"},
}
weaponAmmoTable = {
["M1911 Mag"] = {
{"M1911",22},
},
["M9 SD Mag"] = {
{"M9 SD",23},
},
["Desert Deagle Mag"] = {
{"Desert Deagle",24},
},
["PDW Mag"] = {
{"PDW",28},
},
["AKS Mag"] = {
{"AKS",30},
},
["G36K Mag"] = {
{"G36K",30},
},
["FN SCAR Mag"] = {
{"FN SCAR",30},
},
["Arrow"] = {
{"Crossbow",33},
},
["MK48 Mag"] = {
{"MK48",31},
},
["M4 Mag"] = {
{"M4",31},
},
["AK-107 Mag"] = {
{"AK-107",30},
},
["Benelli M3 Mag"] = {
{"Benelli M3",25},
},
["2Rnd. Slug"] = {
{"Sawn-Off Shotgun",26},
},
["SPAZ-12 Mag"] = {
{"SPAZ-12",27},
},
["AS50 Mag"] = {
{"AS50",34},
},
["ACR Mag"] = {
{"ACR",30},
},
["G36C SD Mag"] = {
{"G36C SD",30},
},
["M4A1 Holo Mag"] = {
{"M4A1 Holo",30},
},
["SA-58V ACOG Mag"] = {
{"SA-58V ACOG",30},
},
["SVD Camo Mag"] = {
{"SVD Camo",34},
},
["CZ 550 Mag"] = {
{"CZ 550",34},
},
["DMR Mag"] = {
{"DMR",34},
},
["KVSK Mag"] = {
{"KVSK",34},
},
["M24 Mag"] = {
{"M24",34},
},
["M249 SAW Mag"] = {
{"M249 SAW",31},
},
["M107 Mag"] = {
{"M107",34},
},
["M4A03 Mag"] = {
{"M4A03",34},
},
["M14 Mag"] = {
{"M14",33},
},
["JNG-90 Mag"] = {
{"JNG-90",33},
},
["M240 Mag"] = {
{"M240",31},
},
["Lee Enfield Mag"] = {
{"Lee Enfield",33},
},
["G17 Mag"] = {
{"G17",23},
},
["MP5A5 Mag"] = {
{"MP5A5",29},
},
["others"] = {
{"Parachute",46},
{"Satchel",39},
{"Tear Gas",17},
{"Grenade",16},
{"Hunting knife",4},
{"Axe",8},
{"Binoculars",43},
{"Baseball bat",5},
{"Shovel",6},
{"Golf club",2},
{"Radio",1},
},
}
function getWeaponAmmoType (weaponName,notOthers)
if not notOthers then
for i,weaponData in ipairs(weaponAmmoTable["others"]) do
if weaponName == weaponData[1] then
return weaponData[1],weaponData[2]
end
end
end
for i,weaponData in ipairs(weaponAmmoTable["M1911 Mag"]) do
if weaponName == weaponData[1] then
return "M1911 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M9 SD Mag"]) do
if weaponName == weaponData[1] then
return "M9 SD Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["Desert Deagle Mag"]) do
if weaponName == weaponData[1] then
return "Desert Deagle Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["PDW Mag"]) do
if weaponName == weaponData[1] then
return "PDW Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["G36K Mag"]) do
if weaponName == weaponData[1] then
return "G36K Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["FN SCAR Mag"]) do
if weaponName == weaponData[1] then
return "FN SCAR Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["Arrow"]) do
if weaponName == weaponData[1] then
return "Arrow",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M4 Mag"]) do
if weaponName == weaponData[1] then
return "M4 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["MK48 Mag"]) do
if weaponName == weaponData[1] then
return "MK48 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["AKS Mag"]) do
if weaponName == weaponData[1] then
return "AKS Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["AK-107 Mag"]) do
if weaponName == weaponData[1] then
return "AK-107 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["Benelli M3 Mag"]) do
if weaponName == weaponData[1] then
return "Benelli M3 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["2Rnd. Slug"]) do
if weaponName == weaponData[1] then
return "2Rnd. Slug",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["SPAZ-12 Mag"]) do
if weaponName == weaponData[1] then
return "SPAZ-12 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["AS50 Mag"]) do
if weaponName == weaponData[1] then
return "AS50 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["ACR Mag"]) do
if weaponName == weaponData[1] then
return "ACR Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["G36C SD Mag"]) do
if weaponName == weaponData[1] then
return "G36C SD Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["G17 Mag"]) do
if weaponName == weaponData[1] then
return "G17 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["MP5A5 Mag"]) do
if weaponName == weaponData[1] then
return "MP5A5 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M4A1 Holo Mag"]) do
if weaponName == weaponData[1] then
return "M4A1 Holo Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["SA-58V ACOG Mag"]) do
if weaponName == weaponData[1] then
return "SA-58V ACOG Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["SVD Camo Mag"]) do
if weaponName == weaponData[1] then
return "SVD Camo Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["CZ 550 Mag"]) do
if weaponName == weaponData[1] then
return "CZ 550 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["DMR Mag"]) do
if weaponName == weaponData[1] then
return "DMR Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["KVSK Mag"]) do
if weaponName == weaponData[1] then
return "KVSK Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M24 Mag"]) do
if weaponName == weaponData[1] then
return "M24 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M249 SAW Mag"]) do
if weaponName == weaponData[1] then
return "M249 SAW Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M107 Mag"]) do
if weaponName == weaponData[1] then
return "M107 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M4A03 Mag"]) do
if weaponName == weaponData[1] then
return "M4A03 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M14 Mag"]) do
if weaponName == weaponData[1] then
return "M14 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["JNG-90 Mag"]) do
if weaponName == weaponData[1] then
return "JNG-90 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["M240 Mag"]) do
if weaponName == weaponData[1] then
return "M240 Mag",weaponData[2]
end
end
for i,weaponData in ipairs(weaponAmmoTable["Lee Enfield Mag"]) do
if weaponName == weaponData[1] then
return "Lee Enfield Mag",weaponData[2]
end
end
return false
end
function rearmPlayerWeapon (weaponName,slot)
takeAllWeapons (source)
local ammoData,weapID = getWeaponAmmoType (weaponName)
if getElementData(source,ammoData) <= 0 then triggerClientEvent (source, "displayClientInfo", source,"Rearm",shownInfos["nomag"],89, 161, 58, 255) return end
setElementData(source,"currentweapon_"..slot,weaponName)
local weapon = getElementData(source,"currentweapon_1")
if weapon then
local ammoData,weapID = getWeaponAmmoType (weapon)
giveWeapon(source,weapID,getElementData(source,ammoData), false )
end
local weapon = getElementData(source,"currentweapon_2")
if weapon then
local ammoData,weapID = getWeaponAmmoType (weapon)
giveWeapon(source,weapID,getElementData(source,ammoData), false )
end
local weapon = getElementData(source,"currentweapon_3")
if weapon then
local ammoData,weapID = getWeaponAmmoType (weapon)
giveWeapon(source,weapID,getElementData(source,ammoData), false )
end
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
if elementWeaponBackM[source] then
detachElementFromBone(elementWeaponBackM[source])
destroyElement(elementWeaponBackM[source])
elementWeaponBackM[source] = false
end
setElementModel(source, getElementData(source,"skin"))
end
addEvent("onPlayerRearmWeapon",true)
addEventHandler("onPlayerRearmWeapon",getRootElement(),rearmPlayerWeapon)
weaponIDtoObjectID = {
{30,355},
{31,356},
{25,349},
{26,350},
{27,351},
{33,357},
{34,358},
{36,360},
{35,359},
{2,333},
{5,336},
{6,337},
}
function getWeaponObjectID (weaponID)
for i,weaponData in ipairs(weaponIDtoObjectID) do
if weaponID == weaponData[1] then
return weaponData[2]
end
end
end
elementBackpack = {}
function backPackBack (dataName,oldValue)
if getElementType(source) == "player" and dataName =="vaga" then
local newValue = getElementData(source,dataName)
if elementBackpack[source] then
detachElementFromBone(elementBackpack[source])
destroyElement(elementBackpack[source])
elementBackpack[source] = false
end
local x,y,z = getElementPosition(source)
local rx,ry,rz = getElementRotation(source)
if newValue == 1 then
elementBackpack[source] = createObject(1248,x,y,z)
elseif newValue == 2 then
elementBackpack[source] = createObject(1575,x,y,z)
elseif newValue == 3 then
elementBackpack[source] = createObject(1830,x,y,z)
elseif newValue == 4 then
elementBackpack[source] = createObject(1831,x,y,z)
elseif newValue == 5 then
elementBackpack[source] = createObject(1832,x,y,z)
elseif newValue == 6 then
elementBackpack[source] = createObject(1252,x,y,z)
elseif newValue == 7 then
elementBackpack[source] = createObject(2410,x,y,z)
elseif newValue == 8 then
elementBackpack[source] = createObject(2000,x,y,z)
elseif newValue == 9 then
elementBackpack[source] = createObject(2405,x,y,z)
elseif newValue == 10 then
elementBackpack[source] = createObject(2406,x,y,z)
elseif newValue == 11 then
elementBackpack[source] = createObject(1833,x,y,z)
elseif newValue == 12 then
elementBackpack[source] = createObject(1834,x,y,z)
elseif newValue == 13 then
elementBackpack[source] = createObject(1835,x,y,z)
elseif newValue == 14 then
elementBackpack[source] = createObject(1836,x,y,z)
elseif newValue == 15 then
elementBackpack[source] = createObject(1837,x,y,z)
elseif newValue == 16 then
elementBackpack[source] = createObject(1838,x,y,z)
elseif newValue == 17 then
elementBackpack[source] = createObject(3918,x,y,z)
elseif newValue == 18 then
elementBackpack[source] = createObject(1934,x,y,z)
elseif newValue == 19 then
elementBackpack[source] = createObject(1935,x,y,z)
elseif newValue == 20 then
elementBackpack[source] = createObject(1661,x,y,z)
elseif newValue == 21 then
elementBackpack[source] = createObject(1937,x,y,z)
elseif newValue == 22 then
elementBackpack[source] = createObject(1938,x,y,z)
elseif newValue == 23 then
elementBackpack[source] = createObject(1939,x,y,z)
elseif newValue == 24 then
elementBackpack[source] = createObject(1940,x,y,z)
elseif newValue == 25 then
elementBackpack[source] = createObject(1942,x,y,z)
elseif newValue == 26 then
elementBackpack[source] = createObject(1751,x,y,z)
elseif newValue == 27 then
elementBackpack[source] = createObject(1781,x,y,z)
elseif newValue == 28 then
elementBackpack[source] = createObject(1782,x,y,z)
elseif newValue == 29 then
elementBackpack[source] = createObject(1783,x,y,z)
elseif newValue == 30 then
elementBackpack[source] = createObject(1785,x,y,z)
elseif newValue == 31 then
elementBackpack[source] = createObject(1786,x,y,z)
elseif newValue == 32 then
elementBackpack[source] = createObject(1787,x,y,z)
elseif newValue == 33 then
elementBackpack[source] = createObject(1788,x,y,z)
elseif newValue == 34 then
elementBackpack[source] = createObject(1790,x,y,z)
elseif newValue == 35 then
elementBackpack[source] = createObject(1791,x,y,z)
elseif newValue == 36 then
elementBackpack[source] = createObject(1792,x,y,z)
elseif newValue == 8 then
return
end
if newValue == 1 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 2 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 3 then
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,90,0,0)
elseif newValue == 4 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 5 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 6 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 7 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 8 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 9 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 10 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 11 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 12 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 13 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 14 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 15 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 16 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 17 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 18 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 19 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 20 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 21 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 22 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 23 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 24 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 25 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 26 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 27 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 28 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 29 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 30 then
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,270,0,180)
elseif newValue == 31 then
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,270,0,180)
elseif newValue == 32 then
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,270,0,180)
elseif newValue == 33 then
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,270,0,180)
elseif newValue == 34 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 35 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
elseif newValue == 36 then
attachElementToBone(elementBackpack[source],source,3,0,-0.225,0.05,90,0,0)
else
attachElementToBone(elementBackpack[source],source,3,0,-0.21,0.05,270,0,180)
end
end
if getElementType(source) == "player" and dataName == "ColeteOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local colete = createObject(1516, x, y, z)
setElementData ( source, "coleteObject", colete )
local skin = getElementModel ( source )
if skin == 0 then
-- Parte,Largura,Frente Traz,Altura,Z,ROTX,ROTY,ROT--
attachElementToBone(colete, source, 3, 0, -0.00, -0.550, -1, 0, 90)
elseif skin == 287 then
attachElementToBone(colete, source, 3, 0, -0.01, -0.500, -1, 0, 90)
end
else
if isElement ( getElementData ( source, "coleteObject" ) ) then
detachElementFromBone( getElementData ( source, "coleteObject" ) )
destroyElement ( getElementData ( source, "coleteObject" ) )
setElementData ( source, "coleteObject", false )
end
end
end
if getElementType(source) == "player" and dataName == "Colete3On" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Colete3 = createObject(1313, x, y, z)
setElementData ( source, "Colete3Object", Colete3 )
local skin = getElementModel ( source )
if skin == 0 then
-- Parte,Largura,Frente Traz,Altura,Z,ROTX,ROTY,ROT--
attachElementToBone(Colete3, source, 3, 0, 0.030, -0.50, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Colete3, source, 3, 0, 0.030, -0.50, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "Colete3Object" ) ) then
detachElementFromBone( getElementData ( source, "Colete3Object" ) )
destroyElement ( getElementData ( source, "Colete3Object" ) )
setElementData ( source, "Colete3Object", false )
end
end
end
if getElementType(source) == "player" and dataName == "Colete4On" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Colete4 = createObject(2033, x, y, z)
setElementData ( source, "Colete4Object", Colete4 )
local skin = getElementModel ( source )
if skin == 0 then
-- Parte,Largura,Frente Traz,Altura,Z,ROTX,ROTY,ROT--
attachElementToBone(Colete4, source, 3, 0, 0.020, -0.50, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Colete4, source, 3, 0, 0.020, -0.50, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "Colete4Object" ) ) then
detachElementFromBone( getElementData ( source, "Colete4Object" ) )
destroyElement ( getElementData ( source, "Colete4Object" ) )
setElementData ( source, "Colete4Object", false )
end
end
end
if getElementType(source) == "player" and dataName == "Colete2On" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Colete2 = createObject(1643, x, y, z)
setElementData ( source, "Colete2Object", Colete2 )
local skin = getElementModel ( source )
if skin == 0 then
-- Parte,Largura,Frente Traz,Altura,Z,ROTX,ROTY,ROT--
attachElementToBone(Colete2, source, 3, 0, 0.035, -0.50, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Colete2, source, 3, 0, 0.035, -0.50, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "Colete2Object" ) ) then
detachElementFromBone( getElementData ( source, "Colete2Object" ) )
destroyElement ( getElementData ( source, "Colete2Object" ) )
setElementData ( source, "Colete2Object", false )
end
end
end
if getElementType(source) == "player" and dataName == "HelmetOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Helmet = createObject(902, x, y, z)
setElementData ( source, "HelmetObject", Helmet )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Helmet, source, 1, 0.00, 0.06, -0.570, -1, 0, 90)
elseif skin == 287 then
attachElementToBone(Helmet, source, 1, 0.02, 0.06, -0.520, -1, 0, 90)
end
else
if isElement ( getElementData ( source, "HelmetObject" ) ) then
detachElementFromBone( getElementData ( source, "HelmetObject" ) )
destroyElement ( getElementData ( source, "HelmetObject" ) )
setElementData ( source, "HelmetObject", false )
end
end
end
if getElementType(source) == "player" and dataName == "CapaceteOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Capacete = createObject(1852, x, y, z)
setElementData ( source, "CapaceteObject", Capacete )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Capacete, source, 1, 0, -0.040, -0.690, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Capacete, source, 1, 0, -0.040, -0.630, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "CapaceteObject" ) ) then
detachElementFromBone( getElementData ( source, "CapaceteObject" ) )
destroyElement ( getElementData ( source, "CapaceteObject" ) )
setElementData ( source, "CapaceteObject", false )
end
end
end
if getElementType(source) == "player" and dataName == "Mascara1On" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Mascara1 = createObject(2043, x, y, z)
setElementData ( source, "Mascara1Object", Mascara1 )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Mascara1, source, 1, 0, 0.014, -0.550, 0, 1, 90)
elseif skin == 287 then
attachElementToBone(Mascara1, source, 1, 0, 0.014, -0.550, 0, 1, 90)
end
else
if isElement ( getElementData ( source, "Mascara1Object" ) ) then
detachElementFromBone( getElementData ( source, "Mascara1Object" ) )
destroyElement ( getElementData ( source, "Mascara1Object" ) )
setElementData ( source, "Mascara1Object", false )
end
end
end
if getElementType(source) == "player" and dataName == "Mascara2On" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Mascara2 = createObject(1851, x, y, z)
setElementData ( source, "Mascara2Object", Mascara2 )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Mascara2, source, 1, 0, -0.016, -0.597, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Mascara2, source, 1, 0, 0, -0.597, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "Mascara2Object" ) ) then
detachElementFromBone( getElementData ( source, "Mascara2Object" ) )
destroyElement ( getElementData ( source, "Mascara2Object" ) )
setElementData ( source, "Mascara2Object", false )
end
end
end
if getElementType(source) == "player" and dataName == "MusgoOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Musgo = createObject(1518, x, y, z)
setElementData ( source, "MusgoObject", Musgo )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Musgo, source, 1, 0.01, 0.01, -0.580, -1, 0, 90)
elseif skin == 287 then
attachElementToBone(Musgo, source, 1, 0.01, 0.01, -0.580, -1, 0, 90)
end
else
if isElement ( getElementData ( source, "MusgoObject" ) ) then
detachElementFromBone( getElementData ( source, "MusgoObject" ) )
destroyElement ( getElementData ( source, "MusgoObject" ) )
setElementData ( source, "MusgoObject", false )
end
end
end
if getElementType(source) == "player" and dataName == "RespiradorOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Respirador = createObject(1521, x, y, z)
setElementData ( source, "RespiradorObject", Respirador )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Respirador, source, 1, 0, -0.015, -0.589, 0, 0, 90)
elseif skin == 287 then
attachElementToBone(Respirador, source, 1, 0, -0.015, -0.589, 0, 0, 90)
end
else
if isElement ( getElementData ( source, "RespiradorObject" ) ) then
detachElementFromBone( getElementData ( source, "RespiradorObject" ) )
destroyElement ( getElementData ( source, "RespiradorObject" ) )
setElementData ( source, "RespiradorObject", false )
end
end
end
if getElementType(source) == "player" and dataName == "MonkeyOn" then
if getElementData ( source, dataName ) then
local x, y, z = getElementPosition(source)
local Monkey = createObject(1517, x, y, z)
setElementData ( source, "MonkeyObject", Monkey )
local skin = getElementModel ( source )
if skin == 0 then
attachElementToBone(Monkey, source, 1, 0, -0.01, -0.600, -1, 0, 90)
elseif skin == 287 then
attachElementToBone(Monkey, source, 1, 0, -0.01, -0.600, -1, 0, 90)
end
else
if isElement ( getElementData ( source, "MonkeyObject" ) ) then
detachElementFromBone( getElementData ( source, "MonkeyObject" ) )
destroyElement ( getElementData ( source, "MonkeyObject" ) )
setElementData ( source, "MonkeyObject", false )
end
end
end
end
addEventHandler ( "onElementDataChange", getRootElement(), backPackBack )
function backpackRemoveQuit ()
if elementWeaponRaplace[source] then
detachElementFromBone(elementWeaponRaplace[source])
destroyElement(elementWeaponRaplace[source])
elementWeaponRaplace[source] = false
end
if elementBackpack[source] then
detachElementFromBone(elementBackpack[source])
destroyElement(elementBackpack[source])
end
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
if getElementData ( source, "coleteObject" ) then
local colete = getElementData ( source, "coleteObject" )
if isElement ( colete ) then
destroyElement ( colete )
end
end
if getElementData ( source, "Colete2Object" ) then
local Colete2 = getElementData ( source, "Colete2Object" )
if isElement ( Colete2 ) then
destroyElement ( Colete2 )
end
end
if getElementData ( source, "Colete3Object" ) then
local Colete3 = getElementData ( source, "Colete3Object" )
if isElement ( Colete3 ) then
destroyElement ( Colete3 )
end
end
if getElementData ( source, "Colete4Object" ) then
local Colete4 = getElementData ( source, "Colete4Object" )
if isElement ( Colete4 ) then
destroyElement ( Colete4 )
end
end
if getElementData ( source, "HelmetObject" ) then
local Helmet = getElementData ( source, "HelmetObject" )
if isElement ( Helmet ) then
destroyElement ( Helmet )
end
end
if getElementData ( source, "MusgoObject" ) then
local Musgo = getElementData ( source, "MusgoObject" )
if isElement ( Musgo ) then
destroyElement ( Musgo )
end
end
if getElementData ( source, "CapaceteObject" ) then
local Capacete = getElementData ( source, "CapaceteObject" )
if isElement ( Capacete ) then
destroyElement ( Capacete )
end
end
if getElementData ( source, "Mascara1Object" ) then
local Mascara1 = getElementData ( source, "Mascara1Object" )
if isElement ( Mascara1 ) then
destroyElement ( Mascara1 )
end
end
if getElementData ( source, "Mascara2Object" ) then
local Mascara2 = getElementData ( source, "Mascara2Object" )
if isElement ( Mascara2 ) then
destroyElement ( Mascara2 )
end
end
if getElementData ( source, "RespiradorObject" ) then
local Respirador = getElementData ( source, "RespiradorObject" )
if isElement ( Respirador ) then
destroyElement ( Respirador )
end
end
if getElementData ( source, "MonkeyObject" ) then
local Monkey = getElementData ( source, "MonkeyObject" )
if isElement ( Monkey ) then
destroyElement ( Monkey )
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), backpackRemoveQuit )
elementWeaponRaplace = {}
function weaponReplace ( previousWeaponID, currentWeaponID )
local weapon1 = getElementData(source,"currentweapon_1")
if not weapon1 then return end
local ammoData1,weapID1 = getWeaponAmmoType(weapon1)
local x,y,z = getElementPosition(source)
local rx,ry,rz = getElementRotation(source)
if currentWeaponID == weapID1 then
if elementWeaponRaplace[source] then
detachElementFromBone(elementWeaponRaplace[source])
destroyElement(elementWeaponRaplace[source])
elementWeaponRaplace[source] = false
end
if weapon1 == "M14" then
elementWeaponRaplace[source] = createObject(2726,x,y,z)
elseif weapon1 == "SVD Camo" then
elementWeaponRaplace[source] = createObject(2730,x,y,z)
elseif weapon1 == "AS50" then
elementWeaponRaplace[source] = createObject(2731,x,y,z)
elseif weapon1 == "CZ 550" then
elementWeaponRaplace[source] = createObject(2732,x,y,z)
elseif weapon1 == "DMR" then
elementWeaponRaplace[source] = createObject(2733,x,y,z)
elseif weapon1 == "KVSK" then
elementWeaponRaplace[source] = createObject(2734,x,y,z)
elseif weapon1 == "M24" then
elementWeaponRaplace[source] = createObject(2735,x,y,z)
elseif weapon1 == "M249 SAW" then
elementWeaponRaplace[source] = createObject(2748,x,y,z)
elseif weapon1 == "M107" then
elementWeaponRaplace[source] = createObject(2737,x,y,z)
elseif weapon1 == "M4A03" then
elementWeaponRaplace[source] = createObject(2738,x,y,z)
elseif weapon1 == "JNG-90" then
elementWeaponRaplace[source] = createObject(2729,x,y,z)
elseif weapon1 == "M240" then
elementWeaponRaplace[source] = createObject(2728,x,y,z)
elseif weapon1 == "AK-107" then
elementWeaponRaplace[source] = createObject(2725,x,y,z)
elseif weapon1 == "AKS" then
elementWeaponRaplace[source] = createObject(3000,x,y,z)
elseif weapon1 == "G36K" then
elementWeaponRaplace[source] = createObject(2708,x,y,z)
elseif weapon1 == "M4" then
elementWeaponRaplace[source] = createObject(2468,x,y,z)
elseif weapon1 == "Lee Enfield" then
elementWeaponRaplace[source] = createObject(2562,x,y,z)
elseif weapon1 == "FN SCAR" then
elementWeaponRaplace[source] = createObject(2644,x,y,z)
elseif weapon1 == "MK48" then
elementWeaponRaplace[source] = createObject(2571,x,y,z)
elseif weapon1 == "Crossbow" then
elementWeaponRaplace[source] = createObject(2565,x,y,z)
elseif weapon1 == "ACR" then
elementWeaponRaplace[source] = createObject(2747,x,y,z)
elseif weapon1 == "G36C SD" then
elementWeaponRaplace[source] = createObject(2751,x,y,z)
elseif weapon1 == "G17" then
elementWeaponRaplace[source] = createObject(2749,x,y,z)
elseif weapon1 == "M4A1 Holo" then
elementWeaponRaplace[source] = createObject(2742,x,y,z)
elseif weapon1 == "SA-58V ACOG" then
elementWeaponRaplace[source] = createObject(2745,x,y,z)
elseif weapon1 == "M9 SD" then
elementWeaponRaplace[source] = createObject(2766,x,y,z)
elseif weapon1 == "M1911" then
elementWeaponRaplace[source] = createObject(2767,x,y,z)
end
if elementBackpack[source] then
attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,179,90,180)
else
attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,179,90,180)
end
elseif previousWeaponID == weapID1 then
detachElementFromBone(elementWeaponRaplace[source])
destroyElement(elementWeaponRaplace[source])
elementWeaponRaplace[source] = false
end
end
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace )
elementWeaponBack = {}
elementWeaponBackM = {}
function weaponSwitchBack ( previousWeaponID, currentWeaponID )
local weapon1 = getElementData(source,"currentweapon_1")
local weapon2 = getElementData(source,"currentweapon_2")
if not weapon1 and not weapon2 then return end
local ammoData1,weapID1 = getWeaponAmmoType(weapon1)
local ammoData2,weapID2 = getWeaponAmmoType(weapon2)
local x,y,z = getElementPosition(source)
local rx,ry,rz = getElementRotation(source)
if currentWeaponID == weapID2 then
setElementData ( source, "selectedWeapon",weapon2)
elseif currentWeaponID == weapID1 then
setElementData ( source, "selectedWeapon",weapon1)
elseif currentWeaponID == weapID3 then
setElementData ( source, "selectedWeapon",weapon3)
end
if getElementData ( source, "usingGrenadeThrower" ) then
toggleControl ( source, 'fire', true )
setElementData ( source, "usingGrenadeThrower", false )
end
if previousWeaponID == weapID1 then
----------- Destruir Arma Quando Morrer ou Deslogar Sen�o Ela Fica no Ar -------------
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
if weapon1 == "M14" then
elementWeaponBack[source] = createObject(2726,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "SVD Camo" then
elementWeaponBack[source] = createObject(2730,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "AS50" then
elementWeaponBack[source] = createObject(2731,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "CZ 550" then
elementWeaponBack[source] = createObject(2732,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "DMR" then
elementWeaponBack[source] = createObject(2733,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "KVSK" then
elementWeaponBack[source] = createObject(2734,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M24" then
elementWeaponBack[source] = createObject(2735,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M249 SAW" then
elementWeaponBack[source] = createObject(2748,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M107" then
elementWeaponBack[source] = createObject(2737,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M4A03" then
elementWeaponBack[source] = createObject(2738,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "JNG-90" then
elementWeaponBack[source] = createObject(2729,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M240" then
elementWeaponBack[source] = createObject(2728,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "AK-107" then
elementWeaponBack[source] = createObject(2725,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "AKS" then
elementWeaponBack[source] = createObject(3000,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "MK48" then
elementWeaponBack[source] = createObject(2571,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M4" then
elementWeaponBack[source] = createObject(2468,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "Lee Enfield" then
elementWeaponBack[source] = createObject(2562,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "G36K" then
elementWeaponBack[source] = createObject(2708,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "FN SCAR" then
elementWeaponBack[source] = createObject(2644,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "Crossbow" then
elementWeaponBack[source] = createObject(2565,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "ACR" then
elementWeaponBack[source] = createObject(2747,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "G36C SD" then
elementWeaponBack[source] = createObject(2751,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "G17" then
elementWeaponBack[source] = createObject(2749,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M4A1 Holo" then
elementWeaponBack[source] = createObject(2742,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "SA-58V ACOG" then
elementWeaponBack[source] = createObject(2745,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M9 SD" then
elementWeaponBack[source] = createObject(2766,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
elseif weapon1 == "M1911" then
elementWeaponBack[source] = createObject(2767,x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
else
elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z)
setObjectScale(elementWeaponBack[source],0.875)
end
if elementBackpack[source] then
attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.31,-0.1,0,270,-90)
else
attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.11,-0.1,0,270,10)
end
elseif currentWeaponID == weapID1 then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
end
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchBack )
function removeBackWeaponOnDrop ()
if elementWeaponRaplace[source] then
detachElementFromBone(elementWeaponRaplace[source])
destroyElement(elementWeaponRaplace[source])
elementWeaponRaplace[source] = false
end
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
if elementWeaponBackM[source] then
detachElementFromBone(elementWeaponBackM[source])
destroyElement(elementWeaponBackM[source])
elementWeaponBackM[source] = false
end
end
addEvent("removeBackWeaponOnDrop",true)
addEventHandler("removeBackWeaponOnDrop",getRootElement(),removeBackWeaponOnDrop)
function removeAttachedOnDeath ()
if elementWeaponRaplace[source] then
detachElementFromBone(elementWeaponRaplace[source])
destroyElement(elementWeaponRaplace[source])
elementWeaponRaplace[source] = false
end
if elementBackpack[source] then
detachElementFromBone(elementBackpack[source])
destroyElement(elementBackpack[source])
end
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
if elementWeaponBackM[source] then
detachElementFromBone(elementWeaponBackM[source])
destroyElement(elementWeaponBackM[source])
elementWeaponBackM[source] = false
end
if getElementData ( source, "ColeteOn" ) == true then
setElementData ( source, "ColeteOn", false )
end
if getElementData ( source, "Colete2On" ) == true then
setElementData ( source, "Colete2On", false )
end
if getElementData ( source, "Colete3On" ) == true then
setElementData ( source, "Colete3On", false )
end
if getElementData ( source, "Colete4On" ) == true then
setElementData ( source, "Colete4On", false )
end
if getElementData ( source, "HelmetOn" ) == true then
setElementData ( source, "HelmetOn", false )
end
if getElementData ( source, "MusgoOn" ) == true then
setElementData ( source, "MusgoOn", false )
end
if getElementData ( source, "CapaceteOn" ) == true then
setElementData ( source, "CapaceteOn", false )
end
if getElementData ( source, "Mascara1On" ) == true then
setElementData ( source, "Mascara1On", false )
end
if getElementData ( source, "Mascara2On" ) == true then
setElementData ( source, "Mascara2On", false )
end
if getElementData ( source, "RespiradorOn" ) == true then
setElementData ( source, "RespiradorOn", false )
end
if getElementData ( source, "MonkeyOn" ) == true then
setElementData ( source, "MonkeyOn", false )
end
end
addEvent("kilLDayZPlayer",true)
addEventHandler("kilLDayZPlayer",getRootElement(),removeAttachedOnDeath)
function weaponDelete(dataName,oldValue)
if getElementType(source) == "player" then -- check if the element is a player
local weapon1 = getElementData(source,"currentweapon_1") or "noweap"
local weapon2 = getElementData(source,"currentweapon_2") or "noweap"
local weapon3 = getElementData(source,"currentweapon_3") or "noweap"
if dataName == weapon1 or dataName == weapon2 or dataName == weapon3 then
if getElementData (source,dataName) == 0 then
local ammoData,weapID = getWeaponAmmoType(dataName)
takeWeapon (source,weapID)
if dataName == weapon1 or dataName == weapon2 or dataName == weapon3 then
if getElementData (source,dataName) == 0 then
local ammoData,weapID = getWeaponAmmoType(dataName)
takeWeapon (source,weapID)
if dataName == weapon1 then
setElementData(source,"currentweapon_1",false)
elseif dataName == weapon2 then
setElementData(source,"currentweapon_2",false)
elseif dataName == weapon3 then
setElementData(source,"currentweapon_3",false)
end
return true
end
end
end
end
local weapon1 = getElementData(source,"currentweapon_1")
local weapon2 = getElementData(source,"currentweapon_2")
local weapon3 = getElementData(source,"currentweapon_3")
local ammoData1,weapID1 = getWeaponAmmoType(weapon1)
local ammoData2,weapID2 = getWeaponAmmoType(weapon2)
local ammoData3,weapID3 = getWeaponAmmoType(weapon3)
if dataName == ammoData1 then
local newammo = oldValue - getElementData (source,dataName)
if newammo == 1 then return end
if getElementData (source,dataName) < oldValue then
takeWeapon (source,weapID1,newammo)
if elementWeaponBack[source] then
detachElementFromBone(elementWeaponBack[source])
destroyElement(elementWeaponBack[source])
elementWeaponBack[source] = false
end
elseif getElementData (source,dataName) > oldValue then
giveWeapon(source,weapID1,getElementData (source,dataName)-oldValue,true)
end
end
if dataName == ammoData2 then
local newammo = oldValue - getElementData (source,dataName)
if newammo == 1 then return end
if getElementData (source,dataName) < oldValue then
takeWeapon (source,weapID2,newammo)
elseif getElementData (source,dataName) > oldValue then
giveWeapon(source,weapID2,getElementData (source,dataName)-oldValue,false)
end
end
if dataName == ammoData3 then
local newammo = oldValue - getElementData (source,dataName)
if newammo == 1 then return end
if getElementData (source,dataName) < oldValue then
takeWeapon (source,weapID3,newammo)
elseif getElementData (source,dataName) > oldValue then
giveWeapon(source,weapID3,getElementData (source,dataName)-oldValue,false)
end
end
end
end
addEventHandler("onElementDataChange",getRootElement(),weaponDelete)
function addPlayerStats (player,data,value)
if data == "food" then
local current = getElementData(player,data)
if current + value > 100 then
setElementData(player,data,100)
elseif current + value < 1 then
setElementData(player,data,0)
setElementData(player,"blood",getElementData(player,"blood")-math.random(50,120))
else
setElementData(player,data,current+value)
end
elseif data == "thirst" then
local current = getElementData(player,data)
if current + value > 100 then
setElementData(player,data,100)
elseif current + value < 1 then
setElementData(player,data,0)
setElementData(player,"blood",getElementData(player,"blood")-math.random(50,120))
else
setElementData(player,data,current+value)
end
elseif data == "blood" then
local current = getElementData(player,data)
if current + value > 12000 then
setElementData(player,data,12000)
elseif current + value < 1 then
setElementData(player,data,0)
else
setElementData(player,data,current+value)
end
elseif data == "temperature" then
local current = getElementData(player,data)
if current + value > 41 then
setElementData(player,data,41)
elseif current + value <= 31 then
setElementData(player,data,31)
else
setElementData(player,data,current+value)
end
elseif data == "humanity" then
local current = getElementData(player,data)
if current + value > 5000 then
setElementData(player,data,5000)
else
setElementData(player,data,current+value)
end
end
end
function checkTemperature()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
value = 0
if getWeather == 7 then
value = -0.1
elseif getWeather == 12 then
value = 0
elseif getWeather == 16 then
value = -0.4
elseif getWeather == 4 then
value = -0.1
end
local hour, minutes = getTime()
if hour >= 21 and hour <= 8 then
value = value-0.05
end
addPlayerStats (player,"temperature",value)
end
end
end
setTimer(checkTemperature,60000,0)
function checkTemperature2()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
value = 0
if isElementInWater(player) then
value = gameplayVariables["temperaturewater"]
end
if getControlState (player,"sprint") then
value = value+gameplayVariables["temperaturesprint"]
end
addPlayerStats (player,"temperature",value)
end
end
end
setTimer(checkTemperature2,10000,0)
function setHunger()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
value = gameplayVariables["loseHunger"]
addPlayerStats (player,"food",value)
end
end
end
setTimer(setHunger,60000,0)
function setThirsty()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
value = gameplayVariables["loseThirst"]
addPlayerStats (player,"thirst",value)
end
end
end
setTimer(setThirsty,60000,0)
function checkThirsty()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
value = 0
if getControlState (player,"sprint") then
value = gameplayVariables["sprintthirst"]
end
addPlayerStats (player,"thirst",value)
end
end
end
setTimer(checkThirsty,10000,0)
function checkHumanity()
for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
if getElementData(player,"humanity") < 2500 then
addPlayerStats (player,"humanity",30)
if getElementData(player,"humanity") > 2000 then
setElementData(player,"bandit",false)
end
end
end
end
end
setTimer(checkHumanity,60000,0)
function onPlayerRequestChangingStats(itemName,itemInfo,data)
if data == "food" then
if itemName == "Burger" then
blood = 300
elseif itemName == "Pizza" then
blood = 300
elseif itemName == "Cooked Meat" then
blood = 800
elseif itemName == "Beans Can" then
blood = 200
elseif itemName == "Pasta Can" then
blood = 200
end
setPedAnimation (source,"FOOD","EAT_Burger",-1,false,false,nil,false)
setElementData(source,itemName,getElementData(source,itemName)-1)
addPlayerStats (source,"blood",blood)
addPlayerStats (source,data,gameplayVariables["foodrestore"]) -- Restores a random amount between 40-100 (hunger) - default: 100
elseif data == "thirst" then
setElementData(source,itemName,getElementData(source,itemName)-1)
addPlayerStats (source,data,gameplayVariables["thirstrestore"]) -- Restores a random amount between 40-100 (thirst) default: 100
setPedAnimation (source,"VENDING","VEND_Drink2_P",-1,false,false,nil,false)
if itemName == "Water Bottle" then
setElementData(source,"Empty Water Bottle",(getElementData(source,"Empty Water Bottle") or 0)+1)
end
end
triggerClientEvent (source, "displayClientInfo", source,"Food",shownInfos["youconsumed"].." "..itemName,22,255,0)
triggerClientEvent(source,"refreshInventoryManual",source)
end
addEvent("onPlayerRequestChangingStats",true)
addEventHandler("onPlayerRequestChangingStats",getRootElement(),onPlayerRequestChangingStats)
function onPlayerUseMedicObject(itemName)
local playersource = source
setPedAnimation (playersource,"BOMBER","BOM_Plant",-1,false,false,nil,false)
setTimer( function ()
if itemName == "Bandage" then
setElementData(playersource,"bleeding",0)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Medic Kit" then
addPlayerStats (playersource,"blood",7000)
setElementData(playersource,"bleeding",0)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Heat Pack" then
setElementData(playersource,"cold",false)
setElementData(playersource,"temperature",37)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Painkiller" then
setElementData(playersource,"pain",false)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Morphine" then
setElementData(playersource,"brokenbone",false)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Blood Bag" then
addPlayerStats (playersource,"blood",12000)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
end
end,1500,1)
triggerClientEvent(playersource,"refreshInventoryManual",playersource)
end
addEvent("onPlayerUseMedicObject",true)
addEventHandler("onPlayerUseMedicObject",getRootElement(),onPlayerUseMedicObject)
function onPlayerGiveMedicObject(itemName,player)
local playersource = source
setPedAnimation (playersource,"BOMBER","BOM_Plant", -1, false, false, false, false)
setTimer( function ()
if itemName == "bandage" then
setElementData(player,"bleeding",0)
setElementData(playersource,"Bandage",getElementData(playersource,"Bandage")-1)
addPlayerStats (playersource,humanity,40)
elseif itemName == "giveblood" then
addPlayerStats (player,"blood",12000)
setElementData(playersource,"Blood Bag",getElementData(playersource,"Blood Bag")-1)
addPlayerStats (playersource,humanity,250)
end
end,1500,1)
end
addEvent("onPlayerGiveMedicObject",true)
addEventHandler("onPlayerGiveMedicObject",getRootElement(),onPlayerGiveMedicObject)
skinTable = {
{"Survivor Clothing",73},
{"Ghillie Suit",287},
{"Army Clothing",285},
{"Ghilli Suit Woman",257},
{"BAT Clothing",164},
{"Army[F] Clothing",90},
{"BF3 Clothing",295},
{"Millitary Clothing",284},
{"Soldier Clothing",283},
}
function getSkinIDFromName(name)
for i,skin in ipairs(skinTable) do
if name == skin[1] then
return skin[2]
end
end
end
function getSkinNameFromID(id)
for i,skin in ipairs(skinTable) do
if id == skin[2] then
return skin[1]
end
end
end
function addPlayerSkin (skin)
local current = getElementData(source,"skin")
local name = getSkinNameFromID(current)
setElementData(source,name,getElementData(source,name)+1)
setElementData(source,skin,getElementData(source,skin)-1)
local id = getSkinIDFromName(skin)
setElementData(source,"skin",id)
setElementModel(source,id)
triggerClientEvent(source,"refreshInventoryManual",source)
triggerClientEvent("updatePlayerClothes",source,id)
end
addEvent("onPlayerChangeSkin",true)
addEventHandler("onPlayerChangeSkin",getRootElement(),addPlayerSkin)
function onPlayerRefillWaterBottle (itemName)
if isElementInWater(source) then
setElementData(source,"Canteen",getElementData(source,"Canteen")+1)
setElementData(source,itemName,getElementData(source,itemName)-1)
triggerClientEvent(source,"refreshInventoryManual",source)
triggerClientEvent (source, "displayClientInfo", source,"Canteen",shownInfos["filledup"],89, 161, 58, 255)
else
triggerClientEvent (source, "displayClientInfo", source,"Canteen",shownInfos["needwatersource"],89, 161, 58, 255)
end
end
addEvent("onPlayerRefillWaterBottle",true)
addEventHandler("onPlayerRefillWaterBottle",getRootElement(),onPlayerRefillWaterBottle)
function getPointFromDistanceRotation(x, y, dist, angle)
local a = math.rad(90 - angle);
local dx = math.cos(a) * dist;
local dy = math.sin(a) * dist;
return x+dx, y+dy;
end
function onPlayerPitchATent (itemName)
setElementData(source,itemName,getElementData(source,itemName)-1)
setPedAnimation (source,"BOMBER","BOM_Plant",-1,false,false,nil,false)
local source = source
setTimer( function ()
local x,y,z = getElementPosition(source)
local xr,yr,zr = getElementRotation(source)
px, py, pz = getElementPosition(source)
prot = getPedRotation(source)
local offsetRot = math.rad(prot+90)
local vx = px + 5 * math.cos(offsetRot)
local vy = py + 5 * math.sin(offsetRot)
local vz = pz + 2
local vrot = prot+180
tent = createObject(3243,vx,vy,z-1,0,0,vrot)
setObjectScale(tent,1.3)
tentCol = createColSphere(x,y,z,4)
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)
triggerClientEvent(source,"refreshInventoryManual",source)
end,1500,1)
end
addEvent("onPlayerPitchATent",true)
addEventHandler("onPlayerPitchATent",getRootElement(),onPlayerPitchATent)
function removeTent (object)
local x,y,z = getElementPosition(getElementData(object,"parent"))
local item,itemString = getItemTablePosition("Tent")
local itemPickup = createItemPickup(item,x,y,z+1,itemString)
destroyElement(getElementData(object,"parent"))
destroyElement(object)
end
addEvent("removeTent",true)
addEventHandler("removeTent",getRootElement(),removeTent)
function onPlayerBuildAWireFence (itemName)
setElementData(source,itemName,getElementData(source,itemName)-1)
setPedAnimation (source,"BOMBER","BOM_Plant",-1,false,false,nil,false)
local source = source
setTimer( function ()
local x,y,z = getElementPosition(source)
local xr,yr,zr = getElementRotation(source)
--outputChatBox(zr)
px, py, pz = getElementPosition(source)
prot = getPedRotation(source)
local offsetRot = math.rad(prot+90)
local vx = px + 1 * math.cos(offsetRot)
local vy = py + 1 * math.sin(offsetRot)
local vz = pz + 2
local vrot = prot+90
--local x,y = getPointFromDistanceRotation(x,y,5,0)
tent = createObject(983,vx,vy,pz,xr,yr,vrot)
setObjectScale(tent,1)
tentCol = createColSphere(x,y,z,2)
attachElements ( tentCol, tent, 0, 0, 0 )
setElementData(tentCol,"parent",tent)
setElementData(tent,"parent",tentCol)
setElementData(tentCol,"wirefence",true)
triggerClientEvent(source,"refreshInventoryManual",source)
end,1500,1)
end
addEvent("onPlayerBuildAWireFence",true)
addEventHandler("onPlayerBuildAWireFence",getRootElement(),onPlayerBuildAWireFence)
function removeWirefence (object)
destroyElement(getElementData(object,"parent"))
destroyElement(object)
end
addEvent("removeWirefence",true)
addEventHandler("removeWirefence",getRootElement(),removeWirefence)
--[[function onPlayerBuildATank (itemName)
setElementData(source,itemName,getElementData(source,itemName)-1)
setPedAnimation (source,"BOMBER","BOM_Plant", -1, false, false, false, false)
local source = source
setTimer( function ()
local x,y,z = getElementPosition(source)
local xr,yr,zr = getElementRotation(source)
--outputChatBox(zr)
px, py, pz = getElementPosition(source)
prot = getPedRotation(source)
local offsetRot = math.rad(prot+90)
local vx = px + 1 * math.cos(offsetRot)
local vy = py + 1 * math.sin(offsetRot)
local vz = pz + 2
local vrot = prot+90
--local x,y = getPointFromDistanceRotation(x,y,5,0)
tent = createObject(2409,vx,vy,z-1,xr,yr,vrot)
setObjectScale(tent,2)
tentCol = createColSphere(x,y,z,3)
attachElements ( tentCol, tent, 0, 0, 0 )
setElementData(tentCol,"parent",tent)
setElementData(tent,"parent",tentCol)
setElementData(tentCol,"tank",true)
triggerClientEvent(source,"refreshInventoryManual",source)
end,1500,1)
end
addEvent("onPlayerBuildATank",true)
addEventHandler("onPlayerBuildATank",getRootElement(),onPlayerBuildATank)
function removeTank (object)
local x,y,z = getElementPosition(getElementData(object,"parent"))
local item,itemString = getItemTablePosition("Anti-tank hedgehog")
local itemPickup = createItemPickup(item,x,y,z+1,itemString)
destroyElement(getElementData(object,"parent"))
destroyElement(object)
end
addEvent("removeTank",true)
addEventHandler("removeTank",getRootElement(),removeTank)--]]
--[[function onPlayerBuildASandbag (itemName)
setElementData(source,itemName,getElementData(source,itemName)-1)
setPedAnimation (source,"BOMBER","BOM_Plant", -1, false, false, false, false)
local source = source
setTimer( function ()
local x,y,z = getElementPosition(source)
local xr,yr,zr = getElementRotation(source)
--outputChatBox(zr)
px, py, pz = getElementPosition(source)
prot = getPedRotation(source)
local offsetRot = math.rad(prot+90)
local vx = px + 1 * math.cos(offsetRot)
local vy = py + 1 * math.sin(offsetRot)
local vz = pz + 2
local vrot = prot+90
--local x,y = getPointFromDistanceRotation(x,y,5,0)
tent = createObject(1908,vx,vy,z-0.5,xr,yr,vrot)
setObjectScale(tent,1.3)
tentCol = createColSphere(x,y,z,1)
attachElements ( tentCol, tent, 0, 0, 0 )
setElementData(tentCol,"parent",tent)
setElementData(tent,"parent",tentCol)
setElementData(tentCol,"sandbag",true)
triggerClientEvent(source,"refreshInventoryManual",source)
end,1500,1)
end
addEvent("onPlayerBuildASandbag",true)
addEventHandler("onPlayerBuildASandbag",getRootElement(),onPlayerBuildASandbag)
function removeSandbag (object)
local x,y,z = getElementPosition(getElementData(object,"parent"))
local item,itemString = getItemTablePosition("Sandbags")
local itemPickup = createItemPickup(item,x,y,z+1,itemString)
destroyElement(getElementData(object,"parent"))
destroyElement(object)
end
addEvent("removeSandbag",true)
addEventHandler("removeSandbag",getRootElement(),removeSandbag)--]]
function onPlayerPutMine(itemName)
setPedAnimation(source, "BOMBER", "BOM_Plant", -1, false, false, false, false)
setElementData(source,"Mine",getElementData(source,"Mine")-1)
local x,y,z = getElementPosition(source)
local carmine = createObject(1510,x,y,z-0.999,0,2,3.18)
local carmineCol = createColSphere(x,y,z,2)
setElementFrozen(carmine, true)
setElementData(carmineCol,"type","pedhit")
setElementData(carmineCol,"carmine",carmine)
setElementData(carmineCol,"terror",source)
triggerClientEvent(source,"refreshInventoryManual",source)
setTimer(function()
destroyElement(carmineCol)
destroyElement(carmine)
end,600000,1)
end
addEvent("onPlayerPutMine",true)
addEventHandler("onPlayerPutMine",getRootElement(),onPlayerPutMine)
function boomCarmine(player)
if (getElementData (source, "type") == "pedhit") then
local carmine = getElementData(source, "carmine")
local terror = getElementData (source, "terror")
local x,y,z = getElementPosition (source)
setTimer(function(carmine_destroy)
if not isElement ( carmine_destroy ) then return true end
local mx,my,mz = getElementPosition(carmine_destroy)
local px,py,pz = getElementPosition(player)
local distance = getDistanceBetweenPoints3D(px,py,pz,mx,my,mz) or 0
if distance <= 3 then
setElementData(player,"blood",getElementData(player,"blood")-10)
createExplosion(x,y,z,20,terror)
destroyElement(carmine_destroy)
destroyElement(source)
end
end,300,1, carmine)
end
end
addEventHandler("onColShapeHit", getRootElement(), boomCarmine)
addEvent("destroyCarmine", true)
addEventHandler("destroyCarmine", getRootElement(), function(carmine)
local x,y,z = getElementPosition(carmine)
local terror = getElementData(carmine, "terror")
local carmineCol = getElementData(carmine, "carmine")
setTimer(function()
createExplosion(x,y,z,20,terror)
destroyElement(carmineCol)
destroyElement(carmine)
end,100,1)
end)
---------------------------------------------------------------------????????
------????..
--[[addEvent("createArrow",true)
addEventHandler("createArrow",getRootElement(),function(x,y,z,vz,hitElement)
local item,itemString = getItemTablePosition("Arrow")
local itemPickup = createItemPickup(item,x,y,z,itemString,vz, 1.75)
attachElements ( itemPickup, hitElement, 0, 0, 0 )
end)]]
------????..
addEvent("addPlayerCookMeat",true)
addEventHandler("addPlayerCookMeat",getRootElement(),function()
local source = source
if isPedInVehicle(source) then return end
if isElementInWater(source) then return end
setPedAnimation(source,"BOMBER","BOM_Plant",-1,false,false,false,false)
setTimer(function()
setElementData(source,"Raw meat",getElementData(source,"Raw meat")-1)
setElementData(source,"Cooked Meat",getElementData(source,"Cooked Meat")+1)
triggerClientEvent (source, "displayClientInfo", source,"Inventory","Voc� Cozinhou carne",22,255,0)
setPedWeaponSlot(source, 0)
triggerClientEvent(source,"refreshInventoryManual",source)
end,3000,1)
end)
addEvent("onPlayerMakeAFire",true)
addEventHandler("onPlayerMakeAFire",getRootElement(),function(itemName)
local source = source
if isPedInVehicle(source) then return end
if isElementInWater(source) then return end
setElementData(source,"Wood Pile",getElementData(source,"Wood Pile")-1)
local xr,yr,_ = getElementRotation(source)
px, py, pz = getElementPosition(source)
prot = getPedRotation(source)
local offsetRot = math.rad(prot+90)
local vx = px+1*math.cos(offsetRot)
local vy = py+1*math.sin(offsetRot)
local vz = pz+2
local vrot = prot+90
local wood = createObject(2807,vx,vy,pz-0.87,xr,yr,vrot)
setObjectScale(wood,2.9)
setElementFrozen(wood,true)
local fireCol = createColSphere(vx,vy,pz-0.75,2.5)
-- if getWeather() == 16 or getWeather() == 8 then
-- triggerClientEvent(source,"displayClientInfo",source,"fireplace","????? ?? ????? ?????? ?? ????? ?????!",255,22,0)
-- end
fire = createObject(3525,vx,vy,pz-0.8,xr,yr,vrot)
setObjectScale(fire,0)
maker = createMarker(vx,vy,pz+0.2,"corona",3,240,220,130,50)
attachElements ( fireCol, wood, 0, 0, 0 )
setElementData(fireCol,"parent",wood)
setElementData(fireCol,"fireplace",true)
setPedWeaponSlot(source, 0)
x43,y43,z43 = getElementPosition(fire)
triggerClientEvent(source,"fireplaceSound",source,x43,y43,z43)
triggerClientEvent(source,"refreshInventoryManual",source)
setPedAnimation(source,"BOMBER","BOM_Plant", -1, false, false, false, false)
setTimer(function()
if fire then
destroyElement(fire)
triggerClientEvent(source,"fireplaceStop",source)
destroyElement(maker)
end
destroyElement(fireCol)
destroyElement(wood)
end,720000,1)
end)
--[[
function checkWeatherForFireplace()
if getWeather() == 16 or getWeather() == 8 then
if fire then
destroyElement(fire)
destroyElement(maker)
triggerClientEvent(source,"fireplaceStop",source)
setElementData(fireCol,"fireplace",false)
end
end
end
setTimer(checkWeatherForFireplace,2800,0)--]]
---------------------------------------------------------------------------------------------------------------------------------------------*
addEvent("onPlayerPlaceRoadflare",true)
addEventHandler("onPlayerPlaceRoadflare",getRootElement(),function(itemName)
setElementData(source,itemName,getElementData(source,itemName)-1)
local source = source
if isPedInVehicle(source) then return end
if isElementInWater(source) then return end
setPedAnimation (source,"BOMBER","BOM_Plant",-1,false,false,false,false)
setTimer(function()
local x,y,z = getElementPosition(source)
local object = createObject(354,x,y,z-0.6)
local maker = createMarker (x,y,z-0.3,"corona",7,250,5,5)
setTimer(destroyElement,300000,1,object)
setTimer(destroyElement,300000,1,maker)
setPedWeaponSlot(source,0)
triggerClientEvent(source,"refreshInventoryManual",source)
end,800,1)
end)
---------------------------------------------------------------------------------------------------fireplace
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end
--------------------------------------------------------
--Chat Systeme --
--------------------------------------------------------
local chatRadius = 15
local chatEadioRadius = 250
function sendMessageToNearbyPlayers( message, messageType )
cancelEvent()
if (messageType == 0) then
local posX, posY, posZ = getElementPosition( source )
local chatSphere = createColSphere( posX, posY, posZ, chatRadius )
local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" )
destroyElement( chatSphere )
for index, nearbyPlayer in ipairs( nearbyPlayers ) do
outputChatBox("#008000"..string.gsub((getPlayerName(source).." : "..message), '#%x%x%x%x%x%x', ''),nearbyPlayer, 211,211,211,true )
end
end
end
addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers )
globalchat = true
function globalchatstate(playerSource)
if getElementData(playerSource, "admin") == true or getElementData(playerSource, "sadmin") == true or getElementData(playerSource, "smanager") == true or getElementData(playerSource, "owner") == true then
if globalchat == true then
globalchat = false
outputChatBox(getPlayerName(playerSource).." has deactivatet the Global Chat!", getRootElement(), 255, 0, 0)
elseif globalchat == false then
globalchat = true
outputChatBox(getPlayerName(playerSource).." has activatet the Global Chat!", getRootElement(), 255, 0, 0)
end
end
end
addCommandHandler("globalstate", globalchatstate)
function GlobalChat ( playerSource, commandname, ... )
if globalchat == true then
local playerName = getPlayerName ( playerSource )
if(isPlayerMuted ( playerSource ) ~= true) then
if(... ~= nil) then
local arg = {...}
local text = table.concat( arg, " " )
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "VIP" ) ) then
outputChatBox ( "#FFF60C*VIP* - [#00CCFF"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "Supporter" ) ) then
outputChatBox ( "#FFF60C*SUPPORTER* - [#64a500"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "Mod" ) ) then
outputChatBox ( "#FFF60C*MODERATOR* - [#FF9900"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "SuperMod" ) ) then
outputChatBox ( "#FFF60C*SUPERMOD* - [#00CC33"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ("Administrator" ) ) then
outputChatBox ( "#FFF60C*ADMIN* - [#0000CD"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ("SuperAdministrator" ) ) then
outputChatBox ( "#FFF60C*SUPERADMIN* - [#7B68EE"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ("ServerManager" ) ) then
outputChatBox ( "#FFF60C*SERVERMANANGER* - [#FF0000"..playerName.."#FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "Admin" ) ) then
outputChatBox ( "#FFF60C*OWNER* - [#FF0000"..playerName.."##FFFFFF]:#FFF60C "..text, getRootElement(), 255, 255, 255, true)
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(playerSource)), aclGetGroup ( "co-owner" ) ) then
outputChatBox ( "#FFF60C*CO-OWNER* - [#FF0000"..playerName.."##FFFFFF]#FFF60C: "..text, getRootElement(), 255, 255, 255, true)
else
outputChatBox ( "#006400[GlobalChat] #FFFFFF-["..playerName.."#FFFFFF]:#87CEFA "..string.gsub(text, '#%x%x%x%x%x%x', ''), getRootElement(), 255, 255, 255, true)
end
else
outputChatBox ( "Usage: /GlobalChat <text>",playerSource,255,255,0)
end
else
outputChatBox ( "You are muted, you cant write now!",playerSource,255,255,0)
end
else
outputChatBox(playerName.." deactivateted the global chat!", playerSource, 255, 255, 0)
end
end
addCommandHandler("GlobalChat",GlobalChat)
function playerRadioChat(playersource,cmd,...)
if cmd == "radiochat" then
local msg2 = table.concat({...}, " ")
if (getElementData(playersource,"Radio") or 0) <= 0 then outputChatBox(shownInfos["noradio"],playersource) return end
local posX, posY, posZ = getElementPosition( playersource )
local chatSphere = createColSphere( posX, posY, posZ, chatEadioRadius )
local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" )
destroyElement( chatSphere )
for index, nearbyPlayer in ipairs( nearbyPlayers ) do
if getElementData(nearbyPlayer,"Radio") > 0 then
outputChatBox(""..string.gsub((getPlayerName(playersource).." : "..msg2), '#%x%x%x%x%x%x', ''),nearbyPlayer, 89, 161, 58, 255,true )
end
end
end
end
addCommandHandler( "radiochat", playerRadioChat )
antiSpam = {}
timerSpam = {}
spamTick = 10
function antiFlood()
--if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin"))) then
--return
--end
--if (not antiSpam[source]) then
--antiSpam[source] = 1
--elseif (antiSpam[source] == spamTick) then
--cancelEvent()
--kickPlayer(source,"Eliminado pelo alagamento.")
--else
--antiSpam[source] = antiSpam[source] + 1
--if (antiSpam[source] > 2) then
--outputChatBox("N�o inunda��o! Aviso permanece: "..spamTick-antiSpam[source],source,255,255,255)
--cancelEvent()
--end
--if isTimer(timerSpam[source]) then
--killTimer(timerSpam[source])
--end
--timerSpam[source] = setTimer(function() antiSpam = {} end, 1000, 1, source)
--end
end
--addEventHandler( "onPlayerCommand", getRootElement(), antiFlood )
function blockChatMessage(m,mt)
if mt == 1 then
cancelEvent()
end
end
addEventHandler( "onPlayerChat", getRootElement(), blockChatMessage )
function checkBandit ()
for i, player in ipairs(getElementsByType("player")) do
if getElementData(player,"logedin") then
local current = getElementData(player,"skin")
if getElementData(player,"bandit") then
if current == 179 or current == 287 then
setElementModel(player,288)
elseif current == 73 then
setElementModel(player,180)
elseif current == 285 then
setElementModel(player,95)
end
elseif getElementData(player,"humanity") >= 4000 then
if current == 73 or current == 179 or current == 287 then
setElementModel(player,210)
end
else
setElementModel(player,getElementData(player,"skin"))
end
end
end
end
setTimer(checkBandit,20000,0)
function setElementModelFromClient(model)
setElementModel(source,model)
setElementData ( source, "skin", model )
end
addEvent("setElementModelFromClient",true)
addEventHandler("setElementModelFromClient",getRootElement(),setElementModelFromClient)
local infoTimer = 1200000
function outputInfo1 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayClientInfo", player,"Info","To accept any options in the menu on the left press 'middle mouse'",200,200,22)
end
setTimer(outputInfo2,infoTimer,1)
end
setTimer(outputInfo1,infoTimer,1)
function outputInfo2 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayClientInfo", player,"Info","Press 'o' to open the Support chat, hide youself first",200,200,22)
end
setTimer(outputInfo3,infoTimer,1)
end
function outputInfo3 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayClientInfo", player,"Info","Visit our Community: www.facebook.com/MTA DayZ:Retribution",200,200,22)
end
setTimer(outputInfo4,infoTimer,1)
end
function outputInfo4 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayClientInfo", player,"Info","You can enable/disable the 'Debugmonitor' using F5",200,200,22)
end
setTimer(outputInfo5,infoTimer,1)
end
function outputInfo5 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayClientInfo", player,"Info","DayZ Team Member online: "..getTeamMemberOnline(),200,200,22)
end
setTimer(outputInfo6,infoTimer,1)
end
function outputInfo6 ()
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent (player, "displayerClientInfo", player,"Info","Combat log/Duping/item glitchting/buguse is forbidden!",200,200,22)
end
setTimer(outputInfo1,infoTimer,1)
end
function getTeamMemberOnline ()
theTableMembersOnline = ""
for i,player in ipairs(getElementsByType("player")) do
local account = getPlayerAccount(player)
if not isGuestAccount(account) then
if getElementData(player,"supporter") or getElementData(player,"moderator") or getElementData(player,"smoderator") or getElementData(player,"admin") or getElementData(player,"sadmin") or getElementData(player,"smanager") or getElementData(player, "co-owner") or getElementData(player, "owner") or getElementData(player, "communitysupporter") or getElementData(player, "communityfounder") then
theTableMembersOnline = theTableMembersOnline..","..getPlayerName(player)
end
end
end
if theTableMembersOnline == "" then
return "None"
else
return theTableMembersOnline
end
end
--player Wildcard
function getPlayerWildcard(namePart)
namePart = string.lower(namePart)
local bestaccuracy = 0
local foundPlayer, b, e
for _,player in ipairs(getElementsByType("player")) do
b,e = string.find(string.lower(string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")), namePart)
if b and e then
if e-b > bestaccuracy then
bestaccuracy = e-b
foundPlayer = player
end
end
end
if (foundPlayer) then
return foundPlayer
else
return false
end
end
---------------------Set Admin/Supporter--------------------------------------------------
function setGroup (playersource,command,teamName,targetString)
if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playersource)), aclGetGroup("Admin"))) then
local foundTargetPlayer = getPlayerWildcard(targetString)
if (foundTargetPlayer) then
--Team Strings Rework
if teamName == "supporter" or teamName == "communityfounder" or teamName == "communitysupporter" or teamName == "moderator" or teamName == "smoderator" or teamName == "admin" or teamName == "sadmin" or teamName == "smanager" or teamName == "owner" or teamName == "VIP" or teamName == "remove" then
--nüx
else
outputChatBox ("#FFFFFF Nutze follgendes:",playersource,27, 89, 224,true)
outputChatBox ("#FFFFFF supporter / moderator / communitysupporter / communityfounder / smoderator / admin / sadmin / smanager / owner / VIP / remove",playersource,27, 89, 224,true)
return
end
--Set Player to Teams
if teamName == "remove" then
value = false
account = getPlayerAccount(foundTargetPlayer)
setAccountData(account,"owner",value)
setAccountData(account,"co-owner",value)
setAccountData(account,"communitysupporter",value)
setAccountData(account,"smanager",value)
setAccountData(account,"sadmin",value)
setAccountData(account,"admin",value)
setAccountData(account,"smoderator",value)
setAccountData(account,"moderator",value)
setAccountData(account,"supporter",value)
setElementData(foundTargetPlayer,"owner",value)
setElementData(foundTargetPlayer,"co-owner",value)
setElementData(foundTargetPlayer,"smanager",value)
setElementData(foundTargetPlayer,"sadmin",value)
setElementData(foundTargetPlayer,"admin",value)
setElementData(foundTargetPlayer,"smoderator",value)
setElementData(foundTargetPlayer,"moderator",value)
setElementData(foundTargetPlayer,"supporter",value)
else
value = true
end
account = getPlayerAccount(foundTargetPlayer)
accountname = getAccountName(account)
setAccountData(account,teamName,value)
setElementData(foundTargetPlayer,teamName,value)
if value == true then
outputChatBox ("#FFFFFF"..getPlayerName (foundTargetPlayer).." #FF0000 is now a "..teamName,getRootElement(),27, 89, 224,true)
else
outputChatBox ("#FFFFFF"..getPlayerName (foundTargetPlayer).." #FF0000 was removed from his admin rank.",getRootElement(),27, 89, 224,true)
end
else
outputChatBox ("#FFFFFF Spieler nicht gefunden",playersource,27, 89, 224,true)
end
end
end
addCommandHandler("add",setGroup)
function banPLayer (playersource,command,targetString,banTime,reason)
if getAccountData(getPlayerAccount(playersource),"admin") == true then
local foundTargetPlayer = getPlayerWildcard(targetString)
local banTime = banTime or 0
local reason = reason or "Unknown"
if (foundTargetPlayer) then
local account = getPlayerAccount()
local ip = getPlayerIP(foundTargetPlayer)
local serial = getPlayerSerial(foundTargetPlayer)
local name = getPlayerName(foundTargetPlayer)
kickPlayer(foundTargetPlayer,playersource,reason)
addBan (ip,name,serial,playersource,reason,banTime*86400)
outputChatBox ("#FFFFFF"..name.." #FF0000 was banned for "..banTime.." Day(Z)'s.",getRootElement(),27, 89, 224,true)
else
outputChatBox ("##FFFFFF Target not found.",playersource,27, 89, 224,true)
end
else
outputChatBox ("#FFFFFFyou are not admin! ",playersource,27, 89, 224,true)
end
end
addCommandHandler("playerban",banPLayer)
function pmsgAdmin (playersource,command,...)
local msg = table.concat({...}, " ")
if getAccountData(getPlayerAccount(playersource), "admin") == true or getAccountData(getPlayerAccount(playersource), "sadmin") == true or getAccountData(getPlayerAccount(playersource), "smanager") == true or getAccountData(getPlayerAccount(playersource), "owner") == true then
outputChatBox ("[RetributionZ]"..getPlayerName(playersource)..": "..msg,getRootElement(),60,200,40,true)
else
outputChatBox ("#FFFFFFyou are not admin! ",playersource,27, 89, 224,true)
end
end
addCommandHandler("pmsg",pmsgAdmin)
--[[
function SideChannel (playersource,command,...)
local msg5 = table.concat({...}, " ")
if cmd == "sidechannel" then
outputChatBox ("[SIDE CHANNEL]"..getPlayerName(playersource)..":" ..msg,getRootElement(),100,149,237,true)
else
outputChatBox ("#FFFFFFSide Channel is disabled!",playersource,27,89,224,true)
end
end
addCommandHandler("sidechannel", SideChannel)
bindKey(source,"g","down",SideChannel)
]]
botSupportTable = {
--Website
{"website","what","","The URL is: www.community.vavegames.net.","","James"},
{"website","where","","The URL is: www.community.vavegames.net.","","James"},
{"website","which","","The URL is: www.community.vavegames.net.","","James"},
{"website","how","","The URL is: www.community.vavegames.net.","","James"},
{"website","got","","The URL is: www.community.vavegames.net.","","James"},
{"website","know","","The URL is: www.community.vavegames.net.","","James"},
--Chat
{"hey","james","","Hey.","","James"},
{"hey","paul","","Yo!.","","Paul"},
{"hey","sandra","","Hello.","","Sandra"},
{"how are","you","james","I am fine, thank you.","","James"},
{"how are","you","paul","Feeling absolutely splendid today, why, thanks!","","Paul"},
{"how are","you","sandra","I am perfectly fine.","","Sandra"},
{"i love","you","sandra","ERROR: Can't access emotions.exe.","Thanks.","Sandra"},
{"thank","you","james","You are welcome.","","James"},
{"thank","paul","you","Hey, that's my job!","","Paul"},
{"thank","sandra","you","You are welcome.","","Sandra"},
--IngameHelp (james)
{"how","use","map","Press F11 to use the map.","","James"},
{"how","use","gps","The GPS activates automatically. You can see it at the lower left corner.","","James"},
{"how","take","items","Press 'J' to open your inventory. Alternatively, you can press the middle mouse button or '-' to pick items up.","","James"},
{"how","open","inven","By pressing 'J', you can open your inventory.","","James"},
--Cyxno
{"drop","item","","Press 'J' to open your inventory, select the item you want to drop and press the arrow pointing to the left.","","Paul"},
{"fuel","car","how","You need an 'Empty Gas Canister'. You can fill it at a gas station.","","Sandra"},
{"pick","items","how","Press the middle mouse button (or '-') when the name of the item is written on the left of your screen.","","Sandra"},
{"fence","wire","destroy","You need a toolbox to destroy a wirefence.","","James"},
{"register","how","to","You need to fill in your name and password. Afterwards, press 'Register'. If it doesn't work, reconnect.","","James"},
{"bugged","stuck","help","Wait until an admin contacts and helps you.","","Sandra"},
--Marwin
{"radio","chat","","Press 'Z' to use the radio device.","","James"},
}
function botCheck (text,player)
for i, data in ipairs(botSupportTable) do
if string.find(text:lower(), data[1]:lower(), 1, true) and string.find(text:lower(), data[2]:lower(), 1, true) and string.find(text:lower(), data[3]:lower(), 1, true) then
answere = data[4]
if data[5] ~= "" then
local randomNumber = math.random(4,5)
answere = data[randomNumber]
end
setTimer(onServerSupportChatMessage,math.random(3000,6000),1,data[6],string.gsub(getPlayerName ( player ), '#%x%x%x%x%x%x', '')..", "..answere)
end
end
end
function onServerSupportChatMessage (player2,text)
notGoOn = false
mutedmessage = false
for i, player in ipairs(getElementsByType("player")) do
if player2 == "Sandra" or player2 == "James" or player2 == "Paul" then
triggerClientEvent(player,"onSupportChatMessage",player,player2,text)
notGoOn = true
elseif getElementData(player, "supporter") == true or getElementData(player, "moderator") == true or getElementData(player, "smoderator") == true or getElementData(player, "admin") == true or getElementData(player, "sadmin") == true or getElementData(player, "smanager") == true or getElementData(player, "owner") == true or getElementData(player, "communitysupporter") == true or getElementData(player, "communityfounder") == true then
if not getElementData(player2,"owner") then
if not getElementData(player2, "smanager") then
if not getElementData(player2, "sadmin") then
if not getElementData(player2,"admin") then
if not getElementData(player2,"smoderator") then
if not getElementData(player2,"moderator") then
if not getElementData(player2,"supporter") then
if not getElementData(player2,"co-owner") then
if not getElementData(player2,"communitysupporter") then
if not isPlayerMuted(player2) then
outputChatBox("#2200ddNew Support Message from "..getPlayerName(player2),player,255,255,255,true)
end
end
end
end
end
end
end
end
end
end
end
if not notGoOn then
if not isPlayerMuted(player2) then
triggerClientEvent(player,"onSupportChatMessage",player,player2,text)
else
mutedmessage = true
end
end
end
if not notGoOn then
botCheck(text,player2)
end
if mutedmessage then
outputChatBox("#2200ddYou are Muted",player2,255,255,255,true)
end
end
addEvent("onServerSupportChatMessage",true)
addEventHandler("onServerSupportChatMessage", getRootElement(),onServerSupportChatMessage)
--Weapon Property
setWeaponProperty ("m4","poor","maximum_clip_ammo",30)
setWeaponProperty ("m4","std","maximum_clip_ammo",30)
setWeaponProperty ("m4","pro","maximum_clip_ammo",30)
setWeaponProperty ("M249 SAW","poor","maximum_clip_ammo",100)
setWeaponProperty ("M249 SAW","std","maximum_clip_ammo",100)
setWeaponProperty ("M249 SAW","pro","maximum_clip_ammo",100)
setWeaponProperty("M240", "pro", "maximum_clip_ammo", 100)
setWeaponProperty("MK48", "pro", "flags", 0x000800)
setWeaponProperty("MK48", "pro", "flags", 0x000002)
setWeaponProperty("MK48", "pro", "maximum_clip_ammo", 100)
function kickPLayer (playersource,command,targetString,banTime,reason)
if getAccountData(getPlayerAccount(playersource),"admin") == true then
for i,player in ipairs(getElementsByType("player")) do
if player ~= playersource then
kickPlayer(player,"Server Script Restart, #Hotfix")
end
end
else
outputChatBox ("#FFFFFFyou are not admin! ",playersource,27, 89, 224,true)
end
end
addCommandHandler("kickplayer",banPLayer)
function kickAll (playersource,command,reason)
if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playersource)), aclGetGroup("Admin"))) then
for i, player in ipairs(getElementsByType("player")) do
if player == playersource then break end
kickPlayer(player,reason)
end
else
outputChatBox ("#you are not admin!",playersource,27, 89, 224,true)
end
end
addCommandHandler("kickall",kickAll)
--Supportermode
local supporterMode = {}
local foodd = {}
local thirstt = {}
function Supportermode (playersource,command)
if getAccountData(getPlayerAccount(playersource),"supporter") == true then
supporterMode[playersource] = not (supporterMode[playersource] or false)
if supporterMode[playersource] then
setElementAlpha(playersource,0)
setElementFrozen(playersource,true)
foodd[playersource] = getElementData(playersource,"food")
thirstt[playersource] = getElementData(playersource,"thirst")
else
setElementAlpha(playersource,255)
setElementFrozen(playersource,false)
end
else
outputChatBox ("#FFFFFFVoc� n�o � um torcedor, voc� n�o pode usar este comando!",playersource,27, 89, 224,true)
end
end
addCommandHandler("supportmode",Supportermode)
function StatsSupportermode ()
for i,player in ipairs(getElementsByType("player")) do
if supporterMode[player] then
setElementData (player,"food",foodd[player])
setElementData (player,"thirst",thirstt[player])
end
end
end
setTimer(StatsSupportermode,60000,0)
function preventCommandSpam(commandName)
if commandName == "login" or commandName == "logout" then
cancelEvent()
end
end
addEventHandler("onPlayerCommand", root, preventCommandSpam)
--Pingkick
--[[
function kickPlayerOnHighPing ()
outputChatBox (getPlayerName(source).." was kicked, highping.",getRootElement(),27, 89, 224,true)
kickPlayer(source,"Your Ping was straight to high.")
end
addEvent("kickPlayerOnHighPing",true)
addEventHandler("kickPlayerOnHighPing", getRootElement(),kickPlayerOnHighPing)
--]]
local handsUp = false
local siting = false
local lying = false
function funcBindHandsup ( player, key, keyState )
if getElementData(player,"isUseMedic") == false and getElementData(player,"isEating") == false and getElementData(player,"isDrinking") == false and getElementData(player,"isSetingTent") == false and getElementData(player,"Repairing") == false then
if not getElementData ( player, "inComa" ) then
if handsUp then
setPedAnimation (player,false)
handsUp = false
else
if isPedInVehicle (player) then return end
setPedAnimation (player,"BEACH","ParkSit_M_loop",-1,false,false,false,false)
handsUp = true
end
end
end
end
function funcBindSit ( player, key, keyState )
if getElementData(player,"isUseMedic") == false and getElementData(player,"isEating") == false and getElementData(player,"isDrinking") == false and getElementData(player,"isSetingTent") == false and getElementData(player,"Repairing") == false then
if not getElementData ( player, "inComa" ) then
if siting then
setPedAnimation (player,false)
siting = false
else
if isPedInVehicle (player) then return end
setPedAnimation (player,"SHOP","SHP_Rob_HandsUp",-1,false,false,false,false)
siting = true
end
end
end
end
function funcBindLie ( player, key, keyState )
if getElementData(player,"isUseMedic") == false and getElementData(player,"isEating") == false and getElementData(player,"isDrinking") == false and getElementData(player,"isSetingTent") == false and getElementData(player,"Repairing") == false then
if not getElementData ( player, "inComa" ) then
if lying then
setPedAnimation (player,false)
lying = false
else
if isPedInVehicle (player) then return end
setPedAnimation (player, "PARACHUTE", "FALL_skyDive_DIE", -1, false, false, false, true)
lying = true
function setVisibility()
value = 0
end
end
end
end
end
function bindTheKeys ()
bindKey(source,",","down",funcBindHandsup)
bindKey(source,".","down",funcBindSit)
bindKey(source,"l","down",funcBindLie)
end
addEventHandler("onPlayerLogin", getRootElement(), bindTheKeys)
------------HUD..
function quitar ( )
setPlayerHudComponentVisible (source, "health", false )
setPlayerHudComponentVisible (source, "money", false )
setPlayerHudComponentVisible (source, "clock", false )
setPlayerHudComponentVisible (source, "weapon", false )
setPlayerHudComponentVisible (source, "ammo", false)
setPlayerHudComponentVisible (source, "money", false )
setPlayerHudComponentVisible (source, "wanted", false )
setPlayerHudComponentVisible (source, "crosshair", true )
end
addEventHandler ( "onPlayerJoin", getRootElement(), quitar )
addEventHandler ( "onResourceStart", getRootElement(), quitar )
------------HUD..
function makeRadioStayOff()
setRadioChannel(0)
cancelEvent()
end
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
function onPlayerHideBody()
local col = getElementData(source,"currentCol")
if getElementData(source,"Shovel") >= 1 then
if isElement (col) then
if getElementData(col,"deadman") then
setElementData(source,"loot",false)
setElementData(source,"currentCol",false)
setTimer(function(colision)
if isElement (getElementData(colision,"parent")) then
destroyElement(getElementData(colision,"parent"))
end
destroyElement(colision)
end,2000,1,col)
end
end
end
end
addEvent("onPlayerHideBody",true)
addEventHandler("onPlayerHideBody",getRootElement(),onPlayerHideBody)
sorry forgot :3
but,why in other server its works?