Ini file isn't set correctly.
#1

Good afternoon.

I'm working on a multi-character system for a new gamemode I am working on.
Once people connect to the server, they get asked to fill in a name for their master account.

Код:
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"World of Darkness Roleplay","Please type in your master account name:\n{AA3333AA}WARNING: You must use this name the next time you connect to our server.","Continue","Quit");
    }
Then, if they did that the name will be store in a string & then they must fill in a password.

Код:
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
			{
	            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "World of Darkness Roleplay","Please type in your master account name:\n{AA3333AA}WARNING: You must use this name the next time you connect to our server.\nError: You have entered an invalid name, try again.","Continue","Quit");
				format(Tempname, sizeof(Tempname), "%s", inputtext);
                new string[128];
                format(string, sizeof(string), "Your master account name is {3BB9FF}%s{FFFFFF}\nFill in a password to continue.", inputtext);
      			ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_INPUT, "World of Darkness Roleplay",string,"Register","Quit");
				return 1;
	        }
        }
Then, if they have filled in their password I do create a ini file using this code:

Код:
               format(string,sizeof(string),PATH,Tempname);
				new INI:File = INI_Open(string);
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password2",udb_hash(inputtext));
                INI_WriteString(File, "Name1", "");
                INI_WriteString(File, "Name2", "");
                INI_WriteString(File, "Name3", "");
                INI_Close(File);
Tempname is stored right after OnDialogResponse:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new Tempname[34];
Now, the problem is.. if I register IG, this is the ini file that gets created:


So the name doesn't get filled in..

Can somebody help me out? I don't know what I did whrong.
Reply
#2

It seems as Tempname is empty.

EDIT: Yeah, sorry I misread. "Tempname" is declared every time and it is empty when the second dialog (for password) is shown. You should make a player-array (global) and store the inputtext so you can use it later.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Tempname is empty because you don't call GetPlayerName function.
I think you don't understand what I want to do.

The inputtext from the first dialog must be the name, not the GetPlayerName.
Reply
#4

Dialogs aren't all called at the same time, so formatting 'Tempname' (Considering it's a local array), in one dialog, and then expecting it to be the same in another dialog is incorrect.
Reply
#5

Gonna try it out.
Reply
#6

Yes.

new TempName[MAX_PLAYERS][value];
Reply
#7

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Yes.

new TempName[MAX_PLAYERS][value];
I did do that.
Now I get these errors.
Код:
C:\Users\Administrator\Desktop\World of Darkness - Roleplay\Server\gamemodes\wod.pwn(253) : error 012: invalid function call, not a valid address
C:\Users\Administrator\Desktop\World of Darkness - Roleplay\Server\gamemodes\wod.pwn(253) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\World of Darkness - Roleplay\Server\gamemodes\wod.pwn(253) : error 001: expected token: ";", but found ")"
C:\Users\Administrator\Desktop\World of Darkness - Roleplay\Server\gamemodes\wod.pwn(253) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\World of Darkness - Roleplay\Server\gamemodes\wod.pwn(253) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
I changed the code from ondialogresponse to this:
Код:
format(Tempname(playerid), sizeof(Tempname(playerid)), "%s", inputtext);
Reply
#8

Can't find any soltution.
Reply
#9

pawn Код:
// global:
new gPlayer_TempName[MAX_PLAYERS][MAX_PLAYER_NAME];

// OnPlayerConnect:
gPlayer_TempName[playerid][0] = EOS; // reset

// OnDialogResponse: master account
strcpy(gPlayer_TempName[playerid], inputtext, MAX_PLAYER_NAME);

// OnDialogResponse: password:
format(string, sizeof(string), PATH, gPlayer_TempName[playerid]);
new INI:File = INI_Open(string);
...
INI_Close(File);
Here's strcpy:
pawn Код:
#if !defined strcpy
    #define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)
#endif

// strcpy(destination[], source[], max_len);
and you better use SHA256_PassHash instead of udb_hash.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)