When admin talks
#1

Okay well i got a homemade Adminduty command BUT now i want that if player is ON adminduty
It talks like this:
Admin [NAME]: blalbabalbalbablabal

Example taken from /asay
pawn Код:
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /asay [text]");
        new string[128]; format(string, sizeof(string), "**Admin %s: %s", PlayerName2(playerid), params[0] );
        return SendClientMessageToAll(COLOR_PINK,string);
Reply
#2

Код:
public OnPlayerText(playerid, text[])
{
	if(PlayerInfo[playerid][pAdminDuty] == 1)
	{
	 	new string[128], name[MAX_PLAYER_NAME];
	 	GetPlayerName(playerid, name, sizeof(name));
	 	format(string, sizeof(string), "Admin %d: %d",name,text);
	 	SendClientMessageToAll(COLOR_PINK, string);
	 	return 0;
	}
	return 1;
}
This should give you a idea on how to do it.

Plrease note, the 'return 0' is there to top the message being send twice.
Reply
#3

I get a bunch of errors than
I use Ladmin btw.
Reply
#4

I will check the code of Ladmin and try to come up with something.
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 1)
    {
        new string[128], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Admin %s: %d",name,text);
        SendClientMessageToAll(COLOR_PINK, string);
        return 0;
    }
    return 1;
}
Make sure "PlayerInfo[playerid][pAdminDuty]" is the correct variable.

Also, Zaila, your post has a string formatted as an integer.

pawn Код:
format(string, sizeof(string), "Admin %d: %d",name,text);
Should be format(string, sizeof(string), "Admin %s: %d",name,text);
Reply
#6

My bad there, a spelling mistake since i never actually tried the code / checked it through properly after i was done.

Anyway, if i was looking into the right filterscript, this code should be working properly.

Код:
public OnPlayerText(playerid, text[])
{
	new string[128],name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
    if(AccInfo[playerid][OnDuty] == 1)
    {
		format(string, sizeof(string), "Admin %s: %s",name,text)
		SendClientMessageToAll(COLOR_PINK);
		return 0;
	}
	return 1;
}
Reply
#7

Look example that is really messy it has to be like this

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '.' && PlayerInfo[playerid][Level] >= 2) {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[A.CHAT]: %s: %s",string,text[1]); MessageToAdmins(0x800080AA,string);
        return 0;
    }
Reply
#8

I don't know what you mean by your post. Whatever you mean, you're saving the player's name to string then formatting string with string included. Is that intentional? (new string[128]; GetPlayerName(playerid,string,sizeof(string));)
Reply
#9

I just get bunches of errors than
Reply
#10

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 1) {
        new string[128], name[24];
        GetPlayerName(playerid, name, sizeof name);
        format(string, sizeof string, "**Admin %s: %s",name,text);
        SendClientMessageToAll(-1, string);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)