How it's made ?!
#1

Hi, I want to ask you how can I make when I or any player in my server log-in with rcon password to set before his name (Admin) in the chat.For an example: I enter the server with nickname x96664 and when I type /rcon login password and my name goes (Admin)x96664.
Reply
#2

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success) //If the password was correct
    {
        new originalname[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME]; //Creates the new variables
        GetPlayerName(playerid, originalname, sizeof(originalname)); //Gets current name
        format(string, sizeof(string), "(Admin)%s", originalname); //Adds (Admin) to the front of the name
        SetPlayerName(playerid, string); //Sets the name to the new name
    }
    return 1;
}
Untested, just an example.

Simply states that if the player attempts to log into rcon, and succeeds, it gets his current name and set's his name to (Admin), along with his originalname following it afterwards.

EDIT: Sorry, forgot there was no playerid parameter in here (they should have one)
Reply
#3

2 errors:
Код:
error 017: undefined symbol "playerid"
Reply
#4

Quote:
Originally Posted by Kindred
Посмотреть сообщение
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success) //If the password was correct
    {
        new originalname[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME]; //Creates the new variables
        GetPlayerName(playerid, originalname, sizeof(originalname)); //Gets current name
        format(string, sizeof(string), "(Admin)%s", originalname); //Adds (Admin) to the front of the name
        SetPlayerName(playerid, string); //Sets the name to the new name
    }
    return 1;
}
Untested, just an example.

Simply states that if the player attempts to log into rcon, and succeeds, it gets his current name and set's his name to (Admin), along with his originalname following it afterwards.
It don't works ...
Use GetPlayerIp
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        new VBIP[16];
        for(new v , b = GetMaxPlayers(); v != b; v++)
        {
            GetPlayerIp(v, VBIP, 16);
            if(!strcmp(VBIP, ip))
            {
                new VBName[MAX_PLAYER_NAME], VBNewname[MAX_PLAYER_NAME+7];
                GetPlayerName(v, VBName, MAX_PLAYER_NAME);
                format(VBNewname, sizeof(VBNewname), "(Admin)%s", VBName);
                SetPlayerName(v, VBNewname);
                break;
            }
        }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
It don't works ...
Use GetPlayerIp
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        new VBIP[16];
        for(new v , b = GetMaxPlayers(); v != b; v++)
        {
            GetPlayerIp(v, VBIP, 16);
            if(!strcmp(VBIP, ip))
            {
                new VBName[MAX_PLAYER_NAME], VBNewname[MAX_PLAYER_NAME+7];
                GetPlayerName(v, VBName, MAX_PLAYER_NAME);
                format(VBNewname, sizeof(VBNewname), "(Admin)%s", VBName);
                SetPlayerName(v, VBNewname);
                break;
            }
        }
    }
    return 1;
}
Thank you, your one is wotking!
Reply
#6

How can I make the text "Admin" without the bracets to be in blue ? Using this color {2817E3} .
Reply
#7

pawn Код:
#include a_samp
public OnPlayerText(playerid, text[])
{
new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    if(IsPlayerAdmin(playerid))
    {
        format(string,sizeof string,"{2817E3}(Admin){FFFFFF}%s:%s",pName,text);

SendClientMessageToAll(-1,string);
    }
    return 1;
}
sorry for it being so messy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)