AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] get_user_name probleme (https://forums.alliedmods.net/showthread.php?t=276837)

Old.School 12-28-2015 21:05

[HELP] get_user_name probleme
 
get_user_name(id, iTarget, charsmax(iTarget)); not work the player name is not logged how he must be ?

PHP Code:

public Handle_BlockedGuardMenu(idiKey)
{
    switch(
iKey)
    {
        case 
8: return Show_BlockedGuardMenu(id, ++g_iMenuPosition[id]);
        case 
9: return Show_BlockedGuardMenu(id, --g_iMenuPosition[id]);
        default:
        {
            new 
iTarget g_iMenuPlayers[id][g_iMenuPosition[id] * PLAYERS_PER_PAGE iKey];
            new 
szName[2][32];
            
get_user_name(idszName[0], charsmax(szName[]));
            
get_user_name(idiTargetcharsmax(iTarget));
            if(
IsSetBit(g_iBitUserBlockedGuardiTarget)) ClearBit(g_iBitUserBlockedGuardiTarget);
            else if(
IsSetBit(g_iBitUserConnectedid))
            {
                if(
g_iUserTeam[iTarget] == 2jbe_set_user_team(iTarget1);
                
SetBit(g_iBitUserBlockedGuardiTarget);
                
            }
            
log_to_file(g_szLogFile"Admin '%s' banned '%s' From Guards Team "szName[0], iTarget);
        }
    }
    return 
Show_BlockedGuardMenu(idg_iMenuPosition[id]);



Bugsy 12-28-2015 21:19

Re: [HELP] get_user_name probleme
 
get_user_name( id , string , max characters )

You are specifying the user id twice: id, iTarget.

In
get_user_name(id, iTarget, charsmax(iTarget));
Replace iTarget with szName[ 1 ]

Same here: log_to_file(g_szLogFile, "Admin '%s' banned '%s' From Guards Team ", szName[0], iTarget);
iTarget should be szName[ 1 ]

Old.School 12-28-2015 21:32

Re: [HELP] get_user_name probleme
 
i cant cause i shoud use iTarget and if i replace all iTarget with szName[ 1 ] he going to faild erreur :
szName already defined

Bugsy 12-28-2015 21:42

Re: [HELP] get_user_name probleme
 
Dont re-define it, do this
PHP Code:

//Change
get_user_name(idiTargetcharsmax(iTarget)); 
//to
get_user_name(idszName[1], charsmax(charsmax(szName[])); 

//Change
log_to_file(g_szLogFile"Admin '%s' banned '%s' From Guards Team "szName[0], iTarget); 
//to
log_to_file(g_szLogFile"Admin '%s' banned '%s' From Guards Team "szName[0], szName]); 


fysiks 12-28-2015 21:43

Re: [HELP] get_user_name probleme
 
You should only be replacing it in the one function, not where it's defined.

Old.School 12-28-2015 21:48

Re: [HELP] get_user_name probleme
 
Bugsy u didn't understend if i do like you said he will not work cause the log must be : Admin 'name banned 'Player Name' From Guards Team and the player name will be from iTarget id not szName[1]

Bugsy 12-28-2015 21:52

Re: [HELP] get_user_name probleme
 
Give me an example of what you want the output to be.

Old.School 12-28-2015 22:05

Re: [HELP] get_user_name probleme
 
look Itarget = player from menu which is going to be shown and what i want is to make " banned '%s' From Guards Team" show the choosed player name from the menu

Bugsy 12-28-2015 22:07

Re: [HELP] get_user_name probleme
 
:roll:If iTarget is the chosen player id then that is what it will do. Are you trying what I am suggesting or are you assuming it does something else without testing first?

Old.School 12-28-2015 22:25

Re: [HELP] get_user_name probleme
 
when admin block another player from ct team
L 12/29/2015 - 04:22:38: Admin 'Killer' banned 'Killer' From Guards Team


All times are GMT -4. The time now is 09:32.

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