[HELP]/radio
#1

Ok when a lspd or anyone talks in /r dats in a faction serevr crashes why please help here the command
Код:
if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", 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: (/r)adio [radio chat]");
				return 1;
			  }
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
			{
				if(PlayerInfo[playerid][pRank] == 11) { format(string, sizeof(string), "** Chief %s: %s, over. **", sendername, result); }
			    else if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Deputy Cheif %s: %s, over. **", sendername, result); }
			    else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** Lt'Captain %s: %s, over. **", sendername, result); }
			    else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Captain %%s: %s, over. **", sendername, result); }
					else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
					else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
					else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Senior Lead Officer %s: %s, over. **", sendername, result); }
					else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lead Officer%s: %s, over. **", sendername, result); }
					else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Police Officer %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), "** Cadet %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(1, TEAM_BLUE_COLOR, string);
				printf("%s", string);
  			GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "%s whispers something in the radio.", sendername);
				ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				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);
				}
				SendRadioMessage(2, TEAM_BLUE_COLOR, string);
				printf("%s", string);
				return 1;
			  }
			else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			  if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** General %s: %s, over. **", sendername, result); }
		  	else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "**Lieutenant General %s: %s, over. **", sendername, result); }
		  	else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "**Colonel %s: %s, over. **", sendername, result); }
		  	else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "**Lieutenant Colonel %s: %s, over. **", sendername, result); }
		  	else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "**Major %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), "** Corporal %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);
				}
				SendRadioMessage(3, TEAM_BLUE_COLOR, 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);
				SendRadioMessage(4, TEAM_CYAN_COLOR, string);
				printf("%s", string);
				return 1;
			   }
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  You are not part of a Team !");
				return 1;
			  }
		    }
Reply
#2

Anyone??
Reply
#3

Why people still use strtok? -.-''
But sorry, can't see whats wrong :S
Reply
#4

Yeahh, give us some more information about whats wrong with it? & give us your server_log.txt
Reply
#5

well server doesnt crashes just restarts
Reply
#6

?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)