again...i want if you type !dropgasmask you drop gas mask if anyone can do this little script pls help... cuz im not that scripter
Scripts
Drop Gas mask
Drop Gas mask
1

again...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
ttoni: when i write !dropgasmask i die then respawn and second i wanted gas mask dropped not all weapons
Mami Tomoe said, the workaround exists because you can't do a strip *id* 60console 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
Cure Pikachu: It does not work, we're required to kill the player, simply spawning the player will not work.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()
This will make the player drop their Gas Mask.
This will kill the player (but re-spawn them and reduce the death counter.
This will end the round, if the player was the last one alive on their team on a standard game mode.
On cases where the player gets weapons on spawn (either by the map, or another Lua script) the weapons will duplicate (can be fixed, but may be complicated to beginners).
May not be reliable under bigger scripts, unless properly handled.
Mami Tomoe: its spawn gas mask gas mask will still in your head and also make you drop all your weapons there is lot bugs
NanuPlayer has written
https://www.tutorialspoint.com/lua/index.htm
NanuPlayer has written
Mami Tomoe: its spawn gas mask gas mask will still in your head and also make you drop all your weapons there is lot bugs
1
