I hope this will help.I made this for my GM.I think you can take an idea to make your own,
pawn Code:
if(strcmp(cmd,"/showbadge",true)==0)
{
if(IsPlayerConnected(playerid)) {
if(IsACop(playerid) || IsAPrisonGuard(playerid)) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /showbadge [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid)) {
if(giveplayerid != INVALID_PLAYER_ID) {
if (ProxDetectorS(8.0, playerid, giveplayerid)) {
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cant show your badge to yourself!"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
//GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes out his/her badge from his/her pocket.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GetPlayerName(playerid,sendername,sizeof(sendername));
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) {
if(PlayerInfo[playerid][pRank] == 11) { format(string, sizeof(string), "** Rank/Name: Chief of Police - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Rank/Name: Commander - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** Rank/Name: Captain - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Rank/Name: Lieutenant - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Rank/Name: Staff Sergeant - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Rank/Name: Sergeant - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Rank/Name: Senior Lead Officer - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Rank/Name: Lead Officer - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Rank/Name: Police Officer II - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Rank/Name: Police Officer I - %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Rank/Name: Cadet - %s", sendername); }
}
else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) {
if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** FBI Rank/Name: Director - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** FBI Rank/Name: Deputy Director - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** FBI Rank/Name: Commander - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** FBI Rank/Name: Intelligence Agent - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** FBI Rank/Name: Special Agent - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** FBI Rank/Name: Trainee Agent - %s ", sendername); }
}
else if(IsAPrisonGuard(playerid)) {
if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** LS Prison Rank/Name: Warden - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** LS Prison Rank/Name: Deputy Warden - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** LS Prison Rank/Name: Guard`s Commander - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** LS Prison Rank/Name: Senior Guard - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** LS Prison Rank/Name: Guard - %s ", sendername); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** LS Prison Rank/Name: Trainee - %s ", sendername); }
}
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "* %s has shown his/her badge to you.", sendername);
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "* You have shown your Badge to %s.", giveplayer);
SendClientMessage(playerid, COLOR_GREY, string);
}
else {
SendClientMessage(playerid, COLOR_GREY, " That player is not near you!");
return 1;
}
}
}
else {
SendClientMessage(playerid, COLOR_GREY, " That player is Offline!");
return 1;
}
}
}
return 1;
}