[UNSOLVED] Police Badge
#7

Never mind, I think I fixed it:

Code:
	if(strcmp(cmd, "/showbadge", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "	USAGE: /showbadge [playerid]");
				return 1;
			}
			new para1;
			para1 = ReturnUser(tmp);
			giveplayerid = ReturnUser(tmp);
      if(gTeam[playerid] == TEAM_LSPD)
			{
			  if(PlayerInfo[playerid][pLAERank] >= 1)
			  {
					if(IsPlayerConnected(para1))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
		  			{
			  			if (GetDistanceBetweenPlayers(playerid,giveplayerid) > 5)
							{
			  				SendClientMessage(playerid, COLOR_GREY, "	You are too far away from the player.");
			  				return 1;
							}
					  	GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							new length = strlen(cmdtext);
							while ((idx < length) && (cmdtext[idx] <= ' '))
							if(!strlen(tmp))
							{
									SendClientMessage(playerid, COLOR_GREY, "	USAGE: /showbadge [playerid]");
									return 1;
							}
							format(string, sizeof(string), "* %s takes hold of his badge and shows it to %s.", sendername, giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC,COLOR_LILAC);
							if(PlayerInfo[playerid][pLAERank] == 10) { format(string, sizeof(string), "Chief of Police %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 9) { format(string, sizeof(string), "Assistant Chief %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 8) { format(string, sizeof(string), "Deputy Chief %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 7) { format(string, sizeof(string), "Commander %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 6) { format(string, sizeof(string), "Captain %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 5) { format(string, sizeof(string), "Lieutenant %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 4) { format(string, sizeof(string), "Sergeant %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 3) { format(string, sizeof(string), "Detective %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 2) { format(string, sizeof(string), "Senior Lead Officer %s, Los Santos Police Department.", sendername); }
							else if(PlayerInfo[playerid][pLAERank] == 1) { format(string, sizeof(string), "Police Officer %s, Los Santos Police Department.", sendername); }
							SendClientMessage(giveplayerid, COLOR_BLUE, string);
							format(string, sizeof(string), "You have shown your badge to %s.", giveplayer);
							SendClientMessage(playerid, COLOR_BLUE, string);
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "	You are not authorized to use that command.");
 					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "	You are not a Police Officer.");
				return 1;
			}
		}
		return 1;
	}
Thanks for your help dudes, have a good one
Reply


Messages In This Thread
[UNSOLVED] Police Badge - by FreddeN - 23.02.2010, 16:40
Re: [UNSOLVED] Police Badge - by Torran - 23.02.2010, 16:59
Re: [UNSOLVED] Police Badge - by FreddeN - 23.02.2010, 17:10
Re: [UNSOLVED] Police Badge - by Souvlaki - 23.02.2010, 17:30
Re: [UNSOLVED] Police Badge - by Klutty - 23.02.2010, 17:43
Re: [UNSOLVED] Police Badge - by FreddeN - 23.02.2010, 19:26
Re: [SOLVED] Police Badge - by FreddeN - 23.02.2010, 19:41

Forum Jump:


Users browsing this thread: 3 Guest(s)