my /reportold cmd doesnt work
#4

OP, I'll help you in a minute, but for now: Jesus christ, your code is resource expensive as hell. Better sort array than loop it 5 times!

Also
pawn Код:
for(new i=0;i<MAX_REPORTS;i++)
{
    if(!breakingloop)
    {
        if(Reports[i][HasBeenUsed] == 0)
        {
            breakingloop = true;
            newid = i;
        }
    }
}

//This will be executed MAX_REPORT times


for(new i=0;i<MAX_REPORTS;i++)
{
    if(Reports[i][HasBeenUsed] == 0)
    {
        newid = i;
        break;
    }
}

//Executed enough times
@Edit 2:

pawn Код:
if(reportlevel == 2)
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
        else
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
Why are you using conditional at all? It's exactly the same as:
pawn Код:
strmid(Reports[newid][Report], report, 0, strlen(report), 128);
Reports[newid][ReportFrom] = reportfrom;
Reports[newid][TimeToExpire] = 0;
Reports[newid][HasBeenUsed] = 1;
Reports[newid][BeingUsed] = 1;
Reports[newid][ReportPriority] = reportpriority;
Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
Reply


Messages In This Thread
my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 08:22
Re: my /reportold cmd doesnt work - by BrandyPenguin - 31.07.2012, 09:09
Re: my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 09:35
Re: my /reportold cmd doesnt work - by Misiur - 31.07.2012, 09:41
Re: my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 09:43
Re: my /reportold cmd doesnt work - by Misiur - 31.07.2012, 09:58
Re: my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 11:03
Re: my /reportold cmd doesnt work - by HyDrAtIc - 31.07.2012, 11:06
Re: my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 11:46
Re: my /reportold cmd doesnt work - by NinjaChicken - 31.07.2012, 11:48

Forum Jump:


Users browsing this thread: 4 Guest(s)