AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help mode CT Rounds (https://forums.alliedmods.net/showthread.php?t=187505)

addons47 06-14-2012 04:36

Help mode CT Rounds
 
Hello everyone,

I have CT Mod Rounds and I can not add /round name Small Description: cute examines several rounds City resides.

Code:

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
 
 
new CTRounds[ 33 ];
 
 
public plugin_init()
{
        register_plugin( "15 CT Rounds", "1.0", "ImNativus" );
     
        register_event( "SendAudio", "EventTeamWin", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2&%!MRAD_ROUNDDRAW" );
     
        RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawn", 1 );
}
 
 
public FwdPlayerSpawn( client )
{
        if ( !is_user_connected( client ) || !is_user_alive( client ) )
                return;
     
        if ( cs_get_user_team( client ) == CS_TEAM_CT )
        {
                if ( CTRounds[ client ] + 1 <= 15 )
                {
                        client_print( client, print_chat, "Its your %d/15 Rounds at CT", CTRounds[ client ] + 1 );
                }
             
                else
                {
                        cs_set_user_team( client, CS_TEAM_T );
                     
                        ExecuteHamB( Ham_CS_RoundRespawn, client );
                }
        }
     
        else
        {
                CTRounds[ client ] = 0;
        }
}
 
 
public EventTeamWin( )
{
        for ( new i = 1; i <= get_maxplayers(); i++ )
        {
                if ( !is_user_connected( i ) || cs_get_user_team( i ) != CS_TEAM_CT )
                        continue;
             
                CTRounds[ i ]++;
        }
}


hornet 06-14-2012 08:25

Re: Help mode CT Rounds
 
Say what?

Are you trying to say that you want a say command - /round to show the number of rounds the CT side has won?

... get your request translated.

addons47 06-14-2012 08:35

Re: Help mode CT Rounds
 
/round name - I want it to show me a few rounds of CT in 15 limit.

hornet 06-14-2012 09:34

Re: Help mode CT Rounds
 
Do you mean like this?
Code:
//in plugin_init()     register_clcmd( "say /round", "Cmd_Round" ); // public Cmd_Round( id ) {     new szArg[ 32 ];     read_argv( 1, szArg, charsmax( szArg ) );         new iTarget = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );         if( iTarget )     {         get_user_name( iTarget, szArg, charsmax( szArg ) );         client_print( id, print_chat, "Player %s has played CT for %i / 15 rounds", szArg, CTRounds[ iTarget ] );     }     else     {         client_print( id, print_chat, "Player not found" );     } }

addons47 06-14-2012 09:55

Re: Help mode CT Rounds
 
Yes, thank you.

Exolent[jNr] 06-14-2012 10:15

Re: Help mode CT Rounds
 
Quote:

Originally Posted by hornet (Post 1728570)
Do you mean like this?
Code:
//in plugin_init()     register_clcmd( "say /round", "Cmd_Round" ); // public Cmd_Round( id ) {     new szArg[ 32 ];     read_argv( 1, szArg, charsmax( szArg ) );         new iTarget = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );         if( iTarget )     {         get_user_name( iTarget, szArg, charsmax( szArg ) );         client_print( id, print_chat, "Player %s has played CT for %i / 15 rounds", szArg, CTRounds[ iTarget ] );     }     else     {         client_print( id, print_chat, "Player not found" );     } }

That's not how you use say command arguments, therefore will not work.

hornet 06-14-2012 19:35

Re: Help mode CT Rounds
 
Quote:

Originally Posted by Exolent[jNr] (Post 1728594)
That's not how you use say command arguments, therefore will not work.

Oops sorry, didn't think of that.


Use this instead:
Code:
// plugin_init()     register_clcmd( "say", "Cmd_Say" );     register_clcmd( "say_team", "Cmd_Say" );         // public Cmd_Say( id ) {     static szArgs[ 64 ], szArg[ 2 ][ 32 ];     read_args( szArgs, charsmax( szArgs ) );     remove_quotes( szArgs );         parse( szArgs, szArg[ 0 ], charsmax( szArg[] ), szArg[ 1 ], charsmax( szArg[] ) );         if( equal( szArg[ 0 ], "/round" ) )     {         new iTarget = cmd_target( id, szArg[ 1 ], CMDTARGET_ALLOW_SELF );             if( iTarget )         {             get_user_name( iTarget, szArg[ 1 ], charsmax( szArg[] ) );             client_print( id, print_chat, "Player %s has played CT for %i / 15 rounds", szArg[ 1 ], CTRounds[ iTarget ] );         }         else         {             client_print( id, print_chat, "Player not found" );         }                 return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; }

Also don't forget to include amxmisc.


All times are GMT -4. The time now is 06:17.

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