09.05.2012, 22:46
Okay I run a server and I want to know how to make /hbadge a command that will give you fake badges of a LEO faction such as LSPD/NG/Government/etc. can anyone help me?
if(strcmp(cmd,"/fbadge",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fbadge[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, stupid!"); 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);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
if(PlayerInfo[playerid][pRank] == 8) { format(string, sizeof(string), "** Rank/Name: Chief %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Rank/Name: Deputy Chief %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Rank/Name: Captain %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Rank/Name: Lieutenant %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Rank/Name: Sergeant %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Rank/Name: Corporal %s*", sendername); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Rank/Name: Police Officer %s", sendername); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Rank/Name: Cadet %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 Fake 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;
}
CMD:hbadge(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)//May require change to fit Hitman. CHECK FIRST!
{
if(IsPlayerConnected(playerid))
{
if(isnull(params)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hbadge [name]");
SendClientMessageEx(playerid, COLOR_RED, "Available names: SASD, LSPD, NG, FBO, Off");
return 1;
}
if(strcmp(params,"sasd",true) == 0)
{
SetPlayerColor(playerid, TEAM_SASD);
SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"lspd",true) == 0)
{
SetPlayerColor(playerid,TEAM_BLUE_COLOR);
SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"ng",true) == 0)
{
SetPlayerColor(playerid,COLOR_NG);
SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"fbi",true) == 0)
{
SetPlayerColor(playerid,TEAM_FBI_COLOR);
SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
}
else if(strcmp(params,"off",true) == 0)
{
SetPlayerColor(playerid,TEAM_HIT_COLOR);
SendClientMessageEx(playerid, COLOR_WHITE, "You're badge has been removed");
}
}
}
return 1;
}