Dialog Question - 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: Dialog Question (
/showthread.php?tid=112971)
Dialog Question -
Zeromanster - 11.12.2009
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.
Re: Dialog Question -
DeathOnaStick - 11.12.2009
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?
Re: Dialog Question -
Zeromanster - 11.12.2009
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.