Dini Login/Register Issue
#1

I made this little Dialog Login/Register system. All works fine - there's just 1 problem. The code doesn't create the *.ini file. I tried run as administrator, but that didn't work as well. Can someone please tell me how to fix this issue?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 0)
	{
	  if (response)
		{
	    new Pname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, Pname, sizeof(Pname));
	    format(File, sizeof(File), "\\Users\\%s.ini", Pname);
   		dini_Create(File);
  		dini_IntSet(File, "HashPW", udb_hash(inputtext));
			dini_Set(File, "Password", inputtext);
			dini_IntSet(File, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
			dini_IntSet(File, "Score", PlayerInfo[playerid][Score] = 0);
			dini_IntSet(File, "Money", PlayerInfo[playerid][Cash] = 500);
	    Logged[playerid] = 1;
		}
		else
		{
		  new Pname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, Pname, sizeof(Pname));
		  SendClientMessageToAll(Warning, "%s was kicked by AutoAdmin: Failed to register.", Pname);
		  Kick(playerid);
		}
		return 1;
	}
	
	if(dialogid == 1) // LoginBox
	{
	  if (response)
	  {
			new Pname[MAX_PLAYER_NAME];
			GetPlayerName(playerid, Pname, sizeof(Pname));
			format(File, sizeof(File), "\\Users\\%s.ini", Pname);
			new TMP;
  		TMP = dini_Int(File, "HashPW");
  		if(udb_hash(inputtext) != TMP)
  		{
  		  SendClientMessageToAll(Warning, "%s was kicked by AutoAdmin: Failed to input vailed password.", Pname);
  		  Kick(playerid);
			}
  			else
  			{
  			  Logged[playerid] = 1;
  			  PlayerInfo[playerid][AdminLevel] = dini_Int(File, "AdminLevel");
  			  SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
  			  GivePlayerMoney(playerid, dini_Int(File, "Money")-GetPlayerMoney(playerid));
			}
		}
		else
		{
		  new Pname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, Pname, sizeof(Pname));
		  SendClientMessageToAll(Warning, "%s was kicked by AutoAdmin: Failed to login.", Pname);
		  Kick(playerid);
		}
	}
return 0;
}
- Yes I do have Includes. Dini & dudb


Also I need help with a few warnings:
Quote:

C:\Users\Mikkel Petersen\Documents\CityLifeRoleplay.pwn(130) : warning 202: number of arguments does not match definition
C:\Users\Mikkel Petersen\Documents\CityLifeRoleplay.pwn(147) : warning 202: number of arguments does not match definition
C:\Users\Mikkel Petersen\Documents\CityLifeRoleplay.pwn(162) : warning 202: number of arguments does not match definition
C:\Users\Mikkel Petersen\Documents\CityLifeRoleplay.pwn(166) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Warnings.

Reply
#2

Change this lines:

format(File, sizeof(File), "\\Users\\%s.ini", Pname);

Into:

format(File, sizeof(File), "/Users/%s.ini", Pname);
Reply
#3

Quote:
Originally Posted by Flashy
Change this lines:

format(File, sizeof(File), "\\Users\\%s.ini", Pname);

Into:

format(File, sizeof(File), "/Users/%s.ini", Pname);
I see. Didn't knew it used back slash. Anyway thanks for the help!
Reply
#4

No problem. I am here to help.
For your warnings:

C:\Users\Mikkel Petersen\Documents\CityLifeRoleplay.pwn(166) : warning 217: loose indentation

This warning tells you that one line is not in the line as it should.

Reply
#5

Quote:
Originally Posted by Flashy
Change this lines:

format(File, sizeof(File), "\\Users\\%s.ini", Pname);

Into:

format(File, sizeof(File), "/Users/%s.ini", Pname);
It's doesn't seem to work /:
Reply
#6

Have you create a "Users" folder at "scriptfiles" ?
Reply
#7

Fixed it. I didn't create a folder called Users inside scriptfiles.
Reply
#8

For the warnings "Number of arguments doesn't match definition" it means you don't have the right number of values put in.

For example, if I used the function AddStaticVehicle, it is definied as this:
pawn Код:
AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2)
so if I did:

pawn Код:
AddStaticVehicle(548, 125.2482, 548.3489, 12.25, 0.0)
it would give that error because I didn't define color1 and color2. Make sure you check those line numbers and the functions. Find the function in the box on the right side of Pawno, and if you click on it it should show the defines at the bottom of the screen. Make sure you have a value for each of those spots.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)