CMD help [ ZCMD ]
#1

guys how to make such command like this
if player enter a command

/help

it will show /help me ,account ,server, or ,admins
how to make that ?
l
so if player
chooses /help me
it will show the commands and info
/help account
/help admins

please anyone can help mee?

pawn Код:
// I am confuse

CMD:help(playerid,params[])
{
    // What should i put?
}
Reply
#2

use dialogs?
DIALOG_STYLE_LIST
Reply
#3

pawn Код:
CMD:help(playerid, params[])
{
    if(!strcmp(params, "me", true, 2))
    {
               //codes
    }
        /*
    if(!strcmp(params, "others", true, 2))
    {
               //codes
    }
        */

    return 1;
}
put your codes inside the strcmp func. to use it. use /help me, or /help others
Reply
#4

pawn Код:
CMD:help(playerid, params[])
{
if(!sscanf(params,"s[40]", help))
{
if(strcmp(help,"new", true) == 0)
{

}
else if(strcmp(help,"_", true) == 0)
{

}
// And so on.
}
else
{
SendClientMessage(playerid, -1,"/help new, _, _, _, _");
}

return 1;
}
Hope it will work.
Reply
#5

Quote:
Originally Posted by Spooky
Посмотреть сообщение
pawn Код:
CMD:help(playerid, params[])
{
if(!sscanf(params,"s[40]", help))
{
if(strcmp(help,"new", true) == 0)
{

}
else if(strcmp(help,"_", true) == 0)
{

}
// And so on.
}
else
{
SendClientMessage(playerid, -1,"/help new, _, _, _, _");
}

return 1;
}
Hope it will work.
I honestly believe, you don't need to use sscanf for simple commands like this.
Reply
#6

Quote:
Originally Posted by Spooky
Посмотреть сообщение
pawn Код:
CMD:help(playerid, params[])
{
if(!sscanf(params,"s[40]", help))
{
if(strcmp(help,"new", true) == 0)
{

}
else if(strcmp(help,"_", true) == 0)
{

}
// And so on.
}
else
{
SendClientMessage(playerid, -1,"/help new, _, _, _, _");
}

return 1;
}
Hope it will work.
are you kidding me?, you don't need sscanf for this simple question
Reply
#7

I developed a little script for you using Dialogs:

Add this on top of your script to define the dialog:
pawn Код:
#define help 1 // change the 1 to the next number of your last dialog...
Here's the actual cmd that will lead to the dialogs.

pawn Код:
CMD:help(playerid,params[])
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Help", "1. Help Me\r\n2. Account\r\n3. Server\r\n4. Admins", "Select", "Exit");
    return 1;
}
Now here's the dialogs, don't forget to read the comments.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == help)
    {
        if(response)
        {
            if(listitem == 0) // This is if the player selects "help me"
            {
                SendClientMessage(playerid, COLORHERE, "Enter Your Commands Here"); // If You Have Many Commands I Suggest Having Another SendClientMessage Line For Them. Replace "COLORHERE" with a color implemented in your script.
                SendClientMessage(playerid, COLORHERE, "Enter Some Info Here"); // If You Have A Lot Of Info Also Use Another SendClientMessage Line For It. Replace "COLORHERE" with a color implemented in your script.
                return 1;
            }
            else if(listitem == 1) // This is if the player selects "Account"
            {
                //Put A Code Here. Maybe You Can Make It Show There Stats
            }
            else if(listitem == 2) // This is if the player selects "server"
            {
                // Maybe You Can Put Info About Your Server Using SendClientMessage.
            }
            else if(listitem == 3) // This is if the player selects "admins"
            {
                // Maybe You Can Put A Code That Shows All The Admins That Are Online
            }
        }
    }
    return 0;
}
Hopefully this has helped you.
Reply
#8

but guys i want to make a command like this

/admin ban [ id ] [ reason ]

so how to make that?
Reply
#9

pawn Код:
CMD:ban(playerid, params[])
{
new id, reason[100];
if(!sscanf(params,"us[100]", id, reason))
{
if(IsPlayerConnected(id))
{
BanEx(id, reason);
}
else SendClientMessage(playerid, -1,"Offiline.");
}
else SendClientMessage(playerid, -1,"SYNTAX: /ban [id] [reason]");
return 1;
}
Not tested.

Sorry for indentation as its made in the post(browser)
Reply
#10

Quote:
Originally Posted by Spooky
Посмотреть сообщение
pawn Код:
CMD:ban(playerid, params[])
{
new id, reason[100];
if(!sscanf(params,"us[100]", id, reason))
{
if(IsPlayerConnected(id))
{
BanEx(id, reason);
}
else SendClientMessage(playerid, -1,"Offiline.");
}
else SendClientMessage(playerid, -1,"SYNTAX: /ban [id] [reason]");
return 1;
}
Not tested.

Sorry for indentation as its made in the post(browser)
The hell? That command makes no sense.

RicaNiel, ****** it. Better yet, click this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)