SA-MP Forums Archive
[HELP] ShowPlayerDialog - Errors. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] ShowPlayerDialog - Errors. (/showthread.php?tid=423519)



[HELP] Command isnt working. - faff - 18.03.2013

This is the command.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/elevator", cmdtext, true, 10) == 0)
	{
        if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, down level dialog.
        { // look
             ShowPlayerDialog(playerid, DIALOG_ELET1, DIALOG_STYLE_LIST, "Elevator","Second Level (shop)\nThird Level","Use Elevator","Elevator"); //sWierd cuz there is nossing missed,  i know right, roy couldnt help me to..
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.7379) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.2279) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, down level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT1, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Second Level (shop)\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "You cant use your victims elevator, Or maybe you aren't near an elevator?");
        }
		return 1;
	}
	return 0;
}
But when i try to do this command ingame, it says, Server: Unkown Command.

Can somebody help me, please?


Re: [HELP] Command isnt working. - faff - 18.03.2013

Hmm Exactly, got new question.


Re: [HELP] ShowPlayerDialog - Errors. - LarzI - 18.03.2013

- nevermind -


Re: [HELP] ShowPlayerDialog - Errors. - faff - 18.03.2013

Eeh, Well, I tried something. But i didnt worked.
So ehm, still got the same problem


Re: [HELP] ShowPlayerDialog - Errors. - Konstantinos - 18.03.2013

Well, you return false at the end of the callback and true at the end of the strcmp statement but it may bugs it due to the lenght, it sometimes happens.

Try this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/elevator", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, down level dialog.
        { // look
             ShowPlayerDialog(playerid, DIALOG_ELET1, DIALOG_STYLE_LIST, "Elevator","Second Level (shop)\nThird Level","Use Elevator","Elevator"); //sWierd cuz there is nossing missed,  i know right, roy couldnt help me to..
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.7379) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.2279) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, down level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT1, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Second Level (shop)\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else SendClientMessage(playerid, COLOR_RED, "You cant use your victims elevator, Or maybe you aren't near an elevator?");
        return 1;
    }
    return 0;
}



Re: [HELP] ShowPlayerDialog - Errors. - faff - 18.03.2013

Can this be a problem to?
pawn Код:
case DIALOG_ELET1:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 12.7379);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 23.2279);
              }
              return 1;
            }
        }
        case DIALOG_ELET2:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 23.2279);
              }
              //return 1;
            }
        }
        case DIALOG_ELET3:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 12.7379);
              }
             // return 1;
            }
        }
        case DIALOG_ELECT1:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 12.7378);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }
      case DIALOG_ELECT2:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }
            case DIALOG_ELECT3:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }



Re: [HELP] ShowPlayerDialog - Errors. - Konstantinos - 18.03.2013

I don't think so, but I'm not sure 100 percent.

Does it still send "Server: Unkown Command"? If yes, what I can suggest you is to use ZCMD. I never had problems with it about unknown commands!


Re: [HELP] ShowPlayerDialog - Errors. - faff - 18.03.2013

Hmm, I tried with ZCMD.
But it's still saying, Unkown Command.

pawn Код:
CMD:createbiz(playerid, params[])
{
        if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, down level dialog.
        { // look
             ShowPlayerDialog(playerid, DIALOG_ELET1, DIALOG_STYLE_LIST, "Elevator","Second Level (shop)\nThird Level","Use Elevator","Elevator"); //sWierd cuz there is nossing missed,  i know right, roy couldnt help me to..
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.7379) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.2279) && PlayerInfo[playerid][pTeam] == 1) //Terrorist, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELET3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 2.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, down level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT1, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Second Level (shop)\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 12.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, second level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT2, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Third Level (sniper position)","Use Elevator","Elevator");
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 194.1673, 401.2836, 23.4079) && PlayerInfo[playerid][pTeam] == 2) //CT, third level dialog.
        {
             ShowPlayerDialog(playerid, DIALOG_ELECT3, DIALOG_STYLE_LIST, "Elevator - Select Ground Level","Ground Level\n Second Level (shop)","Use Elevator","Leave Elevator");
        }
        else SendClientMessage(playerid, COLOR_RED, "You cant use your victims elevator, Or maybe you aren't near an elevator?");
        return 1;
}

I gues, it's the problem from this:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Team",0);
                INI_Close(File);
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }

        case DIALOG_ELET1:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 12.7379);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 23.2279);
              }
              return 1;
            }
        }
        case DIALOG_ELET2:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 23.2279);
              }
              //return 1;
            }
        }
        case DIALOG_ELET3:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 194.1673, 401.2836, 12.7379);
              }
             // return 1;
            }
        }
        case DIALOG_ELECT1:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 12.7378);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }
      case DIALOG_ELECT2:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }
            case DIALOG_ELECT3:
        {
            //if ( !response ) return;
            if( response )
            {
              if(listitem == 0)
              {
                SetPlayerPos(playerid, 49.5787, 401.7574, 2.4079);
              }
              else if(listitem == 1)
              {
                SetPlayerPos(playerid, 49.5626, 401.4964, 23.2279);
              }
              //return 1;
            }
        }
    }
    return 1;
}
Login & Register Dialog are correct.
But idk if the ELET1,ELET2,ELET3,ELECT1,ELECT2,ELECT3 Dialogs are correct.
Since someone tried to fix it with teamvieuwer, but failed.


because i have to add
pawn Код:
switch(listitem)
in that ''ondialogresponse'' one.
But i diddnt becuz i dont know where.


Re: [HELP] ShowPlayerDialog - Errors. - faff - 19.03.2013

Hmm, I tried to fix it, but it didnt worked. Anybody?