Abend Brotfische,
Mein Server crasht sobald man eine Textnaricht im Chat schreibt.
public OnPlayerText(playerid, text[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new string[150];
if(supduty[playerid]==1)
{
format(string,sizeof(string), "{C800FF}%s: {FFFFFF}%s",getPlayerName(playerid), text);
}
else
{
format(string,sizeof(string), "%s: %s",getPlayerName(playerid), text);
}
if(supduty[playerid]==1)
{
format(string,sizeof(string), "{C800FF}%s: {FFFFFF}%s",getPlayerName(playerid), text);
}
else
{
format(string,sizeof(string), "%s: %s",getPlayerName(playerid), text);
}
new chat_color;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))continue;
if(!IsPlayerInRangeOfPoint(i, CHAT_RADIUS, x, y, z))continue;
if(GetPlayerVirtualWorld(i)!=GetPlayerVirtualWorld(playerid)) continue;
new Float:distance = GetPlayerDistanceFromPoint(i, x, y, z);
if(distance < CHAT_RADIUS / CHAT_FADES)
{
chat_color = COLOR_CHAT;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 2)
{
chat_color = COLOR_FADE1;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 3)
{
chat_color = COLOR_FADE2;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 4)
{
chat_color = COLOR_FADE3;
}
else if(distance <= CHAT_RADIUS / CHAT_FADES * 5)
{
chat_color = COLOR_FADE4;
}
SendClientMessage(i, chat_color, string);
}
ChatLog(playerid, text);
SetPlayerChatBubble(playerid,text,C_Weiß, 100.0, 10000);
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Length = strlen(text);
new aTime = Length*400;
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,1,1,1,0,aTime);
}
return 0;
}
{
if(!IsPlayerConnected(i))continue;
if(!IsPlayerInRangeOfPoint(i, CHAT_RADIUS, x, y, z))continue;
if(GetPlayerVirtualWorld(i)!=GetPlayerVirtualWorld(playerid)) continue;
new Float:distance = GetPlayerDistanceFromPoint(i, x, y, z);
if(distance < CHAT_RADIUS / CHAT_FADES)
{
chat_color = COLOR_CHAT;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 2)
{
chat_color = COLOR_FADE1;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 3)
{
chat_color = COLOR_FADE2;
}
else if(distance < CHAT_RADIUS / CHAT_FADES * 4)
{
chat_color = COLOR_FADE3;
}
else if(distance <= CHAT_RADIUS / CHAT_FADES * 5)
{
chat_color = COLOR_FADE4;
}
SendClientMessage(i, chat_color, string);
}
ChatLog(playerid, text);
SetPlayerChatBubble(playerid,text,C_Weiß, 100.0, 10000);
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Length = strlen(text);
new aTime = Length*400;
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,1,1,1,0,aTime);
}
return 0;
}
stock ChatLog(playerid, text[])
{
new
File:lFile = fopen("scriptfiles/Logs/ChatLog.txt", io_append),
logData[178],fyear, fmonth, fday,fhour, fminute, fsecond;
getdate(fyear, fmonth, fday);
gettime(fhour, fminute, fsecond);
format(logData, sizeof(logData),"[%02d/%02d/%04d | %02d:%02d:%02d] %s: %s \r\n", fday, fmonth, fyear, fhour, fminute, fsecond, getPlayerName(playerid), text);
fwrite(lFile, logData);
fclose(lFile);
return 1;
}
{
new
File:lFile = fopen("scriptfiles/Logs/ChatLog.txt", io_append),
logData[178],fyear, fmonth, fday,fhour, fminute, fsecond;
getdate(fyear, fmonth, fday);
gettime(fhour, fminute, fsecond);
format(logData, sizeof(logData),"[%02d/%02d/%04d | %02d:%02d:%02d] %s: %s \r\n", fday, fmonth, fyear, fhour, fminute, fsecond, getPlayerName(playerid), text);
fwrite(lFile, logData);
fclose(lFile);
return 1;
}
MfG