[Include] GSAN: GetSpecialActionName
#1

GetSpecialActionName

About:
GetSpecialActionName is a simple include that allows you to get the name of a given ID of a special action. It is very simple, - and nothing really special.

Usage:
GetSpecialActionName is used when you need to return the name. For instance you could use it with format. It is very simple.

Installation:
Place gsan.inc in your pawno-includes folder.
Put #include gsan at the top of your script.

You can download this include below:

Pastebin: Click Here
Pastebin(Example Filter-Script): Click Here
Solidfiles: Click Here
SolidFiles(With Example FS): Click Here

If you have any questions or need help please PM me or reply here!
Reply
#2

You can't use the define of the id, and then use OR the id....
The define of the id IS the id.
Reply
#3

I do not even get the the usage of this, also why are you using else if? when there's an array or switch which can be faster SPEED DOES MATTER!. I'd say this would go to Useful Functions instead of posting it in here and get a lot of negative comments. This code can be improved by using.

pawn Код:
//Array Version
GetSpecialActionName(playerid, IndexID)
{
    static const Name[ 55 ] =
    {
        "None", // 0
        "Using Jetpack", //1
        "Unkown", "Unkown", "Unkown", //2, 3 & 4
        "Dance 1" //5
        //and so on.
    };
    return Name[ GetPlayerSpecialAction(playerid) ]);
}

//Switch Version.
GetSpecialActionName(IndexID)
{
    new IndexName [ 55 ];
    swtich( IndexID )
    {
        default: strcat(IndexName, "None");
        case 1: strcat(IndexName, "Using Jetpack");
        case 5: strcat(IndexName, "Dance 1");
        //and so on.
    }
    return IndexName;
}
Reply
#4

This need not be an include, it can only be put into useful codes ..
But it would be better if you seek direct specialAction in stock

pawn Код:
GetSpecialActionName(playerid);


stock GetSpecialActionName(id)
{
    static name[50];

    if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_NONE) format(name, sizeof(name), "None");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_USEJETPACK) format(name, sizeof(name), "Using Jetpack");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DANCE1)  format(name, sizeof(name), "Dance 1");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DANCE2) format(name, sizeof(name), "Dance 2");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DANCE3) format(name, sizeof(name), "Dance 3");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DANCE4) format(name, sizeof(name), "Dance 4");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_HANDSUP) format(name, sizeof(name), "Hands Up");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_USECELLPHONE) format(name, sizeof(name), "Using Cell-Phone");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_SITTING) format(name, sizeof(name), "Sitting");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_STOPUSECELLPHONE) format(name, sizeof(name), "Putting Away Cell-Phone");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DRINK_BEER) format(name, sizeof(name), "Drinking Beer");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_SMOKE_CIGGY) format(name, sizeof(name), "Smoking Cigar(Smoke Ciggy)");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DRINK_WINE) format(name, sizeof(name), "Drinking Wine");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_DRINK_SPRUNK) format(name, sizeof(name), "Drinking Sprunk");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_CUFFED) format(name, sizeof(name), "Cuffed(Handcuffed - hands behind (your)(their) back.");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_CARRY) format(name, sizeof(name), "Carry(Carry(ing)");
    else if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_PISSING) format(name, sizeof(name), "Pissing");
    return name;
}
or it could also use an array to define it
Reply
#5

I had a massive brain fart lol...

Click HERE for the fixed version. I'm sorry I did this in like 5 minutes when I woke up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)