Alles anzeigenWarum mit ocmd?
Ich persönlich finde es so leichter:
//----------------------------------[ooc]-----------------------------------------------
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht eingelogt.");
return 1;
}
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Der OOC ist deaktiviert.");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Sie sind gemutet.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[200];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Benutze: (/o)oc [Text]");
return 1;
}
format(string, sizeof(string), "(( %s: %s ))", sendername, result);
OOCOff(COLOR_OOC,string);
printf("%s", string);
}
return 1;
}
if(strcmp(cmd, "/noooc", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1 && (!noooc))
{
noooc = 1;
format(string, sizeof(string), "Der OOC wurde von Admin %s(%d) deaktiviert.", sendername,playerid);
BroadCast(COLOR_LIGHTBLUE,string);
}
else if (PlayerInfo[playerid][pAdmin] >= 1 && (noooc))
{
noooc = 0;
format(string, sizeof(string), "Der OOC wurde von Admin %s(%d) aktiviert.", sendername,playerid);
BroadCast(COLOR_LIGHTBLUE, string);
}
}
return 1;
}
Genau, warum 19 Zeilen wenn man auch 65 haben kann