When admin talks [REP+++++++] -
Biess - 19.05.2012
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);
Re: When admin talks -
Zaila - 19.05.2012
Код:
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.
Re: When admin talks -
Biess - 19.05.2012
I get a bunch of errors than
I use Ladmin btw.
Re: When admin talks -
Zaila - 19.05.2012
I will check the code of Ladmin and try to come up with something.
Re: When admin talks -
[FMJ]PowerSurge - 19.05.2012
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);
Re: When admin talks -
Zaila - 19.05.2012
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;
}
Re: When admin talks -
Biess - 20.05.2012
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;
}
Re: When admin talks -
[FMJ]PowerSurge - 20.05.2012
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));)
Re: When admin talks -
Biess - 20.05.2012
I just get bunches of errors than
Re: When admin talks -
Snipa - 20.05.2012
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;
}