Speeding Coding up.
#1

Hey,

At the current time, I am writing full code:

pawn Код:
if(!strcmp(params, "ammu", false, strlen(params)) || !strcmp(params, "lspd", false, strlen(params)) || !strcmp(params, "sfpd", false, strlen(params)) || !strcmp(params, "sasd", false, strlen(params)) || !strcmp(params, "noose", false, strlen(params)) || !strcmp(params, "bank", false, strlen(params)) || !strcmp(params, "cityhall", false, strlen(params)) || !strcmp(params, "tp", false, strlen(params)))
I was wondering, how would I convert this into a list? If possible of course, like:

pawn Код:
new AntiAdminAbuseTp
{
... Items Here...
}
Could someone explain how this would work ?

Thanks,

-Mike.
Reply
#2

pawn Код:
new bool: stringMatch, AntiAdminAbuseTp[][] =
{
    "ammu",
    "lspd",
    "etc",
    "final option"
};

for(new i = 0, sof = sizeof(AntiAdminAbuseTp); i < sof; i++)
{
    if(strcmp(params, AntiAdminAbuseTp[i], true) == 0)
    {
        stringMatch = true;
        break;
    }
}

if(stringMatch == true)
{
    // The params matched an item on the list
}
else
{
    // The params didn't match an item on the list
}
Reply
#3

Thanks but what after that? Like on the actual command?
Reply
#4

Edited my post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)