Help me to complete a command!
#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


Messages In This Thread
Help me to complete a command! - by Laure - 12.12.2012, 11:26
Re: Help me to complete a command! - by David (Sabljak) - 12.12.2012, 11:28
Re: Help me to complete a command! - by Threshold - 12.12.2012, 11:28
Re: Help me to complete a command! - by Laure - 12.12.2012, 11:40

Forum Jump:


Users browsing this thread: 1 Guest(s)