not finding gamerscore
#1

alright folks an having an issue with this command, when i try by a business it says i dont have enough score


Код:
CMD:buybus(playerid,params[])
{
	if(IsJailedOrMuted(playerid))return 1;
    for(new i=1;i<BusinessCount+1;i++)
    {
 		new string[100];
		if(BankID[playerid]==0)return SendClientMessage(playerid,GREY,"You need a bank account");
        if(GetPlayerScore(playerid)<4)return SendClientMessage(playerid,GREY,"You need a score of atleast Level 4");
        if(!IsPlayerInRangeOfPoint(playerid,1.0,Business[i][bX],Business[i][bY],Business[i][bZ]))continue;
        if(GetPlayerMoneyEx(playerid) < Business[i][bCost]) return SendClientMessage(playerid,GREY,"You don't have enough money");
       	if(strcmp(Business[i][bOwner],"None") !=0) return SendClientMessage(playerid,GREY,"This business is already owned by someone");
		if(BID[playerid]>0)return SendClientMessage(playerid,GREY,"You already own a business");
		BID[playerid]=i;
       	format(Business[i][bOwner],24,"%s",PlayerName(playerid));
       	GivePlayerMoneyEx(playerid,-Business[i][bCost]);
		format(string,sizeof(string),"You've purchased the %s of Cost $%i",Business[i][bName],Business[i][bCost]);
		SendClientMessage(playerid,YELLOW,string);
		format(string,sizeof(string),"You will receive a payout of $%i from your business",Business[i][bProfit]);
		SendClientMessage(playerid,-1,string);
		if(PlayerAwards[playerid][Buss]==0)
		{
		    PlayerAwards[playerid][Buss]=1;
		    GivePlayerMoneyEx(playerid,1000);
			GamerScore[playerid]=GamerScore[playerid]+60;
		    SendClientMessage(playerid,YELLOW,"Achievement Unlocked: {FFFFFF}I Am Involved In One!");
  			SendClientMessage(playerid,LGREEN,"BONUS: $1000 || +60 Gamer Score");
		}
		format(string,sizeof(string),"~r~-$%i",Business[i][bCost]);
		GameTextForPlayer(playerid,string,800,1);
        return 1;
    }
    return 1;
}
Reply
#2

Your algorithm is wrong. You should first find the closest business, stop the "for" loop and to the rest, like score checking etc.
Reply
#3

my score is GamerScore=90 tho so whys it not finding it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)