and my dropped m4's ammo wasn't change.
can anyone give me example?
Scripts
how to change dropped weapon's ammo?
how to change dropped weapon's ammo?
1

addhook("drop","bros")
function bros(id,iid,type)
	if type == 10 then
		timer(1,"parse","setammo "..iid.." 0 1000 0")
	end
end
for _,iid in pairs(item(0,"table")) do
	if item(iid,"type") == 10 then
		parse("setammo "..iid.." 0 1000 0")
	end
end
serious-sam: All this stuff is described in the online reference as well. Just in case you didn't know it:
setammo. item(0, "table")
Client has 30 ammo and shoots 5 times
Only 4 shots arrive at the server because a message got lost in the network
Server uses a Lua script to give the player 5 additional shots by using the own ammo value (which is 30-4=26, the server is NOT aware of the actual client value which is 30-5=25)
The client will now have 31 ammo, even though he was supposed to get just 5 additional shots.
From the view of the client it looks like it got 6 additional ammo and not just 5.
1
