Forum

> > Carnage Contest > How do I know if a player collected a supply?
Forums overviewCarnage Contest overviewLog in to reply

English How do I know if a player collected a supply?

2 replies
To the start Previous 1 Next To the start

old Re: How do I know if a player collected a supply?

EngiN33R
Moderator Off Offline

Quote
Although I'm not a specialist in the area of Carnage Contest scripting, from what I gathered from the help page I'm fairly certain you could do it like this, as Nemesis already said:

1
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
To the start Previous 1 Next To the start
Log in to replyCarnage Contest overviewForums overview