Help with /dep and /hq.
#1

Hey All,

So basically I have a command /dep and /hq. They dont work how they should. When I type "/dep Hi!" it displays this

[LSPD] Academy Student Bauer_Test: Hi!

BUT nobody else sees the message and if there are two or more faction members say two LSPD then this happens;

[LSPD] Academy Student Bauer_Test: Hi!
[LSPD] Academy Student Bauer_Test: Hi!

Same with /hq. If they are a different rank it shows the rank then my name. However it is ONLY on my screen.

If you could help me that'd be awesome;

Код:
CMD:dep(playerid, params[]) return cmd_department(playerid, params);
CMD:department(playerid, params[])
{
	if(!PlayerInfo[playerid][pFaction])
		return SendErrorMessage(playerid, "You aren't in any faction.");
		
	if(FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_POLICE && FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_MEDICAL && FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_DOC)
		return SendClientMessage(playerid, COLOR_RED, "ACCESS DENIED:{FFFFFF} You can't use this command."); 
		
	if(isnull(params))
		return SendUsageMessage(playerid, "/(dep)artment [text]");

	foreach(new i : Player)
	{
		new
			factionid;
			
		factionid = PlayerInfo[i][pFaction];
			
		if(FactionInfo[factionid][eFactionType] == FACTION_TYPE_POLICE || FactionInfo[factionid][eFactionType] == FACTION_TYPE_MEDICAL || FactionInfo[factionid][eFactionType] == FACTION_TYPE_DOC)
		{
			SendClientMessageEx(playerid, COLOR_DEPT, "** [%s] %s %s: %s", FactionInfo[factionid][eFactionAbbrev], ReturnFactionRank(i), ReturnName(playerid), params);
		}
	}
	
	new Float:posx, Float:posy, Float:posz;
	GetPlayerPos(playerid, posx,posy,posz);

	foreach(new i : Player)
	{
 		if(i == playerid)
   			continue;

		else if(IsPlayerInRangeOfPoint(i, 20.0, posx,posy,posz))
		{
  			SendClientMessageEx(i, COLOR_GRAD1, "%s says (radio): %s", ReturnName(playerid, 0), params);
 		}
	}
		
	return 1;
}

CMD:hq(playerid, params[])
{
	if(!PlayerInfo[playerid][pFaction])
		return SendErrorMessage(playerid, "You aren't in any faction.");

	if(FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_POLICE && FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_MEDICAL && FactionInfo[PlayerInfo[playerid][pFaction]][eFactionType] != FACTION_TYPE_DOC)
		return SendClientMessage(playerid, COLOR_RED, "ACCESS DENIED:{FFFFFF} You can't use this command.");

	if(isnull(params))
		return SendUsageMessage(playerid, "/hq [text]");

	foreach(new i : Player)
	{
		new
			factionid;

		factionid = PlayerInfo[i][pFaction];

		if(FactionInfo[factionid][eFactionType] == FACTION_TYPE_POLICE || FactionInfo[factionid][eFactionType] == FACTION_TYPE_MEDICAL || FactionInfo[factionid][eFactionType] == FACTION_TYPE_DOC)
		{
			SendClientMessageEx(playerid, COLOR_COP, "** %s %s: %s", ReturnFactionRank(i), ReturnName(playerid), params);
		}
	}
	return 1;
}
Reply
#2

You're using “playerid” for SendClientMessage inside of foreach.
Reply
#3

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)