if(strcmp(cmd, "/login", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /login [password]");
new name[MAX_PLAYER_NAME];
if(IsLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You are already logged in.");
return 1;
}
else
{
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"Users/%s.ini",name);
if(fexist(file))
{
tmp2 = dini_Get(file, "Password");
if(udb_hash(tmp) != strval(tmp2))
{
SendClientMessage(playerid, COLOR_RED, "This password does not match any account in the database.");
}
else
{
IsLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "Admin Level");
PlayerInfo[playerid][pVIPMember] = dini_Int(file, "VIP Member");
PlayerInfo[playerid][pArmy] = dini_Int(file, "Army Rank");
SetPlayerMoney(playerid, dini_Int(file, "Cash"));
PlayerInfo[playerid][pBans] = dini_Int(file, "Bans");
PlayerInfo[playerid][pKicks] = dini_Int(file, "Kicks");
PlayerInfo[playerid][pWarns] = dini_Int(file, "Warns");
PlayerInfo[playerid][pMuted] = dini_Int(file, "Muted");
SendClientMessage(playerid, COLOR_WHITE, "You have successfully logged into your account.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}
if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /register [password]");
format(file,sizeof(file),"Users/%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmp));
dini_IntSet(file,"Admin Level", 0);
dini_IntSet(file,"VIP Member", 0);
dini_IntSet(file,"Army Rank", 0);
dini_IntSet(file,"Cash", 0);
dini_IntSet(file,"Bank", 0);
dini_IntSet(file,"Bans", 0);
dini_IntSet(file,"Kicks", 0);
dini_IntSet(file,"Warns", 0);
dini_IntSet(file,"Muted", 0);
SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered a account, you can now login by typing /login.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "This account is already in the database.");
}
return 1;
}
// When you call the dialog:
new pname[24];
new pfile[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile,sizeof(pfile),"Users/%s.ini",pname);
if(fexist(pfile))
{
ShowPlayerDialog(playerid,1515,DIALOG_STYLE_INPUT,"Login to play","Password","Login","Exit");
}else{
ShowPlayerDialog(playerid,1515,DIALOG_STYLE_INPUT,"Register to play","Password","Login","Exit");
}
// And the response:
public OnDialogResponse(...){
if(dialogid == 1515){
if(!response){
kick(playerid);
return true;
}
new pname[24];
new pfile[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile,sizeof(pfile),"Users/%s.ini",pname);
if(fexist(pfile))
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"ENTER your password","Password","Login","Exit");
if(!strcmp(udb_hash(inputtext),dini_Get(pfile, "Password"),false)){
IsLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(pfile, "Admin Level");
PlayerInfo[playerid][pVIPMember] = dini_Int(pfile, "VIP Member");
PlayerInfo[playerid][pArmy] = dini_Int(pfile, "Army Rank");
SetPlayerMoney(playerid, dini_Int(pfile, "Cash"));
PlayerInfo[playerid][pBans] = dini_Int(pfile, "Bans");
PlayerInfo[playerid][pKicks] = dini_Int(pfile, "Kicks");
PlayerInfo[playerid][pWarns] = dini_Int(pfile, "Warns");
PlayerInfo[playerid][pMuted] = dini_Int(pfile, "Muted");
SendClientMessage(playerid, COLOR_WHITE, "You have successfully logged into your account.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
TogglePlayerControllable(playerid, 1);
}else{
return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"Bad password","Try again","Login","Exit");
}
}else{
// Create Account:
format(pfile,sizeof(pfile),"Users/%s.ini",name);
dini_Create(pfile);
dini_IntSet(pfile, "Password", udb_hash(inputtext));
dini_IntSet(pfile,"Admin Level", 0);
dini_IntSet(pfile,"VIP Member", 0);
dini_IntSet(pfile,"Army Rank", 0);
dini_IntSet(pfile,"Cash", 0);
dini_IntSet(pfile,"Bank", 0);
dini_IntSet(pfile,"Bans", 0);
dini_IntSet(pfile,"Kicks", 0);
dini_IntSet(pfile,"Warns", 0);
dini_IntSet(pfile,"Muted", 0);
// Login player:
IsLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(pfile, "Admin Level");
PlayerInfo[playerid][pVIPMember] = dini_Int(pfile, "VIP Member");
PlayerInfo[playerid][pArmy] = dini_Int(pfile, "Army Rank");
SetPlayerMoney(playerid, dini_Int(pfile, "Cash"));
PlayerInfo[playerid][pBans] = dini_Int(pfile, "Bans");
PlayerInfo[playerid][pKicks] = dini_Int(pfile, "Kicks");
PlayerInfo[playerid][pWarns] = dini_Int(pfile, "Warns");
PlayerInfo[playerid][pMuted] = dini_Int(pfile, "Muted");
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered a account. Enjoy the server!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
}
return true;
}
Originally Posted by wafffllesss
Try that:
pawn Код:
|
C:\Users\Adi\Desktop\admin3.pwn(1759) : error 035: argument type mismatch (argument 1)