05.02.2013, 19:28
pawn Код:
if (strcmp(cmd, "/register", true) == 0)
{
if (logged[playerid] != 1 && !udb_Exists(PlayerName(playerid)))
{
new tmp4[256];
tmp4 = strtok(cmdtext, idx);
if (strlen(tmp4) || strval(tmp4))
{
new Str[MAX_STRING];
format(Str,sizeof(Str),"users/%s.ini",udb_encode(PlayerName(playerid)));
dini_Create(fname);
dUserSet(PlayerName(playerid)).("password", udb_hash(tmp4));
dUserSet(PlayerName(playerid)).("admin", "0");
dUserSet(PlayerName(playerid)).("banned", "0");
dUserSet(PlayerName(playerid)).("owngoals", "0");
dUserSet(PlayerName(playerid)).("goalsscored", "0");
dUserSet(PlayerName(playerid)).("gamesplayed", "0");
SendClientMessage(playerid, COLOR_RED, "Registrado, porfavor logeate con /login");
}else return SendClientMessage(playerid, COLOR_RED, "Error al registrarse!");
}else return SendClientMessage(playerid, COLOR_RED, "Ya estas registrado!");
return 1;
}
if (strcmp(cmd, "/login", true) == 0)
{
new tmp5[256];
tmp5 = strtok(cmdtext, idx);
if (dUserINT(PlayerName(playerid)).("banned") == 1) {
new string4[128];
format(string4, sizeof(string4), "%s a sido kickeado del servidor, Rasуn: CUENTA BANEADA.", PlayerName(playerid));
SendClientMessageToAll(COLOR_RED, string4);Kick(playerid); }
if (logged[playerid] != 1 && udb_Exists(PlayerName(playerid))) {
if ( udb_hash(tmp5) && strcmp(udb_hash(tmp5), dUser(PlayerName(playerid)).("password"), true) == 0)
{
logged[playerid] = 1;
new score = dUserINT(PlayerName(playerid)).("goalsscored");
SetPlayerScore(playerid,score);
SendClientMessage(playerid, COLOR_RED, "Logeado con excito!");
} else return SendClientMessage(playerid, COLOR_RED, "Error al logearse!");
} else return SendClientMessage(playerid, COLOR_RED, "Esta cuenta no existe!");
return 1;
}
PD: si no te sirve ps me doy