25.03.2014, 21:38
The system below is to allow admins talk OOC locally, but my problem is that it wont continue on the next line after the maximum characters. It works when sending a message below 120 characters, but after that it sends nothing but a "(( [0] Sean_Mcelholm: ... ))" message.
pawn Код:
public AdminOOC(Float:radi, playerid, params[])
{
if(DebugEnabled == 1) { printf("DEBUG: AdminOOC(%f, %d, %s)", radi, playerid, params); }
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
new string[256];
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
foreach(new i : Player)
{
if(GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(i)) continue;
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
new playerworld, player2world;
playerworld = GetPlayerVirtualWorld(playerid);
player2world = GetPlayerVirtualWorld(i);
if(playerworld == player2world)
{
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
if(strlen(params) > 120)
{
new pos = 120;
while(params[--pos] > ' ') {}
if(pos < 120-1) pos = 120;
format(string, sizeof(string), "(( [%d] {FF9900}%s{E6E6E6}: %.*s ... ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE1, string);
format(string, sizeof(string), "(( [%d] {FF9900}%s{E6E6E6}: ... %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE1, string);
}
else
{
format(string, sizeof(string), "(( [%d] {FF9900}%s{E6E6E6}: %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE1, string);
}
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
if(strlen(params) > 120)
{
new pos = 120;
while(params[--pos] > ' ') {}
if(pos < 120-1) pos = 120;
format(string, sizeof(string), "(( [%d] {FF9900}%s{C8C8C8}: %.*s ... ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE2, string);
format(string, sizeof(string), "(( [%d] {FF9900}%s{C8C8C8}: ... %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE2, string);
}
else
{
format(string, sizeof(string), "(( [%d] {FF9900}%s{C8C8C8}: %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE2, string);
}
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
if(strlen(params) > 120)
{
new pos = 120;
while(params[--pos] > ' ') {}
if(pos < 120-1) pos = 120;
format(string, sizeof(string), "(( [%d] {FF9900}%s{AAAAAA}: %.*s ... ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE3, string);
format(string, sizeof(string), "(( [%d] {FF9900}%s{AAAAAA}: ... %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE3, string);
}
else
{
format(string, sizeof(string), "(( [%d] {FF9900}%s{AAAAAA}: %s ))", playerid, GetNameEx(playerid), params);
BigMessage(i, COLOR_FADE3, string);
}
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
if(strlen(params) > 120)
{
new pos = 120;
while(params[--pos] > ' ') {}
if(pos < 120-1) pos = 120;
format(string, sizeof(string), "(( [%d] {FF9900}%s{8C8C8C}: %.*s ... ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE4, string);
format(string, sizeof(string), "(( [%d] {FF9900}%s{8C8C8C}: ... %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE4, string);
}
else
{
format(string, sizeof(string), "(( [%d] {FF9900}%s{8C8C8C}: %s ))", playerid, GetNameEx(playerid), params);
BigMessage(i, COLOR_FADE4, string);
}
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
if(strlen(params) > 120)
{
new pos = 120;
while(params[--pos] > ' ') {}
if(pos < 120-1) pos = 120;
format(string, sizeof(string), "(( [%d] {FF9900}%s{6E6E6E}: %.*s ... ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE5, string);
format(string, sizeof(string), "(( [%d] {FF9900}%s{6E6E6E}: ... %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE5, string);
}
else
{
format(string, sizeof(string), "(( [%d] {FF9900}%s{6E6E6E}: %s ))", playerid, GetNameEx(playerid), params);
SendClientMessage(i, COLOR_FADE5, string);
}
}
}
}
}
return 1;
}