AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Reliable Channel/Remove Nick (https://forums.alliedmods.net/showthread.php?t=224327)

extream87 08-22-2013 18:41

Reliable Channel/Remove Nick
 
Bellow is not the full code, but serves for what i want explain.

I want remove from the admins name g_Teamscore[nCT], g_Teamscore[nT] when the map change.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" #define ACCESS_LEVEL ADMIN_LEVEL_C new pname[100] new stname[100] new newname[70] new bool:bl new g_pSwitchAfter public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_logevent( "LogeventEndRound", 2, "1=Round_End" )     register_clcmd("say .uname15555555u", "name15", ACCESS_LEVEL)     register_clcmd("say .uname15555555us", "name15end", ACCESS_LEVEL)     register_clcmd("say .d2", "d2", ACCESS_LEVEL)     g_pSwitchAfter = register_cvar( "amx_swap", "1" );     register_clcmd("say .live", "live", ACCESS_LEVEL) } public LogeventEndRound(id) {           if (bl == true)     {     if( ++g_iRounds >= 2 && get_pcvar_num ( g_pSwitchAfter ))     {     client_cmd(0,"say .uname15555555u")     new iPlayers[ 32 ], iNum, iPlayer     get_players( iPlayers, iNum )             for ( new a = 0; a < iNum; a++ )     {             iPlayer = iPlayers[ a ];                         switch ( cs_get_user_team( iPlayer ) )             {                 case CS_TEAM_T: cs_set_user_team( iPlayer, CS_TEAM_CT )                 case CS_TEAM_CT: cs_set_user_team( iPlayer, CS_TEAM_T )             }         }     }     } } public live(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {         bl = true     } } public d2(id) {     name15end(id)     server_cmd( "changelevel de_dust2" ) } public name15(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {     get_user_info(id, "name", pname, 49)     get_user_info(id, "name", stname, 49)         format(newname, 300, "%s %d-%d", pname, g_Teamscore[nCT], g_Teamscore[nT])     set_user_info(id, "name", newname)     } } public name15end(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {       set_user_info(id, "name", stname)     } } public client_disconnect(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {     name15end(id)     } }

Blizzard_87 08-22-2013 20:39

Re: Reliable Channel/Remove Nick
 
simply removing the score from name...

Code:
public name15(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {     get_user_info(id, "name", pname, 49)     get_user_info(id, "name", stname, 49)         format(newname, 300, "%s", pname)     set_user_info(id, "name", newname)     } }

but then there is no reason for function name15( id ) or name15end( id )

extream87 08-22-2013 20:44

Re: Reliable Channel/Remove Nick
 
But i need to set the score in name cause im gonna use if round=15 the teams change and i want set the score in the admin names.
(This case is not seted to 15 is seted 2)

Blizzard_87 08-22-2013 20:58

Re: Reliable Channel/Remove Nick
 
Quote:

Originally Posted by extream87 (Post 2019793)
But i need to set the score in name cause im gonna use if round=15 the teams change and i want set the score in the admin names.
(This case is not seted to 15 is seted 2)

no idea what your on about...

but try this

Code:
    if( ++g_iRounds >= 2 && get_pcvar_num ( g_pSwitchAfter ))

to this

Code:
    if( ++g_iRounds >= 15 && get_pcvar_num ( g_pSwitchAfter ))

extream87 08-22-2013 21:09

Re: Reliable Channel/Remove Nick
 
LOL.

Well, this set the name+score.
Code:
public name15(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {     get_user_info(id, "name", pname, 49)     get_user_info(id, "name", stname, 49)         format(newname, 300, "%s %d-%d", pname, g_Teamscore[nCT], g_Teamscore[nT])     set_user_info(id, "name", newname)     } }

And for put again the normal nick without score?

Blizzard_87 08-22-2013 21:26

Re: Reliable Channel/Remove Nick
 
this function already resets player( admins ) name
Code:
public name15end(id) {     if (get_user_flags(id) & ACCESS_LEVEL)     {       set_user_info(id, "name", stname)     } }

but i dont know why your variable string length is 100... players name can only go as long as 32 characters

ConnorMcLeod 08-23-2013 00:58

Re: Reliable Channel/Remove Nick
 
Try this

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define ACCESS_LEVEL ADMIN_LEVEL_C

new pname[32][32
new 
stname[32][32
new 
newname[32][40]
new 
bool:bl
new g_pSwitchAfter
new g_iRounds
new maxplayers

enum
{
    
nT,
    
nCT
}

new 
g_Teamscore[2]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_logevent"LogeventEndRound"2"1=Round_End" 
    
register_clcmd("say .uname15555555u""name15"ACCESS_LEVEL)
    
register_clcmd("say .uname15555555us""name15end"ACCESS_LEVEL)
    
register_clcmd("say .d2""d2"ACCESS_LEVEL)
    
g_pSwitchAfter register_cvar"amx_swap""1" );
    
register_clcmd("say .live""live"ACCESS_LEVEL)
    
maxplayers get_maxplayers()
}

public 
LogeventEndRound(id)
{      
    if (
bl == true)
    {
        if( ++
g_iRounds >= 15 && get_pcvar_num g_pSwitchAfter ))
        {

            new 
iPlayers32 ], iNumiPlayer
            get_players
iPlayersiNum "h" )
                
            for ( new 
0iNuma++ )
            {
                
iPlayer iPlayers];

                
name15iPlayerACCESS_LEVEL );
                switch ( 
cs_get_user_teamiPlayer ) )
                {
                    case 
CS_TEAM_Tcs_set_user_teamiPlayerCS_TEAM_CT )
                    case 
