04.03.2009, 22:22
on my constant quest to optimize stuff i found something that will help your script go just that little bit faster, and it is with dcmd, yes you could implement this using normal command methods, but i am writing this specifically for dcmd, so here is what it is, and ignore what i call my command:
it is pretty long, but i know that people are sometimes to lazy to go to pastebin links
yes i know, on some of those letters, it might be better to just skip the check, and yes those are all real commands in my script.
if this is completely un-efficiant tell me, i am just trying to learn more about the language (holy poop, i sound like y-less).
adios.
it is pretty long, but i know that people are sometimes to lazy to go to pastebin links
pawn Code:
if (!strcmp(cmdtext, "/a", true, 2)
{
dcmd(ak47, 4, cmdtext);
dcmd(angle, 5, cmdtext);
}
if (!strcmp(cmdtext, "/b", true, 2)
{
dcmd(ball, 4, cmdtext);
dcmd(boom, 4, cmdtext);
}
if (!strcmp(cmdtext, "/c", true, 2)
{
dcmd(cpr, 3, cmdtext);
dcmd(coord, 5, cmdtext);
dcmd(cure, 4, cmdtext);
}
if (!strcmp(cmdtext, "/d", true, 2)
{
dcmd(dropcar, 7, cmdtext);
dcmd(dirt, 4, cmdtext);
}
dcmd(eagle, 5, cmdtext); //only one command with that letter, so this is more efficient
dcmd(findship, 8, cmdtext);
if (!strcmp(cmdtext, "/g", true, 2)
{
dcmd(gravity, 7, cmdtext);
dcmd(gotoship, 8, cmdtext);
dcmd(grav, 4, cmdtext);
}
if (!strcmp(cmdtext, "/h", true, 2)
{
dcmd(help, 4, cmdtext);
dcmd(hydraulics, 10, cmdtext);
dcmd(handsup, 7, cmdtext);
dcmd(hack, 4, cmdtext);
}
dcmd(identify, 8, cmdtext);
dcmd(josh, 4, cmdtext);
dcmd(kill, 4, cmdtext);
if (!strcmp(cmdtext, "/l", true, 2)
{
dcmd(load, 4, cmdtext);
dcmd(link, 4, cmdtext);
dcmd(list, 4, cmdtext);
dcmd(levitate, 8, cmdtext);
}
if (!strcmp(cmdtext, "/m", true, 2)
{
dcmd(money, 5, cmdtext);
dcmd(model, 5, cmdtext);
dcmd(morphine, 8, cmdtext);
dcmd(mp5, 3, cmdtext);
dcmd(m4, 2, cmdtext);
dcmd(moveship, 8, cmdtext);
}
dcmd(nos, 3, cmdtext);
dcmd(obj, 3, cmdtext);
if (!strcmp(cmdtext, "/p", true, 2)
{
dcmd(plane, 5, cmdtext);
dcmd(plant, 5, cmdtext);
dcmd(pick, 4, cmdtext);
}
dcmd(race, 4, cmdtext);
if (!strcmp(cmdtext, "/s", true, 2)
{
dcmd(set, 3, cmdtext);
dcmd(sync, 4, cmdtext);
dcmd(startlol, 8, cmdtext);
dcmd(shotgun, 7, cmdtext);
}
if (!strcmp(cmdtext, "/t", true, 2)
{
dcmd(test, 4, cmdtext);
dcmd(tele, 4, cmdtext);
dcmd(tower, 5, cmdtext);
dcmd(tra, 3, cmdtext);
dcmd(takeover, 8, cmdtext);
}
dcmd(up, 2, cmdtext);
dcmd(veh, 3, cmdtext);
//no more commands with those letters (those = w - z)
if this is completely un-efficiant tell me, i am just trying to learn more about the language (holy poop, i sound like y-less).
adios.