29.06.2015, 07:01
(
Последний раз редактировалось Sc0pion; 29.06.2015 в 14:38.
)
Fixed!
stock IsPlayerAllowedToBuyHouse(playerid)
{
new count, name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
new score = GetPlayerScore(playerid);//better to call func once rather than calling everytime for checking score.
if(score < 1000)return false;//cant own any house if score is less than 1000
for(new i = 0; i < MAX_HOUSES; i ++)
{
//you can return a value directly from loop no need for that 'break'
if(strcmp(hInfo[i][Owner], name, true) == 0) count ++;
if(count == 3)return false;
}
if(score < 10000 && count == 0) return true;
if(score >= 10000 && score < 20000 && count < 2)return true;
return true;
}
if(strcmp(hInfo[i][Owner], name, true) == 0) count ++;
if(!strcmp(hInfo[i][Owner], name)) count ++;
stock IsPlayerAllowedToBuyHouse(playerid)
{
new Score = GetPlayerScore(playerid);
if(Score < 1000) return 0;
new count, name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
for(new i = 0; i < MAX_HOUSES; i ++)
if(hInfo[i][Owner][0] && strcmp(hInfo[i][Owner], name) == 0)
if(++count >= 3) // player has got 3 houses
return 0;
if(Score < 10000 && !count) return 1;
if(10000 <= Score < 20000 && count < 2) return 1;
if(Score > 20000) return 1;
return 0;
}