02.03.2010, 18:28
pawn Код:
dcmd_login(playerid,params[])
{
new pass,rpass[256],name[MAX_PLAYER_NAME],file[23],string[76];
if(logged[playerid] == 1) return SendClientMessage(playerid,COLOUR_RED,"You are already logged in!");
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file)) return SendClientMessage(playerid,COLOUR_RED,"You don't have an account! Register yourself with /register [Password]");
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /login [Password]");
format(rpass,sizeof(rpass),"%s",dini_Str(file,"Password")); // Check this out... did not knot what is te dini cmd for Strings...
if(!strcmp(udb_hash(pass),rpass))
{
pi[playerid][Adminlevel] = dini_Int(file,"Adminlevel");
pi[playerid][Stat] = dini_Int(file,"Stat");
format(string,sizeof(string),"Welcome back %s! You have been succesfully been logged in",name);
SendClientMessage(playerid,COLOUR_GREEN,string);
logged[playerid] = 1;
return 1;
}
else return SendClientMessage(playerid,COLOUR_RED,"The password was incorrect!");
}