IsPlayerInRangeOfPoint issue
#2

That should work:
pawn Код:
CMD:buyservice(playerid, params[])
{
    new bool: inrange;
    for(new x = 0; x < sizeof(ServiceInfo); x++)
    {
        if(IsPlayerInRangeOfPoint(playerid,4.0,ServiceInfo[x][sExteriorX],ServiceInfo[x][sExteriorY],ServiceInfo[x][sExteriorZ]))
        {
            inrange = true;
            if(ServiceInfo[x][sOwned] == 0)
            {
                if(PlayerInfo[playerid][pServiceOwner] >= 0) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You already own a service.");
                if(GetPlayerCash(playerid) < ServiceInfo[x][sPrice]) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You can't afford this service.");
                ServiceInfo[x][sOwned] = 1;
                PlayerInfo[playerid][pServiceOwner] = x;
                PlayerInfo[playerid][pService] = x;
                PlayerInfo[playerid][pSRank] = 6;
                GivePlayerCash(playerid,-ServiceInfo[x][sPrice]);
                new playername[MAX_PLAYER_NAME];
                GetPlayerName(playerid,playername, sizeof(playername));
                strmid(ServiceInfo[x][sOwner],playername,0,strlen(playername),255);
                SendClientMessage(playerid,COLOR_WHITE,"Congratulations on your purchase, contact a admin to set your service.");
                UpdateService(x);
            }
            else SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}This service isn't for sale.");
            break;
        }
    }
    if(!inrange) SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You aren't near any service thats for sale.");
    return 1;
}
Reply


Messages In This Thread
IsPlayerInRangeOfPoint issue - by TonyII - 07.11.2013, 15:48
Re: IsPlayerInRangeOfPoint issue - by Konstantinos - 07.11.2013, 15:55
Re: IsPlayerInRangeOfPoint issue - by TonyII - 07.11.2013, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)