/me (need help) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /me (need help) (
/showthread.php?tid=83504)
/me (need help) -
coole210 - 25.06.2009
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;
}
Re: /me (need help) -
zallomallo - 25.06.2009
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;
}
Re: /me (need help) -
coole210 - 25.06.2009
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
Re: /me (need help) -
Serediucr - 25.06.2009
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;
}
Re: /me (need help) -
coole210 - 25.06.2009
same errors
Re: /me (need help) -
Serediucr - 25.06.2009
for what you get his color
you don't change it , and you don't make anything with color! no sense!
Re: /me (need help) -
zallomallo - 25.06.2009
On top of page:
new TempColor[MAX_PLAYERS];