SA-MP Forums Archive
Even if you dont type anything.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Even if you dont type anything.. (/showthread.php?tid=126895)



Even if you dont type anything.. - Torran - 10.02.2010

Heres my code:

pawn Код:
if(response)
    {
  switch(dialogid)
  {
        case 1:
     {
       if(!strcmp(inputtext,"2598",true))
       {
       SendClientMessage(playerid,0xFFFFFFFF,"You are being taken to \"Room 2598 - En' Suite\"");
       FadeColorForPlayer(playerid,0,0,0,0,0,0,0,255,15,0);
       SetPlayerInterior(playerid,12);
       SetPlayerPos(playerid,2324.33, -1144.79, 1050.71);
       FadeColorForPlayer(playerid,0,0,0,0,255,255,255,255,15,0);
       }
       else
       {
       SendClientMessage(playerid,0x8F8F8FFF,"Invalid Room Number");
       }
       if(response == 0)
       {
       SendClientMessage(playerid,0x8F8F8FFF,"Rooms");
       return 1;
            }
        }
    }
}
If i leave the box blank and press enter, It still teleports me to room 2598,
And also how would i get it to show another dialog if the player clicks rooms?

ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Sk in","Welcome to Visage Hotel Showroom \nPlease type in a Room Number to visit the room \nNote you cannot buy the rooms \nFor now this hotel is a Showroom","Enter","Rooms");


Re: Even if you dont type anything.. - Joe Staff - 10.02.2010

add a check to see if they typed anything in.

pawn Код:
if(!inputtext[0])return SendClientMessage(playerid,0xFFFFFFFF,"You didn't type in a room number");
strcmp will return 0 (or pass) when compared with nothing.



Re: Even if you dont type anything.. - Torran - 10.02.2010

Ok may you check the last post on your Fader FS topic, Thanks


Re: Even if you dont type anything.. - Torran - 10.02.2010

Also another question:
How would i make it show another dialog if a player clicks Rooms


Re: Even if you dont type anything.. - Onyx09 - 10.02.2010

make another case in that same dialog and well make it so it open a new dialog with rooms? :P


Re: Even if you dont type anything.. - Torran - 10.02.2010

Ok also where do i put that code that joe staff gave me


Re: Even if you dont type anything.. - Onyx09 - 10.02.2010

Quote:
Originally Posted by Torran
Heres my code:

pawn Код:
if(response)
    {
  switch(dialogid)
  {
        case 1:
    {
       if(!strcmp(inputtext,"2598",true))
       {
       SendClientMessage(playerid,0xFFFFFFFF,"You are being taken to \"Room 2598 - En' Suite\"");
       FadeColorForPlayer(playerid,0,0,0,0,0,0,0,255,15,0);
       SetPlayerInterior(playerid,12);
       SetPlayerPos(playerid,2324.33, -1144.79, 1050.71);
       FadeColorForPlayer(playerid,0,0,0,0,255,255,255,255,15,0);
       }
       else if(!inputtext[0])return SendClientMessage(playerid,0xFFFFFFFF,"You didn't type in a room number");
       else (response == 0)
       {
       SendClientMessage(playerid,0x8F8F8FFF,"Rooms");
       return 1;
            }
        }
    }
}
Something like this i think or you can give it a different order its up to you



Re: Even if you dont type anything.. - Torran - 10.02.2010

Ok can you correct this for me

pawn Код:
if(response)
    {
  switch(dialogid)
  {
        case 1:
     {
       if(!strcmp(inputtext,"2598",true))
       {
       FadeColorForPlayer(playerid,0,0,0,0,0,0,0,255,15,0);
       SetTimerEx("HotelRoom2598", 2000, 0, "i", playerid);
        }
    case 2:
     {
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Rooms","2598 - En' Suite","Close","Enter Room");
            }
        }
    }
}



Re: Even if you dont type anything.. - Joe Staff - 10.02.2010

You have to put the code I gave you BEFORE the strcmp.


Re: Even if you dont type anything.. - Torran - 10.02.2010

Ok and about the case thing?
And what about if they input a text that is invalid