13.10.2008, 05:34
Hello my fellow people of San Andreas Multiplayer,
I come to you all with a problem that I seem unable to fix on my own. I hope that someone will be able to help me in solving my somewhat small and annoying problem. The problem that I am having is with the following command: /department or also know as /d, you people that have been with the Police, FBI, Army, EMT, etc., people that have a radio and sometimes have to communicate with other organizations.
For some reason, the /department code that I have doesn't work. Only the gray information will come up when I just type /department. When I try to type something after the /department, nothing comes up and no one else sees what I wrote. Please, someone check my code and tell me if something is wrong with it. Thank you in advance! Game on!
I come to you all with a problem that I seem unable to fix on my own. I hope that someone will be able to help me in solving my somewhat small and annoying problem. The problem that I am having is with the following command: /department or also know as /d, you people that have been with the Police, FBI, Army, EMT, etc., people that have a radio and sometimes have to communicate with other organizations.
For some reason, the /department code that I have doesn't work. Only the gray information will come up when I just type /department. When I try to type something after the /department, nothing comes up and no one else sees what I wrote. Please, someone check my code and tell me if something is wrong with it. Thank you in advance! Game on!

Код:
//----------------------------------[departments]-----------------------------------------------
if(strcmp(cmd, "/departments", true) == 0 || strcmp(cmd, "/d", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
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_GRAD2, "USAGE: (/d)epartments [department chat]");
return 1;
}
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Chief %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 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;
}
else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "****** General %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "***** Lieutenant %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "**** Captain %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "*** Major %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "* Private %s: %s, over. **", sendername, result); }
else
{
format(string, sizeof(string), "** Private %s: %s, over. **", sendername, result);
}
SendTeamMessage(2, COLOR_ALLDEPT, string);
SendTeamMessage(1, COLOR_ALLDEPT, string);
printf("%s", string);
return 1;
}
else if(PlayerInfo[playerid][pJob]==11)
{
format(string, sizeof(string), "** EMT %s: %s, over. **", sendername, result);
SendTeamMessage(2, COLOR_ALLDEPT, string);
SendTeamMessage(1, COLOR_ALLDEPT, string);
printf("%s", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You're not part of a Team!");
return 1;
}
}
return 1;
}

