/me (need help)
#1

Okay i have this /me command

Код:
  if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(cmdtext[3] == 0) {
      SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
      return 1;
    }
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "[ ! ] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(COLOR_WHITE, str);
    return 1;
  }
But how to i send message to everybody in the players Team color? like if they are TEAM_CITIZEN they do /me in TEAM_CITIZEN_COLOR.

And how do i set somebody's color back to normal? I have this /adminonduty command it sets the admins color to ADMIN_RED and it says hes on duty but for /adminoffduty how do i make it so it sets the players color back? SCRIPT :

Код:
	if(strcmp(cmdtext, "/adminonduty", true) == 0) if(Admin[playerid] == 1)
	{
	format(tmp,sizeof(tmp),"Admin %s is now on duty.",Name(playerid));
	SendClientMessageToAll(COLOR_RED,tmp);
	return 1;
}
	if(strcmp(cmdtext, "/adminoffduty", true) == 0) if(Admin[playerid] == 1)
	{
	new COLOR[128];
	GetPlayerColor(COLOR,sizeof(COLOR));
	format(COLOR,sizeof(COLOR), COLOR);
	SetPlayerColor(playerid,COLOR);
	format(tmp,sizeof(tmp),"Admin %s is now off duty.",Name(playerid));
	SendClientMessageToAll(COLOR_RED,tmp);
	return 1;
}
Reply
#2

pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(cmdtext[3] == 0) {
      SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
      return 1;
    }
    new str[24];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "[ ! ] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 1;
  }
pawn Код:
if(strcmp(cmdtext, "/adminonduty", true) == 0) if(Admin[playerid] == 1)
    {
    TempColor[playerid] = GetPlayerColor(playerid);
    format(tmp,sizeof(tmp),"Admin %s is now on duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    SetPlayerColor(playerid, COLOR_RED);
    return 1;
}
    if(strcmp(cmdtext, "/adminoffduty", true) == 0) if(Admin[playerid] == 1)
    {
    SetPlayerColor(playerid,TempColor[playerid]);
    format(tmp,sizeof(tmp),"Admin %s is now off duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    return 1;
}
Reply
#3

Quote:
Originally Posted by zallomallo
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(cmdtext[3] == 0) {
      SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
      return 1;
    }
    new str[24];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "[ ! ] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 1;
  }
pawn Код:
if(strcmp(cmdtext, "/adminonduty", true) == 0) if(Admin[playerid] == 1)
    {
    TempColor[playerid] = GetPlayerColor(playerid);
    format(tmp,sizeof(tmp),"Admin %s is now on duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    SetPlayerColor(playerid, COLOR_RED);
    return 1;
}
    if(strcmp(cmdtext, "/adminoffduty", true) == 0) if(Admin[playerid] == 1)
    {
    SetPlayerColor(playerid,TempColor[playerid]);
    format(tmp,sizeof(tmp),"Admin %s is now off duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    return 1;
}
Ty the /me works but the adminonduty and off duty gives me 4 errors :

pawn Код:
(782) : error 017: undefined symbol "TempColor"
(782) : warning 215: expression has no effect
(782) : error 001: expected token: ";", but found "]"
(782) : error 029: invalid expression, assumed zero
(782) : fatal error 107: too many error messages on one line
Reply
#4

Quote:
Originally Posted by coole210
Quote:
Originally Posted by zallomallo
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(cmdtext[3] == 0) {
      SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
      return 1;
    }
    new str[24];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "[ ! ] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 1;
  }
pawn Код:
if(strcmp(cmdtext, "/adminonduty", true) == 0) if(Admin[playerid] == 1)
    {
    TempColor[playerid] = GetPlayerColor(playerid);
    format(tmp,sizeof(tmp),"Admin %s is now on duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    SetPlayerColor(playerid, COLOR_RED);
    return 1;
}
    if(strcmp(cmdtext, "/adminoffduty", true) == 0) if(Admin[playerid] == 1)
    {
    SetPlayerColor(playerid,TempColor[playerid]);
    format(tmp,sizeof(tmp),"Admin %s is now off duty.",Name(playerid));
    SendClientMessageToAll(COLOR_RED,tmp);
    return 1;
}
Ty the /me works but the adminonduty and off duty gives me 4 errors :

pawn Код:
(782) : error 017: undefined symbol "TempColor"
(782) : warning 215: expression has no effect
(782) : error 001: expected token: ";", but found "]"
(782) : error 029: invalid expression, assumed zero
(782) : fatal error 107: too many error messages on one line
Код:
	if(strcmp(cmdtext, "/adminoffduty", true) == 0) if(Admin[playerid] == 1)
	{
    TempColor[playerid] = GetPlayerColor(playerid);
	SetPlayerColor(playerid,TempColor[playerid]);
	format(tmp,sizeof(tmp),"Admin %s is now off duty.",Name(playerid));
	SendClientMessageToAll(COLOR_RED,tmp);
	return 1;
}
Reply
#5

same errors
Reply
#6

for what you get his color you don't change it , and you don't make anything with color! no sense!
Reply
#7

On top of page:

new TempColor[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)