Hey habe en Problem mit meinem Team chat! Hier der code
{
if (strcmp("/t", cmdtext, true, 10) == 0 || strcmp("/team", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
new idx, string[128];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "FEHLER: (/t)eam [Nachricht]");
return 1;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(IsCounterTerrorist(playerid))
{
format(string, sizeof(string), "{0000FF}[{FFFFFF}TEAM{0000FF}] %s: {FFFFFF}%s",name, result);
SendCTMessage(COLOR_BLUE, string);
return 1;
}
else if(IsTerrorist(playerid))
{
format(string, sizeof(string), "{FF0000}[{FFFFFF}TEAM{FF0000}] %s: {FFFFFF}%s",name, result);
SendTMessage(COLOR_RED, string);
return 1;
}
}
}
und hier die stocks
stock SendCTMessage(farbe, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsCounterTerrorist(i))
{
SendClientMessage(i, farbe, string);
}
}
}
}
stock SendTMessage(farbe, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsTerrorist(i))
{
SendClientMessage(i, farbe, string);
}
}
}
}
Wenn ich jetzt /t mache steht da [TEAM] NAME /t
und nicht [TEAM] NAME NACHRICHT