SA-MP Forums Archive
[HELP] Department Chat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Department Chat (/showthread.php?tid=52999)



[HELP] Department Chat - jbtech - 13.10.2008

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;
	}



Re: [HELP] Department Chat - jbtech - 14.10.2008

Bump


Re: [HELP] Department Chat - ferriswheel - 14.10.2008

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


Re: [HELP] Department Chat - vection - 14.10.2008

The problem in SendTeamM
change the numbers !


Re: [HELP] Department Chat - jbtech - 20.10.2008

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


Re: [HELP] Department Chat - zhemphyr - 07.02.2009

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...


Re: [HELP] Department Chat - Masj - 07.02.2009

SendTeamMessage(factionNumber, ....


Re: [HELP] Department Chat - zhemphyr - 08.02.2009

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);




Re: [HELP] Department Chat - zhemphyr - 08.02.2009

please help me... with this

SendTeamMessage(1, COLOR_ALLDEPT) /d dont work


Re: [HELP] Department Chat - zhemphyr - 09.02.2009

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