CS_TEAM_CTcs_set_user_teamiPlayerCS_TEAM_T )
                }
            }
        }
    }
}

public 
live(idlevel)
{
    if( 
access(idlevel) )
    {
        
bl true
        g_iRounds 
0
    
}
}

public 
d2(idlevel)
{
    if( 
access(idlevel) )
    {
        
name15end(idlevel)
        
server_cmd"changelevel de_dust2" )
    }
}

public 
name15(idlevel)
{
    if( 
access(idlevel) )
    {
        
get_user_info(id"name"pname[id], charsmax(pname[]))
        
get_user_info(id"name"stname[id], charsmax(stname[]))
        
        
formatex(newname[id], charsmax(newname[]), "%s %d-%d"pname[id], g_Teamscore[nCT], g_Teamscore[nT])
        
set_user_info(id"name"newname[id])
    }


public 
name15end(idlevel)
{
    if( 
access(idlevel) )
    {  
        
set_user_info(id"name"stname[id])
    }
}

public 
plugin_end()
{
    for(new 
id=1id<=maxplayersid++)
    {
        if( 
pev_valid(id) == )
        {
            
engfunc(EngFunc_SetClientKeyValueidengfunc(EngFunc_GetInfoKeyBufferid), "name"stname[id])
        }
    }
}

// THIS IS USELESS
// public client_disconnect(id) 
// {
    // if (get_user_flags(id) & ACCESS_LEVEL)
    // {
        // name15end(id)
    // }
// } 


extream87 08-23-2013 06:57

Re: Reliable Channel/Remove Nick
 
ConnorMcLeod i really aprecciate your help thanks :).

Can you tell me one more thing plz. After change teams in 15 rounds how i can set the value of g_Teamscore[nCT], g_Teamscore[nT]) to g_Teamscore2[nCT], g_Teamscore2[nT]) to continue count in secont part?

Next im gonna try to do: if g_Teamscore2[nCT] = 16 chat_print... CT Team Win the match.

ConnorMcLeod 08-23-2013 11:16

Re: Reliable Channel/Remove Nick
 
You are asking for really basic stuff, if you don't know basic stuff, learn more and ask for people to make full plugins, in suggestion/request forum.

seriousspot 08-23-2013 21:00

Re: Reliable Channel/Remove Nick
 
its slowhacking method, why just don't display score instead of changing client's name with score?


All times are GMT -4. The time now is 18:47.

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