11.12.2009, 16:31
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:
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.
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);
}
}
}
