[HELP] Department Chat
#1

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!

Код:
//----------------------------------[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;
	}
Reply
#2

Bump
Reply
#3

You sure your SendTeamMessage command works correctly and the team numbers you inputted are correct?
Reply
#4

The problem in SendTeamM
change the numbers !
Reply
#5

Thank you! That fixed the problem, I would of never thought of that! THANK YOU! xD
Reply
#6

can someone tell me what numbers i will put to it? cause i have same prob like this... and in what part i will put that number? thanks...
Reply
#7

SendTeamMessage(factionNumber, ....
Reply
#8

Is it like this?? huhuhu... because still when i type /d or /departments no msg appear

Quote:

SendTeamMessage(1, COLOR_ALLDEPT, string);
SendTeamMessage(1, COLOR_ALLDEPT, string);

Reply
#9

please help me... with this

SendTeamMessage(1, COLOR_ALLDEPT) /d dont work
Reply
#10

HELP ME HERE! please someone!. its been days and i still have same proB!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)