need help im lost
#1

ok i can't figer out why this cuaseing the Pawno to crash heres the code

Код:
	if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
	{
	  //GANGRADIOS
    if(PlayerInfo[playerid][pGMember] > 0)
		{
		  if(IsPlayerConnected(playerid))
		  {
				GetPlayerName(playerid, sendername, sizeof(sendername));
				new length = strlen(cmdtext);
				new gang = PlayerInfo[playerid][pGMember];
				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: (/g)angchat [gang chat]");
					return 1;
				}
				new rtext[256];

	  			if(PlayerInfo[playerid][pRank] == 1) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank1]); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank2]); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank3]); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank4]); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank5]); }
			  else if(PlayerInfo[playerid][pRank] == 6) { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank6]); }
				else { format(rtext, sizeof(rtext), "%s", GangInfo[gang][GangRank1]); }

				format(string, sizeof(string), "(( %s %s: %s ))", rtext, sendername, result);
				SendGangMessage(PlayerInfo[playerid][pGMember], COLOR_LIGHTBLUE, string);
				GangChatLog(string);
				return 1;
			}
		}
		//GANGRADIOS
	  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] == 12) { format(string, sizeof(string), "** Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 11) { format(string, sizeof(string), "** Assistant Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Captain %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** Lieutenant %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Sergeant III %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Sergeant II %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Sergeant I %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Detective %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Officer III %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Officer II %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer I %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Student %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else
				{
					format(string, sizeof(string), "** Student %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(1, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string, sizeof(string), "** %s [Radio]: %s **",sendername, result);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			/*if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12)
			{
				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), "** Cadet %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(12, TEAM_BLUE_COLOR, string);
				printf("%s", string);
				return 1;
			}*/
			else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
			{
			  if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Deputy Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Colonel %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Captain %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Lieutenant %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Sergeant %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Corporal %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Cadet %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else
				{
					format(string, sizeof(string), "** Cadet %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(2, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string, sizeof(string), "** %s [Radio]: %s **",sendername, result);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			  else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			  if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Sheriff %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Deputy Sheriff %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Commander %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Lieutenant %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** S.T.A.R.S %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Detective %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Deputy %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Recruit %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else
				{
					format(string, sizeof(string), "** Recruit %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(3, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string, sizeof(string), "** %s [Radio]: %s **",sendername, result);
				ProxDetector(1.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
			{
			  if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Mayor %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Mayor %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** District Attorney %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Council Member %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Body Guard %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Limo Driver %s: %s, over. **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** Limo Driver %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(7, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string,sizeof(string), "* Officer %s uses his radio.", sendername);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
			{
			  if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Taxi Company Leader %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Shift Supervisor %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Dispatcher %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Cabbie %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Taxi Rookie %s: %s, over. **", sendername, result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Trainee %s: %s, over. **", sendername, result); }
				else
				{
					format(string, sizeof(string), "** Trainee %s: %s, over. **", sendername, result);
				}
				SendRadioMessage(10, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string,sizeof(string), "* Officer %s uses his radio.", sendername);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(gTeam[playerid] == 1||PlayerInfo[playerid][pMember]==4 || PlayerInfo[playerid][pLeader]==4)
			{
			  if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** Fire Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Deputy Fire Chief %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Lieutenant %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
			  else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Captain %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** 1st Class Firefighter %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** 2nd Class Firefighter %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** 3rd Class Firefighter %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** 4th Class Firefighter %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Probationary %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				else
				{
					format(string, sizeof(string), "** Probationary %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
				}
				SendRadioMessage(4, TEAM_BLUE_COLOR, string);
				RadioLog(string);
				format(string, sizeof(string), "** %s [Radio]: %s **",sendername, result);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
			else if(gTeam[playerid] == 1||PlayerInfo[playerid][pMember]==15 || PlayerInfo[playerid][pLeader]==15)
			{
				format(string, sizeof(string), "** Paramedic %s: %s, over. **", sendername, result);
				SendRadioMessage(15, TEAM_CYAN_COLOR, string);
				RadioLog(string);
				return 1;
			}
			else if(PlayerInfo[playerid][pMember]==8||PlayerInfo[playerid][pLeader]==8)
			{
				format(string, sizeof(string), "** Hitman %s: %s, over. **", sendername, result);
				SendRadioMessage(4, TEAM_CYAN_COLOR, string);
				RadioLog(string);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "You are not part of a Team !");
				return 1;
			}
		}
		return 1;
	}
im trying to make it so the fd has ranks in /radio but everytime i do it pwn carshes if i take it out it will compile is it becuase the Fire department ant allowed to have ranks? or am i just noobish lol
Reply
#2

You are most probably missing a closing bracket ( } )some where
Reply
#3

don't know how i copied the rank set from the pd and pasted it in the code and just changed the ranks
Reply
#4

Does the whole code make it crash or only some part of it?
Reply
#5

the part were the FD ranks are is what makes it crash
Reply
#6

pawn Код:
format(string, sizeof(string), "** Probationary %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result); }
Remove the bracket } from the end, so it looks like this:

pawn Код:
format(string, sizeof(string), "** Probationary %s #%d: %s, over. **", sendername,PlayerInfo[playerid][pBadgeNumber], result);
Reply
#7

haha wow now i feel stupid didn't see that there tell now thnx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)