Raised This Month: $ Target: $400
 0% 

swap team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
emaya93
Member
Join Date: Jun 2012
Old 12-31-2013 , 07:43   swap team
Reply With Quote #1

Hi everyone and have a good new year!
I have download this plugin posted by ConnorMcLeod https://forums.alliedmods.net/attach...3&d=1303739069

On windows xp work, but on linux dont... I have this errors in my console ( with debug)

Code:
stray key in process_key: item_getiteminfo 61
 12/31/2013 - 13:45:03: [ORPHEU] Function "InstallGameRules" not found
 12/31/2013 - 13:45:03: [AMXX] Displaying debug trace (plugin "swap_teams.amxx")
 12/31/2013 - 13:45:03: [AMXX] Run time error 10: native error (native "OrpheuGetFunction")
 12/31/2013 - 13:45:03: [AMXX] [0] swap_teams.sma::plugin_precache (line 126)
[AMXX] Loaded 1 admin from file
Cmd_AddCommand: say already defined
 12/31/2013 - 13:45:03: [ORPHEU] Function "CHalfLifeMultiplay::SwapAllPlayers" not found
 12/31/2013 - 13:45:03: [AMXX] Displaying debug trace (plugin "swap_teams.amxx")
 12/31/2013 - 13:45:03: [AMXX] Run time error 10: native error (native "OrpheuGetFunction")
 12/31/2013 - 13:45:03: [AMXX] [0] swap_teams.sma::plugin_init (line 58)
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
meta list
Code:
descriptionstat pend  file  verssrc  load  unlod
 [ 1] AMX Mod X  RUN- amxmodx_mm_i386.  v1.8.2 ini  Start ANY  
 [ 2] Fun  RUN- fun_amxx_i386.so  v1.8.2 pl1  ANYANY  
 [ 3] CStrike RUN- cstrike_amxx_i38  v1.8.2 pl1  ANYANY  
 [ 4] CSX  RUN- csx_amxx_i386.so  v1.8.2 pl1  ANYANY  
 [ 5] Orpheu  RUN- orpheu_amxx_i386  v2.5.1 pl1  ANYANY  
 [ 6] FakeMetaRUN- fakemeta_amxx_i3  v1.8.2 pl1  ANYANY  
 [ 7] Ham Sandwich  RUN- hamsandwich_amxx  v1.8.2 pl1  ANYANY  
 [ 8] Engine  RUN- engine_amxx_i386  v1.8.2 pl1  ANYANY  
8 plugins, 8 running
plugins
Code:
name  version  authorfile status
 [  1] Admin Base  1.8.2 AMXX Dev Team  admin.amxx running  
 [  2] Admin Commands 1.8.2 AMXX Dev Team  admincmd.amxx running  
 [  3] Admin Help  1.8.2 AMXX Dev Team  adminhelp.amxxrunning  
 [  4] Slots Reservation 1.8.2 AMXX Dev Team  adminslots.amxx  running  
 [  5] Multi-Lingual System 1.8.2 AMXX Dev Team  multilingual.am  running  
 [  6] Menus Front-End1.8.2 AMXX Dev Team  menufront.amxxrunning  
 [  7] Commands Menu  1.8.2 AMXX Dev Team  cmdmenu.amxx  running  
 [  8] Players Menu1.8.2 AMXX Dev Team  plmenu.amxxrunning  
 [  9] Maps Menu1.8.2 AMXX Dev Team  mapsmenu.amxx running  
 [ 10] Plugin Menu 1.8.2 AMXX Dev Team  pluginmenu.amxx  running  
 [ 11] Admin Chat  1.8.2 AMXX Dev Team  adminchat.amxxrunning  
 [ 12] Anti Flood  1.8.2 AMXX Dev Team  antiflood.amxxrunning  
 [ 13] Scrolling Message 1.8.2 AMXX Dev Team  scrollmsg.amxxrunning  
 [ 14] Info. Messages 1.8.2 AMXX Dev Team  imessage.amxx running  
 [ 15] Admin Votes 1.8.2 AMXX Dev Team  adminvote.amxxrunning  
 [ 16] NextMap  1.8.2 AMXX Dev Team  nextmap.amxx  running  
 [ 17] Nextmap Chooser1.8.2 AMXX Dev Team  mapchooser.amxx  running  
 [ 18] TimeLeft 1.8.2 AMXX Dev Team  timeleft.amxx running  
 [ 19] Pause Plugins  1.8.2 AMXX Dev Team  pausecfg.amxx running  
 [ 20] Stats Configuration  1.8.2 AMXX Dev Team  statscfg.amxx running  
 [ 21] StatsX1.8.2 AMXX Dev Team  statsx.amxxrunning  
 [ 22] Swap Teams  0.0.1 ConnorMcLeodswap_teams.amxx  debug 
