Raised This Month: $ Target: $400
 0% 

[Help] Swap


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-19-2008 , 06:27   Re: [Help] Swap
Reply With Quote #2

Remove flag "a" from get_players. Put "h" instead or nothing.
http://www.amxmodx.org/funcwiki.php?go=func&id=174

Also, you don't need to check if player is connected.


I would code it this way :
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Auto Change Team"
#define VERSION "1.0"
#define AUTHOR "LostSkill"

new const START[] = "sound/tmreverse.mp3"
new const END[] = "sound/tmreversed.mp3"

new g_iRoundCount 1
new g_iMaxPlayers

public plugin_precache()
{
    
precache_generic(START)
    
precache_generic(END)
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("Logevent_Round_End"2"1=Round_End")

    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")

    
register_event("DeathMsg""Event_DeathMsg""a")

    
g_iMaxPlayers get_maxplayers()
}

public 
Event_TextMsg_Restart()
{
    
g_iRoundCount 0
}

public 
Event_HLTV_New_Round()
{
    if( ++
g_iRoundCount == )
        
client_cmd(0"mp3 play %s"END)
}

public 
Logevent_Round_End() 

    if( 
g_iRoundCount != )
        return

    
client_print(0print_chat"** Don't change team !!")
    
client_cmd(0"mp3 play %s"START)

    for(new 
idid<=g_iMaxPlayersid++)
    {
        if( !
is_user_connected(id) || is_user_hltv(id) )
        {
            continue
        }

        switch( 
get_pdata_int(id114) )
        {
            case 
1:set_pdata_int(id1142)
            case 
2:set_pdata_int(id1141)
        }
    }
}

public 
Event_DeathMsg()
{
    if( 
g_iRoundCount == )
    {
        
client_print(read_data(2), print_chat"** Don't change team !!")
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-19-2008 at 06:42.
ConnorMcLeod is offline
 



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:07.


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