SA-MP Forums Archive
Register and Login in dialog - 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: Register and Login in dialog (/showthread.php?tid=253461)



Register and Login in dialog - Gotti_ - 06.05.2011

Hey guys, please can you help me how to make this in dialog (if someone can make this), so when player connect and dont have account it shows him dialog for registering, and when player connect and have account shows him dialog for loging

that commands:

Код:
CMD:register(playerid,params[])
{
	new file[256];
 	format(file,sizeof(file),"InteAdmin/Accounts/%s.txt",GetPlayerNameEx(playerid));
  	if(dini_Exists(file)) return SendClientMessage(playerid,0xE60000FF,"You're already registered.");
  	if(Account[playerid][Registered] == 1) return SendClientMessage(playerid,0xE60000FF,"You're already registeredi.");
  	if(Account[playerid][Logged] == 1) return SendClientMessage(playerid,0xE60000FF,"You're already registered and logged in.");
	if(strlen(params))
	{
    	if(!dini_Exists(file))
    	{
    		dini_Create(file);
   			dini_Set(file,"Password",params);
		    dini_IntSet(file,"Registered",1);
		    dini_IntSet(file,"Logged",1);
		    dini_IntSet(file,"Kills",0);
		    dini_IntSet(file,"Deaths",0);
		    dini_IntSet(file,"Level",0);
		    dini_IntSet(file,"Score",Account[playerid][Score] = 0);
		    dini_IntSet(file,"Cash",Account[playerid][Cash] = 0);
		    Account[playerid][Registered] = 1;
		    Account[playerid][Logged] = 1;
		    Account[playerid][Muted] = 0;
    		SendClientMessage(playerid,0x33AA33AA,"You are successfully registered!");
    		GivePlayerMoney(playerid, 20000);
			return 1;
		}
	}
	else
	{
    	SendClientMessage(playerid,0xFFFF00FF,"Usage: /register [password]");
    	return 1;
	}
	return 1;
}
Код:
CMD:login(playerid,params[])
{
	new file[256];
	format(file,sizeof(file),"InteAdmin/Accounts/%s.txt",GetPlayerNameEx(playerid));
 	if(!dini_Exists(file)) return SendClientMessage(playerid,0xFFFF00FF,"You're not registeredi! Please /register");
 	if(Account[playerid][Logged] == 1) return SendClientMessage(playerid,0x33CCFFAA,"You're already logged in!");
 	if(Account[playerid][Registered] == 0) return SendClientMessage(playerid,0xFFFF00FF,"You're not registeredi! Please /register");
	if(strlen(params))
	{
    	new pass[256];
		pass = dini_Get(file,"Password");
    	if(dini_Exists(file))
    	{
    		if(strcmp(params,pass,false) != 0)
			{
				SendClientMessage(playerid,0xE60000FF,"ERROR: Incorrect password!");
			}
			else
			{
			    dini_IntSet(file,"Logged",1);
			    Account[playerid][Logged] = 1;
			    Account[playerid][Level] = dini_Int(file,"Level");
				Account[playerid][Kills] = dini_Int(file,"Kills");
				Account[playerid][Deaths] = dini_Int(file,"Deaths");
			    SetPlayerScoreEx(playerid, dini_Int(file, "Score")-GetPlayerScore(playerid));
				GivePlayerMoney(playerid, dini_Int(file, "Cash")-GetPlayerMoney(playerid));
			    TogglePlayerControllable(playerid,true);
			    TextDrawHideForPlayer(playerid, LoginTextdraw);
			    Account[playerid][Muted] = 0;
				SendClientMessage(playerid,0xFFFF00FF,"You have successfully logged in!");
				return 1;
			}
		}
	}
	else SendClientMessage(playerid,0x33AA33AA,"Koristite: /login [password]");
	return 1;
 }



Re: Register and Login in dialog - Rivera - 06.05.2011

Use dialogs. Check the tutorial in my signature ...


Re: Register and Login in dialog - Gotti_ - 06.05.2011

i have my saving system just dont know how to make it in dialog and i saw ur tutorial :S can anyone make me that pls


Re: Register and Login in dialog - Gotti_ - 06.05.2011

can anyone make me that please


Re: Register and Login in dialog - Gotti_ - 11.05.2011

bump