AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect if someone is in spawn. (https://forums.alliedmods.net/showthread.php?t=82361)

fysiks 12-21-2008 20:15

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

Thanks.

danielkza 12-21-2008 21:35

Re: Detect if someone is in spawn.
 
What are the names of the player spawn entities in DOD?

Emp` 12-21-2008 22:50

Re: Detect if someone is in spawn.
 
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;
}


fysiks 12-21-2008 23:34

Re: Detect if someone is in spawn.
 
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 :).


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

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