Forum



How do I know if a player collected a supply?
2 replies



1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function checkGotSupply ( ply ) 	local col = collision ( "colplayer", getplayerx( ply ), getplayery( ply ), 0, 0 ) -- check for collisions with objects (players and terrain notwithstanding, hence the two zeros) 	local obj = objectcollision () -- get the object the player collided with 	if ( col > 0 and obj > 0 and objecttype ( obj ) == "o_supply" ) then -- if a collision has occured and an object was collided with and the object is a supply box 		return obj > 0, obj -- return two values, true/false if a collision with an object has occurred and the ID of the object 	end 	return false, nil end



