Help me to complete a command!
#1

Ok here i tried to make a command which shows me the Businesses id and owner of the biz within 2 meters of me but it is not working at all.Codes Below
Код:
CMD:nearbiz(playerid, params[])
{
	new idx, string[128];
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command");
	{
		SendClientMessage(playerid, COLOR_LIGHTGREEN, "* All businesses in the range of 2 meters of you.");
		new Float:X, Float:Y, Float:Z;
		new Float:X2, Float:Y2, Float:Z2;
  		GetPlayerPos(playerid, X2, Y2, Z2);
		for(new i;i<MAX_BIZ;i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
			{
				    new string[128];
			    	format(string, sizeof(string), "Business ID: %d | Owned by: %s", idx, BizInfo[idx][bOwner]);
			    	SendClientMessage(playerid, COLOR_WHITE, string);
			}
		}
	}
	return 1;
}
Help will be appreciated!
Reply
#2

if(!IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))

try with "!"
Reply
#3

pawn Код:
CMD:nearbiz(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command");
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "* All businesses in the range of 2 meters of you.");
    new Count = 0;
    new Float:X, Float:Y, Float:Z;
    new Float:X2, Float:Y2, Float:Z2;
    GetPlayerPos(playerid, X2, Y2, Z2);
    for(new i; i < MAX_BIZ; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ]))
        {
            new string[128];
            Count++;
            format(string, sizeof(string), "Business ID: %d | Owned by: %s", i, BizInfo[i][bOwner]);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        else continue;
    }
    if(Count == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "You are not close to any businesses at the moment.");
    }
    return 1;
}
EDIT: Added 'No businesses nearby' message.
Reply
#4

Thank you very much Benzo you deserve a rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)