Login code don't work, help
#1

Код:
if(dialogid == 21)
	{
		TogglePlayerControllable(playerid, 0);
		new pName[24], str[128];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str),"players/%s.ini",pName);
		new PW[256];
		PW = dini_Get(str,"password");
		if(response == 1)
		{
		  if(strval(inputtext) == udb_hash(PW)) // successful login
		  {
		    pstat[playerid][skin] = dini_Int(str,"skin");
		    pstat[playerid][cash] = dini_Int(str,"cash");
		    pstat[playerid][bank] = dini_Int(str,"bank");
		    pstat[playerid][posX] = dini_Int(str,"posX");
		    pstat[playerid][posY] = dini_Int(str,"posY");
		    pstat[playerid][posZ] = dini_Int(str,"posZ");
		    GivePlayerMoney(playerid, pstat[playerid][cash]);
		    SetPlayerSkin(playerid, pstat[playerid][skin]);
		    SetPlayerPos(playerid, pstat[playerid][posX], pstat[playerid][posY], pstat[playerid][posZ]);
			}
			else
			{
			  ShowPlayerDialog(playerid, 21, 1,"Wrong Password", "That Password is incorrect. Please try again.","Login", "cancel");
			}
			return 1;
		}
	}
Why doesn't this work? For some reason, my password is always incorrect.

Also this:

Код:
public OnPlayerDisconnect(playerid, reason)
{
	new pName[24], str[128];
	GetPlayerName(playerid,pName,sizeof(pName));
	format(str,sizeof(str),"players/%s.ini",pName);
  new string2[256];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string2, sizeof(string2), "%s has left the server.",playername);
	SendClientMessage(playerid, COLOR_TAN , string2);
	new Float:x,Float:y,Float:z;
	GetPlayerPos(playerid,x,y,z);
	new GetCash = GetPlayerMoney(playerid);
 	dini_IntSet(str,"cash",GetCash);
	dini_IntSet(str,"bank",0);
	dini_FloatSet(str,"posX",x);
	dini_FloatSet(str,"posY",y);
	dini_FloatSet(str,"posZ",z);
	return 1;
}
doesn't seem to save my cash or my position in any way.


Also, if someone could tell me a way to bypass character selection?
When a player chose their skin first time, when they die (even if they pressed F4) they DO NOT go to the class selection but spawn with their same stats at a position I chose?


THANKS - If you wanna help me. Means a lot, can't continue working without this fixed!
Reply
#2

Код:
new PW[256];
		PW = dini_Get(str,"password");
		if(response == 1)
		{
		  if(strval(inputtext) == udb_hash(PW)) // successful login
		  {
The problem lies here, btw.
Reply
#3

Yeah tbh, say what you want about bumping... but I can't continue my work on this mod before I fixed this. So PLEASE, someone take the 5 mins to look over my script and see whats wrong.
Reply
#4

Bump, after ages of no reply. Still doesn't work.

Come one, 5 minutes of work for you would help me a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)