22 plugins, 22 running
And this is the plugin edited by me...
Code:
#include < amxmodx >
#include < fakemeta_util >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >
#include < orpheu >
#include < engine >
#include < fun >
#include < dhudmessage >

#define VERSION "0.0.1"
#define PLUGIN "Swap Teams"
#define MAXSLOTS   32

// team names
// CS_TEAM_UNASSIGNED
// CS_TEAM_T
// CS_TEAM_CT
// CS_TEAM_SPECTATOR

new const TeamNames[ CsTeams ][ ] ={
    "",
    "Terrorist",
    "Counter-Terrorist",
    ""
};


new bool:gb_Freezed;

// variable holding the current round
new CurrentRound;

// bool whether it's the 15th round or not
new bool:LastRound;

// current team round count
new RoundsWon[ CsTeams ];

new OrpheuFunction:g_OfSwapAllPlayers 
new g_pGameRules
new bool:g_bSwapTeamsOnNextRound
new pistolrounds
static const g_szB[ ]= "b";

public plugin_init( )
{
    register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
    // hook round start
    register_logevent( "LogEvent_RoundStart", 2, "1=Round_Start" );
    register_event("TextMsg", "resetare", "a", "2&#Game_C", "2&#Game_W");
    // hook round win
    register_event( "SendAudio", "Event_SendAudio_TWin", "a", "2&%!MRAD_terwin" );
    register_event( "SendAudio", "Event_SendAudio_CTWin", "a", "2&%!MRAD_ctwin" );
    
    register_concmd("say !resetcount", "resetare", ADMIN_KICK)
    
    g_OfSwapAllPlayers = OrpheuGetFunction("SwapAllPlayers", "CHalfLifeMultiplay")
    pistolrounds = register_cvar("amx_pistolrounds", "0")
    RegisterHam(Ham_Spawn, "player", "reset_weapons", 1);
    
    register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
    
    set_task( 1.0, "ShowMessage", _, _, _, g_szB );
    
}

public reset_weapons(id){
    if(get_pcvar_num(pistolrounds)!=1){
        return PLUGIN_HANDLED
    }
    
    if(is_user_alive(id)){
        
        fm_strip_user_weapons(id);
        cs_set_user_money(id, 800, 0);
        fm_give_item(id, "weapon_knife");
        cs_set_user_armor(id, 0, CS_ARMOR_NONE);
        
        switch(get_user_team(id)){
            case CS_TEAM_T: 
            {
                fm_give_item(id, "weapon_glock18");
                cs_set_user_bpammo(id, CSW_GLOCK18, 40);
            }
            case CS_TEAM_CT: 
            {
                fm_give_item(id, "weapon_usp");
                cs_set_user_bpammo(id, CSW_USP, 24);
                cs_set_user_defuse(id, 0);
            }
        }
    }   
    return HAM_IGNORED;
}


public client_PreThink ( id )
{
    
    if ( gb_Freezed )
    {  
        server_cmd( "mp_freezetime 99999" );
    }
    
    return PLUGIN_CONTINUE;
}

