for(new i, f = MAX_HOTDOGZONES; i < f; i++)
{
if(!IsPlayerInRangeOfPoint(playerid,5.0,HotDogPlace[i][0],HotDogPlace[i][1],HotDogPlace[i][2])) count++;
else break;
if(count == MAX_HOTDOGZONES) {SendClientMessage(playerid, Red, "« Error »"lyellow"You aren't near a hotdog stand!");break;}
}
if(!IsPlayerInRangeOfPoint(playerid,5.0,HotDogPlace[i][0],HotDogPlace[i][1],HotDogPlace[i][2])) count++;
else break;
if(count == MAX_HOTDOGZONES) {SendClientMessage(playerid, Red, "« Error »"lyellow"You aren't near a hotdog stand!");break;}
for(new i, f = MAX_HOTDOGZONES; i < f; i++)
{
if(!IsPlayerInRangeOfPoint(i,5.0,HotDogPlace[i][0],HotDogPlace[i][1],HotDogPlace[i][2])) count++;
else break;
if(count == MAX_HOTDOGZONES//+1) {SendClientMessage(playerid, Red, "« Error »"lyellow"You aren't near a hotdog stand!");break;}
}
pawn Код:
|
for(new i;i <MAX_HOTDOGZONES;i++)
{
if(!IsPlayerInRangeOfPoint(playerid,5.0,HotDogPlace[i][0],HotDogPlace[i][1],HotDogPlace[i][2])) count++;
else break;
}
if(count == MAX_HOTDOGZONES) SendClientMessage(playerid, Red, "« Error »"lyellow"You aren't near a hotdog stand!");
Yeah, the "if count == whatever" should be outside the loop, not in it. And what's wrong with:
pawn Код:
|
for(new i; i < MAX_HOTDOGZONES; i++)
for(new i, f = MAX_HOTDOGZONES; i < f; i++)
CMD:sellhotdog(playerid,params[])
{
if(subteam[playerid] != HOTDOG) return SendClientMessage(playerid,Red,"« Error » "lyellow"You must be a hotdog seller to use this command!");
new id,price;
if(sscanf(params,"ui",id,price)) return SendHelpMessage(playerid,"/sellhotdog [id] [price]","It will send a request to the specified id asking if he wants to accept your offer");
if(!IsPlayerConnected(id)) return SendErrorMessage(playerid,1);
static Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
if(!IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playerid,Red,"« Error » "lyellow"You aren't near that player!");
static count;
for(new i;i <MAX_HOTDOGZONES;i++)
{
if(!IsPlayerInRangeOfPoint(playerid,5.0,HotDogPlace[i][0],HotDogPlace[i][1],HotDogPlace[i][2])) count++;
else break;
}
if(count == MAX_HOTDOGZONES) return SendClientMessage(playerid, Red, "« Error »"lyellow"You aren't near a hotdog stand!"), count = 0;
static string[128];
format(string,sizeof string,"~p~~h~Hot dog seller: ~n~~r~Would you like to buy ~y~1 ~r~hot dog~n~~r~For ~y~$%i~r~?~n~~g~Press Y to buy or N to cancel",price);
Info(id,string,6000);
PInfo[id][HSeller] = playerid;
PInfo[id][HPrice] = price;
SendClientMessage(playerid, Red, "» "lyellow"Offer sent!");
return 1;
}