Raised This Month: $ Target: $400
 0% 

Detect if someone is in spawn.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-21-2008 , 20:15   Detect if someone is in spawn.
Reply With Quote #1

How would I detect if someone is in spawn? If it's mod specific, I'm working with DOD.

Thanks.
fysiks is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-21-2008 , 21:35   Re: Detect if someone is in spawn.
Reply With Quote #2

What are the names of the player spawn entities in DOD?
__________________

Community / No support through PM
danielkza is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-21-2008 , 22:50   Re: Detect if someone is in spawn.
Reply With Quote #3

Check distance to all spawn entities for that team and if the distance is closer than whatever you want, they are in spawn

Code:
const spawnEntString[2][] = {"info_player_axis","info_player_allies"};
const spawnDist = 200;
//
user_in_spawn(id)
{
	new ent, string_num;
	if( get_user_team(id) == 2) string_num = 0;
	else string_num = 1;

	while( ( ent = fm_find_ent_by_class(ent,spawnEntString[string_num]) ) ){
		if( fm_entity_range( id, ent ) < spawnDist ) return true;
	}
	return false;
}

Last edited by Emp`; 12-21-2008 at 22:54.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-21-2008 , 23:34   Re: Detect if someone is in spawn.
Reply With Quote #4

Thanks works great (with the typo edit ). I must have copied it in the 4 minutes between you posting and editing the code LOL. Amazing timing .
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode