
i want if you type !dropgasmask you drop gas mask if anyone can do this little script pls help... cuz im not that scripter
addhook("say", "say")
addhook("die", "die")
addhook("spawn", "spawn")
local isDroppedMask = {}
local wpnList = {}
function say(pid, msg)
if(msg == "!dropgasmask") then
if(player(pid, "gasmask") == true) then
isDroppedMask[pid] = true
local itemlist = playerweapons(pid)
wpnList[pid] = {}
for _,iid in pairs(itemlist) do
table.insert(wpnList[pid], itemtype(iid, "name"))
end
itemlist = nil
parse("killplayer "..tostring(pid))
end
end
end
function die(victim, killer, weapon, x, y, killerobject)
if(isDroppedMask[victim] == true) then
parse("spawnplayer "..tostring(victim).." "..tostring(x).." "..tostring(y))
return 1
end
return 0
end
function spawnEquip(pid)
pid = tonumber(pid)
for _,itemType in pairs(wpnList[pid]) do
parse("equip "..tostring(pid).." "..tostring(itemType))
end
parse("spawnitem 60 "..tostring(player(pid, "tilex")).." "..tostring(player(pid, "tiley")))
end
function spawn(pid)
if(isDroppedMask[pid] == true) then
isDroppedMask[pid] = false
timer(10, "spawnEquip", tostring(pid), 1)
end
return ""
end
strip *id* 60
console command to remove the gas mask from your inventory.function strip(id,item)
if player(id,"exists") and player(id,"health") > 0 then -- Cheap precautions
local armor, hp, mhp, wpnlist, x, y
armor = player(id,"armor")
hp = player(id,"health")
mhp = player(id,"maxhealth")
wpnlist = playerweapons(id)
x = player(id,"x")
y = player(id,"y")
local df = false
local nv = false
local gm = false
if player(id,"defusekit") then df = true end
if player(id,"nightvision") then nv = true end
if player(id,"gasmask") then gm = true end
if item == 56 or item == 59 or item == 60 then
parse("spawnplayer "..id.." "..x.." "..y)
parse("setmaxhealth "..id.." "..mhp)
parse("sethealth "..id.." "..hp)
parse("setarmor "..id.." "..armor)
for _, w in ipairs(wpnlist) do
parse("equip "..id.." "..w)
end
if item == 56 then
if nv == true then parse("equip "..id.." 59") end
if gm == true then parse("equip "..id.." 60") end
elseif item == 59 then
if df == true then parse("equip "..id.." 56") end
if gm == true then parse("equip "..id.." 60") end
elseif item == 60 then
if df == true then parse("equip "..id.." 56") end
if nv == true then parse("equip "..id.." 59") end
end
else
parse("strip "..id.." "..item)
end
end
end
addhook("say","_say")
function _say(id,txt)
if txt == "!dropgasmask" then
if player(id,"gasmask") then
local tx, ty = player(id,"tilex"), player(id,"tiley")
parse("spawnitem 60 "..tx.." "..ty)
strip(id,60)
end
end
end
MT = { lock_gasmask = { } }
function MT.walkover_hook(p, itemID, itemType, ammoIn, ammo, mode)
if itemType == 60 and MT.lock_gasmask[p] then
return 1
end
end
function MT.say_hook(p, message)
if message == '!dropgasmask' then
MT.lock_gasmask[p] = true
local x, y = player(p, 'x'), player(p, 'y')
parse('customkill "0" "Server" "' .. p .. '"')
parse('setdeaths "' .. p .. '" "' .. player(p, 'deaths') - 1)
parse('spawnplayer "' .. p .. '" "' .. x .. '" "' .. y .. '"')
MT.lock_gasmask[p] = nil
end
end
local function init()
addhook('walkover', 'MT.walkover_hook')
addhook('say', 'MT.say_hook')
end
init()