OMG wasting diskspace :')
#1

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
Reply


Messages In This Thread
OMG wasting diskspace :') - by Kwarde - 23.01.2011, 06:24
Re: OMG wasting diskspace :') - by Fool - 23.01.2011, 06:27
Re: OMG wasting diskspace :') - by Kwarde - 23.01.2011, 06:32
Re: OMG wasting diskspace :') - by ricardo178 - 26.01.2011, 19:42
Re: OMG wasting diskspace :') - by Calgon - 26.01.2011, 20:00
Re: OMG wasting diskspace :') - by ricardo178 - 26.01.2011, 20:22
Re: OMG wasting diskspace :') - by CoaPsyFactor - 26.01.2011, 21:53
Re: OMG wasting diskspace :') - by bartje01 - 26.01.2011, 21:58
Re: OMG wasting diskspace :') - by ricardo178 - 26.01.2011, 22:06
Re: OMG wasting diskspace :') - by bartje01 - 26.01.2011, 22:07

Forum Jump:


Users browsing this thread: 1 Guest(s)