Dialog Question
#1

Hello,

I wanted to pass the value of inputtext into PlayerInfo[playerid][pNumber] and also check if the number is in the right format.

I've done this:

pawn Code:
if(dialogid == 4)
{
  new ring[64];
  new numbe[32];
  if(!response) Kick(playerid);
  else
  {
    strmid(numbe, inputtext, 0, strlen(inputtext), 32);
    if(strlen(numbe) < 4 || strlen(numbe) > 7 || !IsNumeric(numbe)) // Check if the number has less that 4 or more that 7 digits.
    {
      ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Number input","Please type in your phone number:","Ok","Quit");
      return 1;
    }
    format(ring, sizeof(ring), "Numbers/%s.ini", inputtext);
    if(fexist(ring)) // Checks if the selected number exists in the folder.
    {
      ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Number input","This phone number exist, pick another one:","Ok","Quit");
    }
    else // If it doesn't exist it creates a file. It is suposed to write the value into a variable but it doesn't work.
    {
      fopen(ring, io_write);
      strmid(PlayerInfo[playerid][pNumber],ring,0,strlen(ring),64);
    }
  }
}
Could somebody fix this for me so it works ? And can you add in a check that the number can't begin with 0 (zero), thanks.
Reply
#2

pawn Code:
if(inputtext[0]==0)SendClientMessage(playerid, COLOR_ORANGE, "Invalid number.");
That's for the "starting with zero" thing. I will see if i can fix the rest, too. Pls le' me know if it works.

#EDIT#: What exacly doesn't work in your script you posted above? Some Errors or warnings? Something functional?
Reply
#3

Quote:
Originally Posted by DeathOnaStick
#EDIT#: What exacly doesn't work in your script you posted above? Some Errors or warnings? Something functional?
PlayerInfo[playerid][pNumber] stays 0 all the time. It doesen't store the number in it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)