Sorry, another question: /login command [seriously] - 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: Sorry, another question: /login command [seriously] (
/showthread.php?tid=190483)
Sorry, another question: /login command [seriously] -
blackwave - 15.11.2010
Well, for try resolve my problem of update .ini file, and as noone could help on previous topic, I did a dcmd register system instead of a dialog input one. So, my code:
Код:
dcmd_login(playerid,params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),SERVER_USER_FILE,n);
if(!dini_Exists(file)) return SendClientMessage(playerid,AMARELO,"You cannot login. Cuz you didn't register yet"); // Means didn't register, and have to /register before type /login
if(gPlayerLogged[playerid] == 1) return SendClientMessage(playerid,AZUL,"You are already logged in!"); // If logged already, shows the message
if(strlen(params))
{
new pass[256];
pass = dini_Get(file,"Password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0) // If password != from dini's one, return message underneath
{
SendClientMessage(playerid,AMARELO,"P A S S W O R D E R R A D O"); // Wrong pasword
}
else if(PlayerInfo[playerid][Registrado] == 1 && (strcmp(params,pass,true) != 0)) // registrado = registered
{
gPlayerLogged[playerid]=1; // Means logged = true
PlayerInfo[playerid][Level] = dini_Int(file,"Level"); // get his level from his dini file
SendClientMessage(playerid, VERMELHO, "LOGADO"); // Means logged (it'd show when player logged)
}
}
}
else if(!strlen(params) && gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid,VERMELHO,"USAGE: /login <Password>");
}
return 1;
}
I think the problem's on the password, because when I type "/login", it returns "USAGE: /login < password >", like on my code. Any other way?
Re: Sorry, another question: /login command [seriously] -
blackwave - 15.11.2010
Nvm fixed.