Get It Done Right
#1

okay, so i had an idea, basically form a group, and what we will do is go through existing scripts/functions, and make them more efficient, or we will make our own functions and spread them through the community.

How To Join:

Simply fix this piece of code and post it here, you have too fix everything, unless stated otherwise. (it took me so long to make this, yet i see it everyday) NO cheating and looking at already posted fixes.

pawn Код:
if(strcmp(cmd, "/command", true) == 0)
    {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        for(new i; i < GetMaxPlayers(); i++)
        {
            if(IsPlayerConnected(i))
            {
                new string[256], name[256];
                GetPlayerName(playerid, name, sizeof(name))
                format(string, sizeof(string), "%s typed a command with the extra param %s!", name, tmp);
                SendClientMessage(playerid, 0xFFFFFFFF, string);
            }
        }
        return 1;
    }
Note:as far as this goes "suppose" i have every function you use.

one of the things you could do was make a variable and assign the players name to that variable in OnPlayerConnect, but you don't have to do that to pass.

Projects: (you can propose projects, or work on them.)
Fix the GF script (In Progressaren_Jacobson, all 26243 lines of it!)
Fix functions that could be #defines too improve efficiency.
Go through Forums teaching people how too fix the code they post.


I was trying to figure out an acronym, and a name that goes with it, but it was too hard, so i i gave up, if you have one, post it!

i had this idea a long time ago, but i just barely realized how crazy this is getting.
Reply
#2

Assuming you have DCMD and SSCANF defined:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(command, 7, cmdtext);
    return 0;
}
   
dcmd_command(playerid, params[])
{
    new
        name[MAX_PLAYER_NAME],
        string[128];
    if (sscanf(params, "s", string)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/command <string>\"");
    else
    {
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s typed: %s", name, string);
        SendClientMessageToAll(0xFF00FFFF, string);
    }
    return 1;
}
Indentation fixed, curse you pawn box!

EDIT: Not sure about getting tied down in projects, I mean, I've been helping people here for ages now anyway...
Reply
#3

you don't have to do projects, those are just some things that need to be done, i can't wait to release my fast version of the gf.
Reply
#4

What've you changed? DCMD/SSCANF? Fewer strings?

EDIT: Did I pass?
Reply
#5

yes yes and yes.
Reply
#6

If you really want efficiency you should create a plugin with native functions, instead of the Pawn functions.

I'm currently doing a plugin with tons of functions (mainly math and string func), most of them aren't optimized yet but already MIN 3x faster than their Pawn version. Maybe i will release it, not sure how many people will use it since most scripters here only know about strtok and PlayerToPoint
Reply
#7

Noooonoonoonooo release it, I never use PlayerToPoint or strtok!
Reply
#8

I thought using the same array for the params & the string, would overwrite each other.
So when you did "format(string, sizeof(string)" it would not store the params in the array, becuase it's already filling the array with new information.

pawn Код:
format(string, sizeof(string), "%s typed: %s", name, string);
And I thought this would send the newly formated string, inside the string.

I guess I still have a lot to learn.
Reply
#9

Yeah I'd have thought so, but I used it once and seemed to work..
Reply
#10

that is actually the most efficient way, because than you don't waste another variable.

i am just starting to learn C, and have made my first function, but it is pretty hard to read YSF, it makes about zero sense.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)