public ShowMessage( )
{
    
    set_dhudmessage( 0, 255, 0, -0.58, 0.01, 2 , 6.0, 8.0 )
    show_dhudmessage(0, "CT:")
    set_dhudmessage( 255, 0, 255, -0.55, 0.01, 2 , 6.0, 8.0 )
    show_dhudmessage(0, "%d",RoundsWon[ CS_TEAM_CT ])
    set_dhudmessage( 255, 0, 0, -1.0, 0.01, 2 , 6.0, 8.0 )
    show_dhudmessage(0, "<-->")
    set_dhudmessage( 0, 255, 0, -0.47, 0.01, 2 , 6.0, 8.0 )
    show_dhudmessage(0, "Ts:")
    set_dhudmessage( 255, 0, 255, -0.44, 0.01, 2 , 6.0, 8.0 )
    show_dhudmessage(0, "%d",RoundsWon[ CS_TEAM_T ])
}

public plugin_precache()
{
    OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules"), "OnInstallGameRules_Post", OrpheuHookPost)
}

public OnInstallGameRules_Post()
{
    g_pGameRules = OrpheuGetReturn()
}

public SwapTeam()
{
    g_bSwapTeamsOnNextRound = true
    
    new swap_ct = RoundsWon[ CS_TEAM_CT ]
    new swap_t = RoundsWon[ CS_TEAM_T ]
    
    RoundsWon[ CS_TEAM_CT ] = swap_t
    RoundsWon[ CS_TEAM_T ] = swap_ct
    
    static red = 0       // Rosu
    static green = 255    // Verde
    static blue = 0   // Albastru
    set_dhudmessage( red, green, blue, 0.10, 0.24, 0, 6.0, 8.0 )
    show_dhudmessage(0, "Echipele se vor schimba runda urmatoare!")
    
    ColorChat(0, "!v[War] !eEchipele se vor schimba runda urmatoare!")
    ColorChat(0, "!v[War] !eEchipele se vor schimba runda urmatoare!")
    ColorChat(0, "!v[War] !eEchipele se vor schimba runda urmatoare!")
    ColorChat(0, "!v[War] !eEchipele se vor schimba runda urmatoare!")
    
}

public Event_HLTV_New_Round()
{
    if( g_bSwapTeamsOnNextRound )
    {
        g_bSwapTeamsOnNextRound = false
        OrpheuCall(g_OfSwapAllPlayers, g_pGameRules)
    }
}

public LogEvent_RoundStart( )
{
    // increment round counter
    CurrentRound++;
    
    // check if rounds == 15, if so, set last true (will be handled when round is won by a team)
    if( CurrentRound == 15 )
    {
        LastRound = true;
        server_cmd( "amx_pistolrounds 1" );
    }
    if( CurrentRound == 16 )
    {
        server_cmd( "amx_pistolrounds 0" );
    }
    
}

public Event_SendAudio_TWin( )
{
    // increment the team round counter for T team
    RoundsWon[ CS_TEAM_T ]++;
    
    // check if they have 16 rounds in the bag
    CheckWinner( CS_TEAM_T );
    
    // if it's the 15th round, reset the round counter, and swap team scores
    if( LastRound )
    {
        swichround();
    }
}

public resetare(id)
{
    
    // reset rounds for terrorists and cts
    for( new CsTeams:Team = CS_TEAM_T; Team <= CS_TEAM_CT; Team++ )
    {
        RoundsWon[ Team ] = 0;
    }
    
    
    // set round counter to 0
    CurrentRound = 0;
    
    // set last round false
    LastRound = false;
    
    gb_Freezed = false;
    
    server_cmd( "sv_restartround 1" );
    server_cmd( "mp_freezetime 5" );
    
    set_dhudmessage( 255, 0, 0, 0.10, 0.24, 0, 6.0, 8.0 )
    show_dhudmessage(0, "Scorul echipelor a fost resetat!")
    
    ColorChat(0, "!v[War] !eLive!")
    ColorChat(0, "!v[War] !eLive!")
    ColorChat(0, "!v[War] !eLive!")
    ColorChat(0, "!v[War] !eGl & Hf!")
}

public swichround()
{
    SwapTeam();
    LastRound = false;
}

