06.07.2018, 17:28
I typed a long line of text on the chat and it crashed the server.
What seems to be the problem here?
PHP код:
[01:19:02] [debug] AMX backtrace:
[01:19:02] [debug] #0 0000006d in ?? (... <8 arguments>) at <unknown file>:0
[01:19:02] [debug] #1 0000006d in public OnPlayerText () at <unknown file>:0
PHP код:
public OnPlayerText(playerid, text[])
{
if (!PlayerData[playerid][pLogged] || !PlayerData[playerid][pCharacter] || PlayerData[playerid][pTutorial] > 0 || PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pHospital] != -1)
return false;
if (PlayerData[playerid][pNewsGuest] != INVALID_PLAYER_ID && GetFactionType(PlayerData[playerid][pNewsGuest]) == FACTION_NEWS) //&& IsPlayerInAnyVehicle(playerid) && IsNewsVehicle(GetPlayerVehicleID(playerid)))
{
foreach (new i : Player) if (!PlayerData[i][pDisableBC]) {
SendClientMessageEx(i, COLOR_LIGHTGREEN, "[NEWS] Guest %s: %s", ReturnName(playerid, 0), text);
}
return false;
}
else
{
new
targetid = PlayerData[playerid][pCallLine],
string[200];
new text1[128],
text2[128],
bubble[200];
strmid(text2, text, 90, 128);
strmid(text1, text, 0, 90);
if (!IsPlayerOnPhone(playerid))
{
if(strlen(text) > 90)
{
if (IsPlayerInAnyVehicle(playerid) && IsWindowedVehicle(GetPlayerVehicleID(playerid)) && !CoreVehicles[GetPlayerVehicleID(playerid)][vehWindowsDown])
{
format(string, sizeof(string), "(vehicle) %s says: %s...", ReturnName(playerid, 0), text1);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
format(string, sizeof(string), "..%s", ReturnName(playerid, 0), text2);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
//SetPlayerChatBubble(playerid, string, COLOR_WHITE, 50, 5000);
}
else
{
if (!PlayerData[playerid][pInjured] && !PlayerData[playerid][pLoopAnim])
{
switch (random(6))
{
case 0: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkA", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 1: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkB", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 2: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkE", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 3: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkF", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 4: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkG", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 5: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkH", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
}
SetTimerEx("StopChatting", strlen(text) * 100, false, "d", playerid);
}
format(string, 128, "%s says: %s...", ReturnName(playerid, 0), text1);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
format(string, 128, "..%s", text2);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
//SetPlayerChatBubble(playerid, string, COLOR_WHITE, 50, 5000);
}
return false;
}
else
{
if (IsPlayerInAnyVehicle(playerid) && IsWindowedVehicle(GetPlayerVehicleID(playerid)) && !CoreVehicles[GetPlayerVehicleID(playerid)][vehWindowsDown])
{
format(string, sizeof(string), "(vehicle) %s says: %s", ReturnName(playerid, 0), text);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
format(bubble, sizeof(bubble), "(vehicle) %s", text);
SetPlayerChatBubble(playerid, bubble, COLOR_WHITE, 50, 5000);
}
else
{
if (!PlayerData[playerid][pInjured] && !PlayerData[playerid][pLoopAnim])
{
switch (random(6))
{
case 0: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkA", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 1: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkB", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 2: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkE", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 3: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkF", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 4: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkG", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 5: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkH", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
}
SetTimerEx("StopChatting", strlen(text) * 100, false, "d", playerid);
}
format(string, sizeof string, "%s says: %s", ReturnName(playerid, 0), text);
ProxDetector(25.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
format(bubble, sizeof(bubble), "%s", text);
SetPlayerChatBubble(playerid, bubble, COLOR_WHITE, 50, 5000);
}
return false;
}
}