[VERY BIG PROBLEM] Dini saves wrong!
#1

Hey people,
i have a very big problem! I have a dini register and login system. But it is buggy. When a Admin login he have admin rights, but when he turn to offline the Adminrights aren't save! The same is with VIP and Clan. And sometimes it saves in the wrong dini or when the Admin have turned off, and i write /admins there stands that ID 4 (This was the ID of the Admin who left the Server) that this ID got the Adminrights of the leaving Admin...and now i need realy qucik your healp...cause this is stupid when normal players get Admin or something else...

Include:
Код:
#include <dini>
Enum:
Код:
enum spieler_daten
{
skin,
Score,
Mute,
vip,
NewAcc,
AccountLock,
AdminLevel,
Clan,
eingeloggt,
}
new Spieler[MAX_PLAYERS][spieler_daten];
OnPlayerConnect (Show's the Dialog to login or register)
Код:
new pname[MAX_PLAYERS],accFormat[128];
	GetPlayerName(playerid,pname,sizeof pname);
	format(accFormat,sizeof accFormat,"/Players/%s.datei",pname);
	if(fexist(accFormat))
	{
		ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please log you in!","Login","Close");
	}
	else
	{
		ShowPlayerDialog(playerid,DIALOG_REG,1,"Registering","Please register you!","Register","Close");
	}
.....
....
OnPlayerDisconnect
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYERS],accFormat[128];
	GetPlayerName(playerid,pname,sizeof pname);
	format(accFormat,sizeof accFormat,"/Players/%s.datei",pname);
	if(dini_Exists(accFormat))
	{
	dini_IntSet(accFormat,"skin",GetPlayerSkin(playerid));
	dini_IntSet(accFormat,"Score",GetPlayerScore(playerid));
	dini_IntSet(accFormat,"Mute",Spieler[playerid][Mute]);
	dini_IntSet(accFormat,"vip",Spieler[playerid][vip]);
	dini_IntSet(accFormat,"NewAcc",Spieler[playerid][NewAcc]);
	dini_IntSet(accFormat,"AccountLock",Spieler[playerid][AccountLock]);
	dini_IntSet(accFormat,"AdminLevel", Spieler[playerid][AdminLevel]);
	dini_IntSet(accFormat,"Clan", Spieler[playerid][Clan]);
	Spieler[playerid][eingeloggt] = 0;
	}
.....
....
OnDialogRespnse
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new pname[MAX_PLAYERS],accFormat[128];
	GetPlayerName(playerid,pname,sizeof pname);
	format(accFormat,sizeof accFormat,"/Players/%s.datei",pname);
	if(response)
	{
		switch(dialogid) // dialogid auswдhlen
		{
			case DIALOG_LOGIN: // ID Login
			{
   				if(!strlen(inputtext))
				{
        			SetPlayerCameraPos(playerid,-2629.8604,1469.2751,53.5113);
					SetPlayerCameraLookAt(playerid,-2667.4980,1594.2834,111.2788);
					ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login","Login","Close");
					return SendClientMessage(playerid,0xFFFFFFFF,"No Password given!");
				}
				if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)
    			{
					Spieler[playerid][skin] = dini_Int(accFormat,"skin");
					SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
					Spieler[playerid][Mute] = dini_Int(accFormat,"Mute");
					Spieler[playerid][vip] = dini_Int(accFormat, "vip");
					Spieler[playerid][NewAcc] = dini_Int(accFormat,"NewAcc");
					Spieler[playerid][AccountLock] = dini_Int(accFormat,"AccountLock");
					Spieler[playerid][AdminLevel] = dini_Int(accFormat, "AdminLevel");
					Spieler[playerid][Clan] = dini_Int(accFormat, "Clan");
					Spieler[playerid][eingeloggt] = 1;
					SendClientMessage(playerid,COLOR_YELLOW,"Accoount Password is correct. You are logged in.");
					SetPVarInt(playerid,"eingeloggt",1);
					}
				else
				{
					ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Login","Close");
					SendClientMessage(playerid,COLOR_YELLOW,"Wrong Password given!");
				}
			}
			case DIALOG_REG: // ID Registrieren
			{
				if(!strlen(inputtext)) // Text darf nicht = Null sein Null im Sinne von nichts
				{
						SetPlayerCameraPos(playerid,-2629.8604,1469.2751,53.5113);
						SetPlayerCameraLookAt(playerid,-2667.4980,1594.2834,111.2788);
						ShowPlayerDialog(playerid,DIALOG_REG,1,"Registering","Please register you!","register","Close");
     					return SendClientMessage(playerid,0xFFFFFFFF,"The Password is to short!");

				}
				dini_Create(accFormat);
    			dini_Set(accFormat,"Passwort",inputtext);
				dini_IntSet(accFormat, "skin", 0);
				dini_IntSet(accFormat, "Score", 0);
				dini_IntSet(accFormat, "Mute", 0);
				dini_IntSet(accFormat, "vip", 0);
				dini_IntSet(accFormat, "NewAcc", 1);
				dini_IntSet(accFormat, "AccountLock", 0);
				dini_IntSet(accFormat, "AdminLevel" , 0);
				dini_IntSet(accFormat, "Clan", 0);
				Spieler[playerid][skin] = 0;
				Spieler[playerid][Score] = 0;
				Spieler[playerid][Mute] = 0;
				Spieler[playerid][vip] = 0;
				Spieler[playerid][NewAcc] = 1;
				Spieler[playerid][AccountLock] = 0;
				Spieler[playerid][AdminLevel] = 0;
				Spieler[playerid][Clan] = 0;
				Spieler[playerid][eingeloggt] = 1;
				SetPVarInt(playerid,"eingeloggt",1);
          		SendClientMessage(playerid,COLOR_YELLOW,"Account is created and saved!");
				{
          		for(new i; i < MAX_PLAYERS; i++)
          		{
				new string[128];
				format(string,sizeof(string),"[%d] %s   He is a new Player!!! Check him!!! /tv %d",playerid,pname,playerid);
				{
				if(Spieler[i][AdminLevel] >= 2)
				{
				SendClientMessage(i,COLOR_LIGHTRED,string);
				}
			}}
		}}
	}}
	else
	{
		switch(dialogid)
		{
			case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please login!","Login","Close");
			case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please register you!","Register","Close");
		}
	}
	return 1;
}
PLEASE HELP ME! I realy need the help so much....


]B4E[kengston
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)