Menu as a Command?
#1

Do any of you know how to make menu based commands? Such as the ones back in the GPM MDC where you selected place warrant, typed an id into chat, and then it basically did the command. Example, Place Warrant - Press T - Type in the id into chat - type in the reason into chat - then it does the command. If anyone knows how to do that can you please help me?
The menu name is mdcwarrants and the item this needs to go under is Place Warrant which is case 0.
My warrant command is this
Код:
if(strcmp(cmd, "/want", true) == 0)
{
    if(gteam[playerid]==Team_LSPD || gteam[playerid] ==Team_SFPD || gteam[playerid] ==Team_SWAT || gteam[playerid] ==Team_SASP || gteam[playerid]==Team_SWAT || gteam[playerid]==Team_DCP || gteam[playerid]==Team_Army  || gteam[playerid]==Team_ArmyMed || gteam[playerid]==Team_GOV || gteam[playerid]==Team_L1A) {
        new tmp[256];
        new tracedID;
        new tracedIDName[MAX_PLAYER_NAME];
          new current_zone;
        current_zone = player_zone[tracedID];
        
        tmp = strtok(cmdtext, idx);

        tracedID = strval(tmp);

        if(!strlen(tmp)) {
            SendClientMessage(playerid,COLOR_WHITE,"USAGE: /warrant [Player ID] [Level/Reason]");
            return 1;
        }

        if (strlen(cmdtext) > 7){
        if(dini_Exists("Suspects.txt"))
              {
            GetPlayerName(tracedID, tracedIDName, sizeof(tracedIDName));

          if(gteam[tracedID]==Team_L1A) {
          
            dini_Set("Suspects.txt", tracedIDName,cmdtext[7]);

            //GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "You have suspected %s (ID:%d).", tracedIDName, tracedID);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "You are now a wanted suspect.");
            SendClientMessage(tracedID, COLOR_BRIGHTRED, string);
            SetPlayerColor(tracedID,COLOR_GREY);

            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
            SendMessageToLawWhite(string);
            format(string, sizeof(string), "POLICE DISPATCH");
            SendMessageToLaw(string);
            format(string, sizeof(string), "Be advised. The following is a wanted level update.");
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Suspect name: %s",tracedIDName);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Suspect ID: %d",tracedID);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Reason/Level: %s", cmdtext[7]);
              SendMessageToLawGrey(string);
              format(string, sizeof(string), "Issued by: Officer %s",sendername);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
            SendMessageToLawWhite(string);
Reply
#2

Quote:
Originally Posted by [SCRP]Cody
Посмотреть сообщение
Do any of you know how to make menu based commands? Such as the ones back in the GPM MDC where you selected place warrant, typed an id into chat, and then it basically did the command. Example, Place Warrant - Press T - Type in the id into chat - type in the reason into chat - then it does the command. If anyone knows how to do that can you please help me?
The menu name is mdcwarrants and the item this needs to go under is Place Warrant which is case 0.
My warrant command is this
Код:
if(strcmp(cmd, "/want", true) == 0)
{
    if(gteam[playerid]==Team_LSPD || gteam[playerid] ==Team_SFPD || gteam[playerid] ==Team_SWAT || gteam[playerid] ==Team_SASP || gteam[playerid]==Team_SWAT || gteam[playerid]==Team_DCP || gteam[playerid]==Team_Army  || gteam[playerid]==Team_ArmyMed || gteam[playerid]==Team_GOV || gteam[playerid]==Team_L1A) {
        new tmp[256];
        new tracedID;
        new tracedIDName[MAX_PLAYER_NAME];
          new current_zone;
        current_zone = player_zone[tracedID];
        
        tmp = strtok(cmdtext, idx);

        tracedID = strval(tmp);

        if(!strlen(tmp)) {
            SendClientMessage(playerid,COLOR_WHITE,"USAGE: /warrant [Player ID] [Level/Reason]");
            return 1;
        }

        if (strlen(cmdtext) > 7){
        if(dini_Exists("Suspects.txt"))
              {
            GetPlayerName(tracedID, tracedIDName, sizeof(tracedIDName));

          if(gteam[tracedID]==Team_L1A) {
          
            dini_Set("Suspects.txt", tracedIDName,cmdtext[7]);

            //GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "You have suspected %s (ID:%d).", tracedIDName, tracedID);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "You are now a wanted suspect.");
            SendClientMessage(tracedID, COLOR_BRIGHTRED, string);
            SetPlayerColor(tracedID,COLOR_GREY);

            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
            SendMessageToLawWhite(string);
            format(string, sizeof(string), "POLICE DISPATCH");
            SendMessageToLaw(string);
            format(string, sizeof(string), "Be advised. The following is a wanted level update.");
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Suspect name: %s",tracedIDName);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Suspect ID: %d",tracedID);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "Reason/Level: %s", cmdtext[7]);
              SendMessageToLawGrey(string);
              format(string, sizeof(string), "Issued by: Officer %s",sendername);
            SendMessageToLawGrey(string);
            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
            SendMessageToLawWhite(string);
Create a menu and look at some Scripting Tutorials or check the wiki on how to make menus.
Reply
#3

I recommend dialogs rather than menus, tbh.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)