10.03.2019, 12:35
Hello, so it seems to only send the proper string to ID 0. See screenshots below for the differences.
What ID 0 sees:
What ID 1 sees:
Does anyone know what the issue is? Please help.
Here is the code:
What ID 0 sees:
What ID 1 sees:
Does anyone know what the issue is? Please help.
Here is the code:
PHP Code:
stock SendSplitMessage(playerid, color, string[])
{
if(strlen(string) > 127)
{
new
string2[128],
splitpos;
for(new c = 128; c > 0; c--)
{
if(string[c] == ' ' || string[c] == ',' || string[c] == '.')
{
splitpos = c;
break;
}
}
strcat(string2, string[splitpos]);
string[splitpos] = EOS;
SendClientMessage(playerid, color, string);
format(string2, sizeof(string2), "-..%s", string2);
SendClientMessage(playerid, color, string2);
}
else SendClientMessage(playerid, color, string);
return 1;
}
stock ProxDetector(Float:radi, playerid, string[],color)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
foreach(new i:Player)
{
if(IsPlayerInRangeOfPoint(i,radi,x,y,z) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendSplitMessage(i,color,string);
}
}
}
forward ProxDetectorColor(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetectorColor(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
foreach(new i:Player)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendSplitMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendSplitMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendSplitMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendSplitMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendSplitMessage(i, col5, string);
}
}
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(!gamemodeLoaded)
{
SCM(playerid, COLOR_ERROR, "Please wait until the gamemode finishes loading.");
SCM(playerid, COLOR_SERVER, "Your request was not processed.");
return 0;
}
if(!LoggedIn[playerid] || Spawned[playerid] == 0)
{
SCM(playerid, COLOR_ERROR, "You are not logged in or have not spawned yet.");
SCM(playerid, COLOR_SERVER, "You must login and spawn first before your request can be processed.");
return 0;
}
new str[500];
if(AdminDuty[playerid] == 1)
{
format(str, sizeof(str), "(( %s %s(%i): %s ))",ReturnAdminLevel(playerid), ReturnICName(playerid), playerid, text);
ProxDetector(20.0, playerid, str, COLOR_ORANGE);
}
else if(DevDuty[playerid] == 1)
{
format(str, sizeof(str), "(( %s %s(%i): %s ))",ReturnDevLevel(playerid), ReturnICName(playerid), playerid, text);
ProxDetector(20.0, playerid, str, COLOR_DEV);
}
else
{
format(str, sizeof(str), "%s says: %s", ReturnICName(playerid), text);
ProxDetectorColor(20.0, playerid, str, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4, COLOR_GRAD5);
SetPlayerChatBubble(playerid, str, COLOR_CHAT, 30, 5000);
}
new query[300];
mysql_format(g_SQL, query, sizeof(query), "INSERT INTO logs_chat(acc_dbid, acc_name, playerid, time, text) VALUES('%i', '%e', '%i', UTC_TIMESTAMP(), '%e')", PlayerInfo[playerid][pDBID], ReturnName(playerid), playerid, text);
mysql_tquery(g_SQL, query);
return 0;
}
CMD:brackets(playerid, params[])
return cmd_b(playerid, params);
CMD:b(playerid, params[])
{
new str[500];
if(sscanf(params,"s[128]",str))
return SCM(playerid, COLOR_INFO, "/b(rackets) [message]");
format(str, sizeof(str), "(( %s(%i): %s ))", ReturnICName(playerid), playerid, str);
ProxDetector(20, playerid, str, COLOR_CHAT);
return 1;
}
CMD:whisper(playerid, params[])
return cmd_w(playerid, params);
CMD:w(playerid, params[])
{
new str[300],str2[300], str3[80], targetid, Float:x, Float:y, Float:z, world, world2;
if(sscanf(params,"us[128]",targetid, str2))
return SCM(playerid, COLOR_INFO, "/whisper [name/id] [message]");
if(!IsPlayerConnected(targetid))
return SCM(playerid, COLOR_ERROR, "That account is not connected.");
if(FirstSpawn[targetid])
return SCM(playerid, COLOR_ERROR, "That player has not logged in or spawned yet.");
if(targetid == playerid)
return SCM(playerid, COLOR_ERROR, "You can not use this command on yourself.");
GetPlayerPos(targetid, Float:x, Float:y, Float:z);
world = GetPlayerVirtualWorld(playerid);
world2 = GetPlayerVirtualWorld(targetid);
if (!IsPlayerInRangeOfPoint(playerid, 4.0, x, y, z))
return SCM(playerid, COLOR_ERROR, "That player is not nearby.");
if(world == world2)
{
format(str, sizeof(str), "Whisper to %s: %s", ReturnICName(targetid), str2);
SendSplitMessage(playerid, COLOR_YELLOW, str);
format(str, sizeof(str), "%s whispers: %s", ReturnICName(playerid), str2);
SendSplitMessage(targetid, COLOR_YELLOW, str);
format(str3, sizeof(str3), "%s mutters something to %s", ReturnICName(playerid), ReturnICName(targetid));
SetPlayerChatBubble(playerid, str3, COLOR_RP, 20.0, 3000);
}
else return SCM(playerid, COLOR_ERROR, "That player is not nearby.");
return 1;
}