Hallo, immer wenn ich etwas schreibe wird es irgendwie 1000x gesendet (Also chat wird vollgespamt...)
Mein Code unter OnPlayerText
public OnPlayerText(playerid, text[])
{
new string[256],pname[16],string2[256];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"%s sagt: %s",pname,text);
format(string2,sizeof(string2),"%s sagt: (Fremdsprache)",pname);
switch(Spieler[playerid][Sprache])
{
case 0:
{
for(new i; i<MAX_PLAYERS; i++)
{
if(Spieler[i][Sprache] == 0)
{
SendClientMessageR(playerid,Weiss,string,10.0);
}
if(Spieler[i][Sprache] != 0)
{
SendClientMessageR(playerid,Weiss,string2,10.0);
}
}
}
case 1:
{
for(new i; i<MAX_PLAYERS; i++)
{
if(Spieler[i][Sprache] == 1)
{
SendClientMessageR(playerid,Weiss,string,10.0);
}
if(Spieler[i][Sprache] != 1)
{
SendClientMessageR(playerid,Weiss,string2,10.0);
}
}
}
case 2:
{
for(new i; i<MAX_PLAYERS; i++)
{
if(Spieler[i][Sprache] == 2)
{
SendClientMessageR(playerid,Weiss,string,10.0);
}
if(Spieler[i][Sprache] != 2)
{
SendClientMessageR(playerid,Weiss,string2,10.0);
}
}
}
case 3:
{
for(new i; i<MAX_PLAYERS; i++)
{
if(Spieler[i][Sprache] == 3)
{
SendClientMessageR(playerid,Weiss,string,10.0);
}
if(Spieler[i][Sprache] != 3)
{
SendClientMessageR(playerid,Weiss,string2,10.0);
}
}
}
case 4:
{
for(new i; i<MAX_PLAYERS; i++)
{
if(Spieler[i][Sprache] == 4)
{
SendClientMessageR(playerid,Weiss,string,10.0);
}
if(Spieler[i][Sprache] != 4)
{
SendClientMessageR(playerid,Weiss,string2,10.0);
}
}
}
}
return 1;
}
MfG
Stock zu SendClientMessageR
stock SendClientMessageR(playerid,farbe,text[],Float:umkreis)
{
new Float:xm,Float:ym,Float:zm,maxplayers=GetMaxPlayers();
if(GetPlayerPos(playerid,xm,ym,zm))
{
for(new i=0;i<maxplayers;i++)
if(IsPlayerConnected(i) && (i==playerid || IsPlayerInRangeOfPoint(i,umkreis,xm,ym,zm)))
SendClientMessage(i,farbe,text);
return 1;
}
return 0;
}