one command multiple actions. (/goto [Location] (LS LV SF))
#1

I'm just searching for the 2 lines that has to be brought in.

commands:
/goto ls
/goto lv
/goto sf

I know how to make these without a space, but I would like to have them with the space.
Using ZCMD and sscanf2
Reply
#2

pawn Код:
CMD:goto(playerid, params[])
{
    if(!strcmp("sf", params, true, 2))
    {
        // SF tp cmd
    }
    if(!strcmp("ls", params, true, 2))
    {
        // LS tp cmd
    }
    if(!strcmp("lv", params, true, 2))
    {
        // LV tp cmd
    }
    return 1;
}
Reply
#3

I am using y_stringhash & y_commands because it's easier for you, instead of using strcmp to compare strings, nothing special in this code.

pawn Код:
YCMD:goto(playerid, params[], help)
{
    if(help)
    {
        SendClientMessage(playerid, -1, "SF | LS | LV");
        SendClientMessage(playerid, -1, "/goto [Location");
    }
    switch ( YHash( params ), false ) //parameter | YHash(str[], bool:sensitive = true, e_HASH_TYPE:type = bernstein);
    {
        case _H<LS>:
        {
            //ls coordinates.
        }
        case _H<LV>:
        {
            //lv coordinates.
        }
        case _H<SF>:
        {
            //sf coordinates.
        }
    }

    return 1;
}
EDIT

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
pawn Код:
//code
You could use that but it would not show you any message how to use the command.
Reply
#4

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
pawn Код:
CMD:goto(playerid, params[])
{
    if(!strcmp("sf", params, true, 2))
    {
        // SF tp cmd
    }
    if(!strcmp("ls", params, true, 2))
    {
        // LS tp cmd
    }
    if(!strcmp("lv", params, true, 2))
    {
        // LV tp cmd
    }
    return 1;
}
Those were the exact lines i needed, thanks buddy. +rep.

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
I am using y_stringhash & y_commands because it's easier for you, instead of using strcmp to compare strings, nothing special in this code.

pawn Код:
YCMD:goto(playerid, params[], help)
{
    if(help)
    {
        SendClientMessage(playerid, -1, "SF | LS | LV");
        SendClientMessage(playerid, -1, "/goto [Location");
    }
    switch ( YHash( params ), false ) //parameter | YHash(str[], bool:sensitive = true, e_HASH_TYPE:type = bernstein);
    {
        case _H<LS>:
        {
            //ls coordinates.
        }
        case _H<LV>:
        {
            //lv coordinates.
        }
        case _H<SF>:
        {
            //sf coordinates.
        }
    }

    return 1;
}
EDIT



You could use that but it would not show you any message how to use the command.
Thanks for the assistance, +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)