Raised This Month: $ Target: $400
 0% 

detect if Ct are standing in there spawn?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-18-2013 , 18:46   Re: detect if Ct are standing in there spawn?
Reply With Quote #2

OR Just use StatusIcon event ;)

Example.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new p_Active;
new 
p_Team;

public 
plugin_init()
{
    
register_plugin("Buy Zone God Mode",AMXX_VERSION_STR,"SmileY");
    
    
p_Active     register_cvar("amx_godmode_respawn","1");
    
p_Team         register_cvar("amx_godmode_teams","ANY"); // ANY = ALL (TR = TRs | CT = CTs)
    
    
register_message(get_user_msgid("StatusIcon"),"MSG_StatusIcon"); // Optmize this event?
}

public 
MSG_StatusIcon(iMsg,iDest,id)
{
    if(
get_pcvar_num(p_Active))
    {
        new 
szTeam[4];
        
get_pcvar_string(p_Team,szTeam,charsmax(szTeam));
        
        static 
szIcon[8];     // Optmize this event?
        
get_msg_arg_string(2,szIcon,charsmax(szIcon));
        
        if(
equal(szTeam,"ANY") && equal(szIcon,"buyzone")) set_pev(id,pev_takedamage,get_msg_arg_int(1) ? DAMAGE_NO DAMAGE_AIM);
        
        else if(
equal(szTeam,"TR") && equal(szIcon,"buyzone") && (cs_get_user_team(id) == CS_TEAM_T)) set_pev(id,pev_takedamage,get_msg_arg_int(1) ? DAMAGE_NO DAMAGE_AIM);
        
        else if(
equal(szTeam,"CT") && equal(szIcon,"buyzone") && (cs_get_user_team(id) == CS_TEAM_CT)) set_pev(id,pev_takedamage,get_msg_arg_int(1) ? DAMAGE_NO DAMAGE_AIM);
    }

Sorry, Optmized version:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new p_Active;
new 
p_Team;

public 
plugin_init()
{
    
register_plugin("Buy Zone God Mode",AMXX_VERSION_STR,"SmileY");
    
    
p_Active     register_cvar("amx_godmode_respawn","1");
    
p_Team         register_cvar("amx_godmode_teams","ANY"); // ANY = ALL (TR = TRs | CT = CTs)
    
    
register_event("StatusIcon","MSG_StatusIcon","be","2=buyzone"); // Optmize this event?
}

public 
MSG_StatusIcon(id)
{
    if(
get_pcvar_num(p_Active))
    {
        new 
szTeam[4];
        
get_pcvar_string(p_Team,szTeam,charsmax(szTeam));
        
        if(
equal(szTeam,"ANY")) set_pev(id,pev_takedamage,read_data(1) ? DAMAGE_NO DAMAGE_AIM);
        
        else if(
equal(szTeam,"TR") && (cs_get_user_team(id) == CS_TEAM_T)) set_pev(id,pev_takedamage,read_data(1) ? DAMAGE_NO DAMAGE_AIM);
            
        else if(
equal(szTeam,"CT") && (cs_get_user_team(id) == CS_TEAM_CT)) set_pev(id,pev_takedamage,read_data(1) ? DAMAGE_NO DAMAGE_AIM);
    }

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 07-18-2013 at 19:13. Reason: Optmized
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
 



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 06:24.


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