15.11.2010, 15:09
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:
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?
Код:
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; }