Loop not working <.<
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
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++)
Isn't it you, who says
pawn Код:
for(new i; i < MAX_HOTDOGZONES; i++)
Is slower than
pawn Код:
for(new i, f = MAX_HOTDOGZONES; i < f; i++)
EDIT:
Whole cmd:
pawn Код:
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;
}
Reply


Messages In This Thread
Loop not working <.< - by FireCat - 30.11.2011, 14:10
Re: Loop not working <.< - by FireCat - 30.11.2011, 14:26
Re: Loop not working <.< - by wumpyc - 30.11.2011, 14:34
Re: Loop not working <.< - by ElkaBlazer - 30.11.2011, 15:52
Re: Loop not working <.< - by Finn - 30.11.2011, 15:58
Re: Loop not working <.< - by [MWR]Blood - 30.11.2011, 16:02
Re: Loop not working <.< - by [MG]Dimi - 30.11.2011, 16:06
Re: Loop not working <.< - by FireCat - 30.11.2011, 16:20

Forum Jump:


Users browsing this thread: 1 Guest(s)