public Event_SendAudio_CTWin()
{
    // increment the team round counter for CT team
    RoundsWon[ CS_TEAM_CT ]++;
    
    // check if they have 16 rounds in the bag
    CheckWinner( CS_TEAM_CT );
    
    // if it's the 15th round, reset the round counter, and swap team scores
    if( LastRound )
    {
        swichround();
    }
}

CheckWinner( CsTeams:Team ){
    // check if team has won 16 rounds
    static red = 255        // Rosu
    static green = 255    // Verde
    static blue = 255    // Albastru
    
    if (RoundsWon[ CS_TEAM_CT ] == 15 && RoundsWon[ CS_TEAM_T ] == 15 )
    {
        set_dhudmessage( red, green, blue, 0.10, 0.24, 0, 6.0, 8.0 )
        show_dhudmessage(0, "Remiza! Meciul s-a terminat.")
        
        ColorChat(0, "!v[War] !cRemiza! !eMeciul s-a terminat!")
        ColorChat(0, "!v[War] !cRemiza! !eMeciul s-a terminat!")
        ColorChat(0, "!v[War] !cRemiza! !eMeciul s-a terminat!")
        ColorChat(0, "!v[War] !cRemiza! !eMeciul s-a terminat!")
        
        gb_Freezed = true;
        
        LastRound = false;
    }
    
    else if( RoundsWon[ Team ] == 16 ){
        
        set_dhudmessage( red, green, blue, 0.10, 0.24, 0, 6.0, 8.0 )
        show_dhudmessage(0, "Echipa %s a castigat meciul, felicitari!", TeamNames[ Team ] )
        
        ColorChat(0, "!v[War] !cEchipa !e%s !ca castigat meciul, !vfelicitari!", TeamNames[ Team ])
        ColorChat(0, "!v[War] !cEchipa !e%s !ca castigat meciul, !vfelicitari!", TeamNames[ Team ])
        ColorChat(0, "!v[War] !cEchipa !e%s !ca castigat meciul, !vfelicitari!", TeamNames[ Team ])
        ColorChat(0, "!v[War] !cEchipa !e%s !ca castigat meciul, !vfelicitari!", TeamNames[ Team ])
        
        gb_Freezed = true;
        
        LastRound = false;
    }
    
}

stock ColorChat(const id, const intrare[], any:...) {
    new numar = 1, jucatori[32];
    
    static mesaj[191];
    vformat(mesaj, 190, intrare, 3);
    
    replace_all(mesaj, 190, "!v", "^x04");     /* culoarea verde                                */
    replace_all(mesaj, 190, "!c", "^x01");    /* culoarea chatului                             */
    replace_all(mesaj, 190, "!e", "^x03");   /* culoarea echipei ct = albastru | tero = rosie */
    replace_all(mesaj, 190, "!e2", "^x00"); /* culoarea normala a echipei                    */
    
    if(id)
        jucatori[0] = id;
    else
        
    get_players(jucatori, numar, "ch");
    
    for(new i = 0; i < numar; i++) {
        if(is_user_connected(jucatori[i])) {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, jucatori[i]);
            write_byte(jucatori[i]);
            write_string(mesaj);
            message_end();
        }
    }
}
Thanks for helping me and a happy new year to all!
__________________
I'm new here...

I'm not omniscient..

Last edited by emaya93; 12-31-2013 at 07:47.
emaya93 is offline
Biosek
Junior Member
Join Date: Mar 2013
Old 12-31-2013 , 23:35   Re: swap team
Reply With Quote #2

I have problem with InstallGameRules too.
I found this https://forums.alliedmods.net/showpo...9&postcount=34, but didn't tested yet. You have to remake signature for that orpheu function InstallGameRules
Biosek is offline
emaya93
Member
Join Date: Jun 2012
Old 01-04-2014 , 15:10   Re: swap team
Reply With Quote #3

Is unusefull nobody want to help us...
__________________
I'm new here...

I'm not omniscient..
emaya93 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 20:38.


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