SA-MP Forums Archive
problem with some script - 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: problem with some script (/showthread.php?tid=85514)



problem with some script - XziPer2007 - 08.07.2009

Hey there. I've got the Underworld RPG script, and i'm working on getting the script bug free as possible. There is 1 things i can't fix or dont get it working.

First:

Код:
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), "** Director %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Director in Charge %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Special Agent in Charge %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Special Agent %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Special Agent Trainee %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Professional Staff %s: %s, over. **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** Intern %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] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			  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(gTeam[playerid] == 1||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)
			{
				format(string, sizeof(string), "** Paramedic %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 are not part of a Team !");
				return 1;
			}
		}
		return 1;
	}
This is the code for /d (/departments) where all different departements should be able to talk with each other, but i found a bug which everyone exept the leader of the different appartements can see the chat, and i've been trying everything i've been thinking on, but i can't still get it working. Anyone know how to fix it?

Thanks for the replys

XziPer2007


Re: problem with some script - Correlli - 08.07.2009

Ask in the script's topic.


Re: problem with some script - XziPer2007 - 08.07.2009

Quote:
Originally Posted by Don Correlli
Ask in the script's topic.
I would to if there was 1, can't find the Underworld topic


Re: problem with some script - Grim_ - 08.07.2009

Search for it.


Re: problem with some script - XziPer2007 - 08.07.2009

Quote:
Originally Posted by Swift_
Search for it.
I've done it also, but still haven't found the topic.


Re: problem with some script - XziPer2007 - 08.07.2009

Anyone out there that can help me? i really need to get those working


Re: problem with some script - refshal - 08.07.2009

I actually think that the thread has expired. I searched for it, but I couldn't find anything.

And dude, why is it so hard to use the 'MODIFY' button instead of double posting?


Re: problem with some script - XziPer2007 - 08.07.2009

Quote:
Originally Posted by еddy
And dude, why is it so hard to use the 'MODIFY' button instead of double posting?
Yeah, should have done it, didn't think about it, sry.


Re: problem with some script - refshal - 08.07.2009

Quote:
Originally Posted by XziPer2007
Yeah, should have done it, didn't think about it, sry.
Don't worry, it's all ok. :P
But anyways, I'll try to help you.


Re: problem with some script - XziPer2007 - 08.07.2009

Quote:
Originally Posted by еddy
But anyways, I'll try to help you.
Would be awsome if you could

Edit: i got the car problem fixed. Only need to get /d fixed now, but dont know how :<