if(strcmp(cmd, "//", true) == 0 || strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "@", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Usage: // [chat message], @ [chat message] or /admin [chat message]");
return 1;
}
new arank[64];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Junior Mod"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Moderator"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Senior Mod"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Junior Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 5) { arank = "Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 6) { arank = "Senior Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Owner"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Owner"; } //By: Nick Piccoli
else { arank = "Unknown"; }
format(string, sizeof(string), " [%s] %s (%d): %s", arank, sendername, playerid, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Admin %s: %s",d,m,y,h,mi,s,sendername, result);
AdminChatLog(string);
}
return 1;
}
if(strcmp(cmd, "///", true) == 0 || strcmp(cmd, "/tester", true) == 0 || strcmp(cmd, "#", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pTester] >= 1 )
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Usage: /// [chat message], # [chat message] or /tester [chat message]");
return 1;
}
new arank[64];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Junior Mod"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Moderator"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Senior Mod"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Junior Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 5) { arank = "Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 6) { arank = "Senior Admin"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Owner"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Owner"; } //By: Nick Piccoli
else if(PlayerInfo[playerid][pTester] == 3) { arank = "Lead Tester"; }
else if(PlayerInfo[playerid][pTester] == 2) { arank = "Tester"; }
else if(PlayerInfo[playerid][pTester] == 1) { arank = "Junior Tester"; }
else { arank = "Unknown"; }
format(string, sizeof(string), " [%s] %s (%d): %s", arank, sendername, playerid, result);
SendTesterAdminMessage(COLOR_YELLOW, string);
printf("Tester %s: %s", sendername, result);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Tester %s: %s",d,m,y,h,mi,s,sendername, result);
AdminChatLog(string);
}
}
return 1;
}
@[message] or #[message]
Originally Posted by Joe Staff
Because commands require a '/' in front of them, and if you only type @ or # then clearly you're not typing a command... think about it.
|
Originally Posted by Simon
No, they use OnPlayerText then check "if (text[0] == '@' || text[0] == '#')"
|
//Admin Chat
if((text[0] == '#' || text[0] == '@') && admin_check && strlen(text) > 1)
{
format(string,sizeof(string),"[ADMIN] %s (%i): %s",pName[playerid],playerid,text[1]);
for(new i = 0; i < MAX_PLAY; i++)
{
if(admin_check) SendClientMessageToPlayer(i,COLOR_PINK,string);
}
return 0;
}
Originally Posted by Mikep.
pawn Код:
|