AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if a player is standing on opposite team spawn(buyzone) (https://forums.alliedmods.net/showthread.php?t=134732)

Jack86 08-08-2010 03:08

Check if a player is standing on opposite team spawn(buyzone)
 
How can i check this for both teams, to see is player on spawning area or in buyzone of opposite team (those two are pretty much the same), is there some simpler way that creating 2 zones with coordinates for every map and checking is player in that zone.

ot_207 08-08-2010 04:38

Re: Check if a player is standing on opposite team spawn(buyzone)
 
I think that you can detect them via Touch. You get the buyzone origins, store them and compare them when user touches them.

Jack86 08-08-2010 11:51

Re: Check if a player is standing on opposite team spawn(buyzone)
 
I get everything except this
Quote:

Originally Posted by ot_207 (Post 1265173)
You get the buyzone origins

I havent seen a piece of code doing that and i dont know how to do it, the only buyzone check im familiar with is cs_get_user_buyzone(index)

Jack86 08-08-2010 13:31

Re: Check if a player is standing on opposite team spawn(buyzone)
 
Ok i tried this with different approach by spawning a fake player of opposite team and check is that player in buyzone, and i dont unerstand why buyzone check always returns 0.
PHP Code:

stock bool:is_in_zone(Float:origin[3],Float:angles[3],team)
{
    new 
Bot engfunc(EngFunc_CreateFakeClient"FlagCheck")
    if (
Bot 0) {
        
dllfunc(MetaFunc_CallGameEntity"player"Bot)
        
set_pev(Botpev_flagsFL_FAKECLIENT)

        
set_pev(Botpev_model"" )
        
set_pev(Botpev_viewmodel2"")
        
set_pev(Botpev_modelindex0)

        
set_pev(Botpev_originorigin)
        
set_pev(Botpev_anglesangles)

        
set_pev(Botpev_renderfxkRenderFxNone)
        
set_pev(Botpev_rendermodekRenderTransAlpha)
        
set_pev(Botpev_renderamt0.0)

        if(
team == 1)    cs_set_user_team(BotCS_TEAM_CT)
        else if(
team == 2)    cs_set_user_team(BotCS_TEAM_T)
        
is_user_bott[Bot] = true
    
}

    
client_print(0,print_chat,"Bot origin:%f %f %f buyzone:%d",origin[0],origin[1],origin[2],cs_get_user_buyzone(Bot))
    if(
cs_get_user_buyzone(Bot))
    {
        return 
true
    
}    
    return 
false



Leon M. 08-09-2010 05:57

Re: Check if a player is standing on opposite team spawn(buyzone)
 
Hi,

you could check in sphere for info_player_start (ct spawn) and info_player_deathmatch (t spawn).

Greetz
Leon

Jack86 08-09-2010 10:43

Re: Check if a player is standing on opposite team spawn(buyzone)
 
Such a simple and easy solution, tnx for help.


All times are GMT -4. The time now is 00:16.

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