SA-MP Forums Archive
OMG wasting diskspace :') - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OMG wasting diskspace :') (/showthread.php?tid=215290)



OMG wasting diskspace :') - Kwarde - 23.01.2011

Lol. I need no help, but I was just looking in Raven's roleplay, and I see that it waste alot of diskspace :')
Here's an example of 3 callbacks (that can be stocks)

pawn Код:
forward IsAtFishPlace(playerid);
forward IsAtCookPlace(playerid);
forward IsAtBar(playerid);

public IsAtFishPlace(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 1, 403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 398.7553,-2088.7490,7.8359))
        {//Fishplace at the bigwheel
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 1, 396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 391.1094,-2088.7976,7.8359))
        {//Fishplace at the bigwheel
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 1, 383.4157,-2088.7849,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 374.9598,-2088.7979,7.8359))
        {//Fishplace at the bigwheel
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 1, 369.8107,-2088.7927,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 367.3637,-2088.7925,7.8359))
        {//Fishplace at the bigwheel
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 1, 362.2244,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 354.5382,-2088.7979,7.8359))
        {//Fishplace at the bigwheel
            return 1;
        }
    }
    return 0;
}

public IsAtCookPlace(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0 ,369.9786,-4.0798,1001.8589))
        {//Cluckin Bell
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3.0 ,376.4466,-60.9574,1001.5078) || IsPlayerInRangeOfPoint(playerid, 3.0 ,378.1215,-57.4928,1001.5078))
        {//Burgershot
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3.0 ,374.1185,-113.6361,1001.4922) || IsPlayerInRangeOfPoint(playerid, 3.0 ,377.7971,-113.7668,1001.4922))
        {//Well Stacked Pizza
            return 1;
        }
    }
    return 0;
}

public IsAtBar(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 4.0,495.7801,-76.0305,998.7578) || IsPlayerInRangeOfPoint(playerid, 4.0,499.9654,-20.2515,1000.6797))
        {//In grove street bar (with girlfriend), and in Havanna
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 4.0,1215.9480,-13.3519,1000.9219) || IsPlayerInRangeOfPoint(playerid, 10.0,-2658.9749,1407.4136,906.2734))
        {//PIG Pen
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 4.0,968.7739,-46.6145,1001.1172) || IsPlayerInRangeOfPoint(playerid, 10.0,968.7739,-46.6145,1001.1172))
        {//Yamaguchi HQ
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 4.0,-791.016,512.249,1336.41) || IsPlayerInRangeOfPoint(playerid, 10.0,-799.122,520.988,1336.41))
        {//Signatra House
            return 1;
        }
    }
    return 0;
}
It's all a waste of diskspace, the way how it's scripted. Also, there are forwards too 'cuz it's an custom callback.
This script cost about 5 kb!. Look how I've should done it:

pawn Код:
#include <a_samp>

stock IsAtFishPlace(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 1, 403.8266,-2088.7598,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 398.7553,-2088.7490,7.8359) ||
    IsPlayerInRangeOfPoint(playerid, 1, 396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 391.1094,-2088.7976,7.8359) ||
    IsPlayerInRangeOfPoint(playerid, 1, 396.2197,-2088.6692,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 391.1094,-2088.7976,7.8359) ||
    IsPlayerInRangeOfPoint(playerid, 1, 383.4157,-2088.7849,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 374.9598,-2088.7979,7.8359) ||
    IsPlayerInRangeOfPoint(playerid, 1, 369.8107,-2088.7927,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 367.3637,-2088.7925,7.8359) ||
    IsPlayerInRangeOfPoint(playerid, 1, 362.2244,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid, 1, 354.5382,-2088.7979,7.8359))
        return true;
    return false;
}

stock IsAtCookPlace(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0 ,369.9786,-4.0798,1001.8589) ||
    IsPlayerInRangeOfPoint(playerid, 3.0 ,376.4466,-60.9574,1001.5078) || IsPlayerInRangeOfPoint(playerid, 3.0 ,378.1215,-57.4928,1001.5078) ||
    IsPlayerInRangeOfPoint(playerid, 3.0 ,374.1185,-113.6361,1001.4922) || IsPlayerInRangeOfPoint(playerid, 3.0 ,377.7971,-113.7668,1001.4922))
        return true;
    return false;
}

stock IsAtBar(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0,495.7801,-76.0305,998.7578) || IsPlayerInRangeOfPoint(playerid, 4.0,499.9654,-20.2515,1000.6797) ||
    IsPlayerInRangeOfPoint(playerid, 4.0,1215.9480,-13.3519,1000.9219) || IsPlayerInRangeOfPoint(playerid, 10.0,-2658.9749,1407.4136,906.2734) ||
    IsPlayerInRangeOfPoint(playerid, 4.0,968.7739,-46.6145,1001.1172) || IsPlayerInRangeOfPoint(playerid, 10.0,968.7739,-46.6145,1001.1172) ||
    IsPlayerInRangeOfPoint(playerid, 4.0,-791.016,512.249,1336.41) || IsPlayerInRangeOfPoint(playerid, 10.0,-799.122,520.988,1336.41))
        return true;
    return false;
}
That's a bit less then 2 kb. I've just saved ~3kb! And that for 3 functions... With all the functions, commands etc, I think I can save ALOT of diskspace.
I don't know why I'm posted this, just say what you think about it :')

- Kevin


Re: OMG wasting diskspace :') - Fool - 23.01.2011

im going to use those stocks D:


Re: OMG wasting diskspace :') - Kwarde - 23.01.2011

Okay :')
Maybe I'm ever gonna make Raven's Roleplay better, saving diskspace / CPU (converting to djson and zcmd... and the callbacks to stocks :P)
But currently I'm too busy with my new gamemode (Mafia-RP) (PRO-RP)


Re: OMG wasting diskspace :') - ricardo178 - 26.01.2011

Yeah, mybe if someone release raven's it can be better then it is now... It is alried an complet RP! But mutch bugs and admins and players can abuse by very ways!


Re: OMG wasting diskspace :') - Calgon - 26.01.2011

Nobody cares... It's obvious that there are hundreds of issues within that script.


Re: OMG wasting diskspace :') - ricardo178 - 26.01.2011

Yeah, but a good release of raven's can make story man! I think so, if it is a good scripter doing it!


Re: OMG wasting diskspace :') - CoaPsyFactor - 26.01.2011

stock is good, and it saves disk space, but what if you need to call some function with timer, that is only possible with pubic functions


Re: OMG wasting diskspace :') - bartje01 - 26.01.2011

Stocks look some more decent.
But some people just don't work that much with stocks. Like me xP
I just have a few.
But after all. 5kb. I don't know how that can bother you? xD


Re: OMG wasting diskspace :') - ricardo178 - 26.01.2011

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Stocks look some more decent.
But some people just don't work that much with stocks. Like me xP
I just have a few.
But after all. 5kb. I don't know how that can bother you? xD
5kb in this bit, now, mind about the whole scripts on gm taking very space, if they get better!


Re: OMG wasting diskspace :') - bartje01 - 26.01.2011

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
5kb in this bit, now, mind about the whole scripts on gm taking very space, if they get better!
10kb. Epic?..