Wie kann man den /d Chat vom Godfather nachbauen?
Ich hab das nun so:
if(strcmp(cmdtext, "/department", true) == 0 || strcmp(cmdtext, "/d", true) == 0)
{
/*
if(!strlen(strget(cmdtext,1))) return SendClientMessage(playerid, COLOR_RED, "Verwendung: (/d)epartments [text]");
{
new sendername[128], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
new result = strval(strget(cmdtext,1));*/
new length = strlen(cmdtext);
new idx;
new sendername[128], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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, "Verwendung: (/d)epartments [text]");
return 1;
}
if(pInfo[playerid][gTeam] == SAPD || pInfo[playerid][gLeader] == SAPD)
{
if(pInfo[playerid][fRank] == 6) { format(string, sizeof(string), "** Chief %s: %s, over. **", sendername, result); }
else if(pInfo[playerid][fRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
else if(pInfo[playerid][fRank] == 4) { format(string, sizeof(string), "** Leutnant %s: %s, over. **", sendername, result); }
else if(pInfo[playerid][fRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
else if(pInfo[playerid][fRank] == 2) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
else if(pInfo[playerid][fRank] == 1) { format(string, sizeof(string), "** Cadet %s: %s, over. **", sendername, result); }
else
{
format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result);
}
}
SendTeamMessage(2, COLOR_ALLDEPT, string);
SendTeamMessage(1, COLOR_ALLDEPT, string);
printf("%s", string);
//}
return 1;
}
Bei:
/d - Keine Ausgabe
/department - Keine Ausgabe
/d Test - Den Befehl kenn ich nicht
/department test - Den Befehl kenn ich nicht