19.04.2012, 23:59
Can someone help me convert this login & register system to a dialouge based one ?
Код:
dcmd_register(playerid,params[]) {
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged in...");
if (udb_Exists(PlayerName2(playerid))) return SystemMsg(playerid,"Account already exists, please use '/login password'.");
if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/register password'");
if (udb_Create(PlayerName2(playerid),params)) return SystemMsg(playerid,"Account successfully created. Login with '/login password' now.");
return true;
}
dcmd_login(playerid,params[])
{
#pragma unused params
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
if (!udb_Exists(PlayerName2(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'.");
if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'");
if (udb_CheckLogin(PlayerName2(playerid),params)) SystemMsg(playerid,"Successfully Logged In!"); else SystemMsg(playerid,"Login failed!"); {
}
GivePlayerMoney(playerid,dUserINT(PlayerName2(playerid)).("money")-GetPlayerMoney(playerid));
//Add Kills and Deaths To Current Game
MyDeaths[playerid] = (dUserINT(PlayerName2(playerid)).("deaths"));
MyKills[playerid] = (dUserINT(PlayerName2(playerid)).("kills"));
TeamKills[playerid] = (dUserINT(PlayerName2(playerid)).("teamkills"));
PLAYERLIST_authed[playerid]=true;
return 1;
}

