16.05.2012, 04:09
this should fix the login, but i think the "command not found" part is in a different part.(prehaps in "OnPlayerCommandText")
also, you might want to indent the code. its alot easier to read that way
indented:
pawn Код:
new file[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
switch(dialogid)
{
case 1://login
{
new pass[500],lpassenc[33];
pass = dini_Get(file,"pass");
md5(inputtext,lpassenc);
if(response)
{
if(!strcmp(lpassenc,pass, false))
{
SendClientMessage(playerid,0x828282FF,"You are successfully logged in!");
alevel[playerid] = strval(dini_Get(file,"alevel"));
faction[playerid] = strval(dini_Get(file,"faction"));
rank[playerid] = strval(dini_Get(file,"rank"));
ucbadge[playerid] = strval(dini_Get(file,"ucbadge"));
swat[playerid] = strval(dini_Get(file,"swat"));
det[playerid] = strval(dini_Get(file,"det"));
tf[playerid] = strval(dini_Get(file,"tf"));
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Wrong Password!","Enter your password below:","Login","Cancel");
}
}
else
{
Kick(playerid);
}
}
case 2://register
{
if(response)
{
new rpassenc[33];
md5(inputtext,rpassenc);
dini_Create(file);
dini_Set(file, "pass", rpassenc);
dini_IntSet(file,"alevel", 0);
dini_IntSet(file,"faction", 0);
dini_IntSet(file,"rank",0);
dini_IntSet(file,"ucbadge",0);
dini_IntSet(file,"swat",0);
dini_IntSet(file,"det",0);
dini_IntSet(file,"tf",0);
dini_IntSet(file,"copbanned",0);
SendClientMessage(playerid,0x828282FF,"You are now registered on this server!");
}
else
{
Kick(playerid);
}
}
case 3:
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
}
}
return 1;
indented:
pawn Код:
new file[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
switch(dialogid)
{
case 1://login
{
new pass[500],lpassenc[33];
pass = dini_Get(file,"pass");
md5(inputtext,lpassenc);
if(response)
{
if(!strcmp(lpassenc,pass, false))
{
SendClientMessage(playerid,0x828282FF,"You are successfully logged in!");
alevel[playerid] = strval(dini_Get(file,"alevel"));
faction[playerid] = strval(dini_Get(file,"faction"));
rank[playerid] = strval(dini_Get(file,"rank"));
ucbadge[playerid] = strval(dini_Get(file,"ucbadge"));
swat[playerid] = strval(dini_Get(file,"swat"));
det[playerid] = strval(dini_Get(file,"det"));
tf[playerid] = strval(dini_Get(file,"tf"));
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Wrong Password!","Enter your password below:","Login","Cancel");
}
}
else
{
Kick(playerid);
}
}
case 2://register
{
if(response)
{
new rpassenc[33];
md5(inputtext,rpassenc);
dini_Create(file);
dini_Set(file, "pass", rpassenc);
dini_IntSet(file,"alevel", 0);
dini_IntSet(file,"faction", 0);
dini_IntSet(file,"rank",0);
dini_IntSet(file,"ucbadge",0);
dini_IntSet(file,"swat",0);
dini_IntSet(file,"det",0);
dini_IntSet(file,"tf",0);
dini_IntSet(file,"copbanned",0);
SendClientMessage(playerid,0x828282FF,"You are now registered on this server!");
}
else
{
Kick(playerid);
}
}
case 3:
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
}
}
return 1;