15.08.2012, 23:10
Hola a Todos!
Tengo un Ladmin, muy editado y adaptado para mi gamemode. Y quiero pasar el registro a dialogo y no se como hacerlo.
Alguien que me ayude:
/register:
y /login
Muchas Gracias, espero su ayuda
Tengo un Ladmin, muy editado y adaptado para mi gamemode. Y quiero pasar el registro a dialogo y no se como hacerlo.
Alguien que me ayude:
/register:
pawn Код:
dcmd_register(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"Usted ya estб registrado y logueado.");
if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"Esta cuenta ya existe, utilice '/login [contraseсa]'.");
if (strlen(params) == 0) return SendClientMessage(playerid,red,"ERROR: Uso /register [contraseсa]. ejm: /register palo4321");
if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,red,"La contraseсa debe ser mayor a tres caracteres");
if (udb_Create(PlayerName2(playerid),params))
{
new string[256],file[256],name[MAX_PLAYER_NAME], tmp3[100];
new strdate[20], year,month,day; getdate(year, month, day);
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/ladmin/users/%s.ini",udb_encode(name));
GetPlayerIp(playerid,tmp3,100); dini_Set(file,"ip",tmp3);
// dini_Set(file,"password",params);
dUserSetINT(PlayerName2(playerid)).("registered",1);
format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
dUserSetINT(PlayerName2(playerid)).("money",0);
dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("score",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("hours",0);
dUserSetINT(PlayerName2(playerid)).("minutes",0);
dUserSetINT(PlayerName2(playerid)).("seconds",0);
dUserSetINT(PlayerName2(playerid)).("saw",PlayerInfo[playerid][saw]);
dUserSetINT(PlayerName2(playerid)).("sz",PlayerInfo[playerid][sz]);
dUserSetINT(PlayerName2(playerid)).("vip",0);
dUserSetINT(PlayerName2(playerid)).("Hitman",0);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
format(string,sizeof(string),"Registrado correctamente. la proxima vez que te conectes usa /login %s",params);
SendClientMessage(playerid, green, string);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GivePlayerMoney(playerid,5000);
return 1;
}
return 1;
}
pawn Код:
dcmd_login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"Usted ya estб logueado");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"La cuenta no existe, utilice '/register [contraseсa]'.");
if (strlen(params)==0) return SendClientMessage(playerid,red1,"ERROR: Uso correcto: '/login [contraseсa]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128];
format(file,sizeof(file),"/ladmin/users/%s.ini",udb_encode(PlayerName2(playerid)) );
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"Logueado correctamente. {FFFF00}(Nivel %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"Logueado correctamente.");
}
else {
PlayerInfo[playerid][FailLogin]++;
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), params, PlayerInfo[playerid][FailLogin] );
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
{
new string[128]; format(string, sizeof(string), "- %s ha sido automaticamente kickeado {E31919}(Contraseсa incorrecta)", PlayerName2(playerid) );
SendClientMessageToAll(red1, string);
print(string);
Kick(playerid);
}
return SendClientMessage(playerid,red,"Contraseсa incorrecta! - La proxima Kick");
}
}
Muchas Gracias, espero su ayuda