* ============================================================================ */
COMMAND:s(playerid,params[])
{
if(!Player[playerid][Authed]) return SendClientError(playerid, "You are not authed!");
if(!Player[playerid][Admin] && !Player[playerid][Helper]) return SendClientError(playerid,"You are not authorized to use this command!");
new message[164],string[200],string2[100];
if(sscanf(params, "s", message)) return SendClientUsage(playerid, "/s [message]");
IRC_GroupSay(Group, "#staff", sprintf("(Staff Chat) %s %s: %s ", getAdminName(playerid),RPName(playerid),message));
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(Player[i][Admin])
{
format(string,sizeof(string),"{FF0000}(Staff Chat) {D4D4D4}%s %s: {FFFFFF}%s",getAdminName(playerid),RPName(playerid),message);
SendClientMessage(i,-1,sprintf("%i",strlen(string)));
if(strlen(string) >= 97)
{
strmid(string2, string, 96, 256);
strdel(string, 96, 256);
SendClientMessage(i, -1, string);
SendClientMessage(i, -1, string2);
}
else SendClientMessage(i, -1, string);
}
else if(Player[i][Helper])
{
SendMessageToPlayer(i,-1,sprintf("{FF0000}(Staff Chat) {D4D4D4}%s %s: {FFFFFF}%s",getAdminName(playerid),RPName(playerid),message),110);
}
}
return 1;
}
/* ============================================================================= */
strmid(string2, string, 0, 96); // string2 contains everything from 0 to 96 character SendClientMessage(i, -1, string2); strmid(string2, string, 96, 256); // string2 now contains everything from 96 to 256. SendClientMessage(i, -1, string2);
Код:
strmid(string2, string, 0, 96); // string2 contains everything from 0 to 96 character SendClientMessage(i, -1, string2); strmid(string2, string, 96, 256); // string2 now contains everything from 96 to 256. SendClientMessage(i, -1, string2); |
forward SendClientMessageA(playerid,color,text[]); public SendClientMessageA(playerid,color,text[]) { new safetxt[400]; format(safetxt,sizeof(safetxt),"%s",text); if(strlen(safetxt) <= 99) { SendClientMessage(playerid,color,text); } else { new texts[128]; strmid(texts,safetxt,99,256); strins(safetxt, " ..", 99, 1); strdel(safetxt, 100, strlen(safetxt)); SendClientMessage(playerid,color,safetxt); SendClientMessage(playerid,color,texts); } }
This should help you out and relive the headache.
Код:
forward SendClientMessageA(playerid,color,text[]); public SendClientMessageA(playerid,color,text[]) { new safetxt[400]; format(safetxt,sizeof(safetxt),"%s",text); if(strlen(safetxt) <= 99) { SendClientMessage(playerid,color,text); } else { new texts[128]; strmid(texts,safetxt,99,256); strins(safetxt, " ..", 99, 1); strdel(safetxt, 100, strlen(safetxt)); SendClientMessage(playerid,color,safetxt); SendClientMessage(playerid,color,texts); } } |
The reason for that is because the whole "(Staff Chat) 1337 Administrator Test Eend: " is taking up 43 spaces in your limit of 128 characters in the messages, because the greatest length that any message can be in SA-MP Global Chat is 128 characters (I think). To view in the chat. So in order to fix your problem. I suggest re naming your Chat. So
(1337 Staff Chat): That will allow you to type more before it gets cut off. That's also why when creating a message to display on global chat you always allow no more than 128 characters; new string[128]; or string[50]; not string[503]; < 503 is completely unnecessary as you won't be able to use 503 characters in one line in SA-MP Global Chat. |