convert to dialouge - 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)
+--- Thread: convert to dialouge (
/showthread.php?tid=335828)
convert to dialouge -
PaYkOK - 19.04.2012
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;
}
Re: convert to dialouge -
ReneG - 20.04.2012
Have you given this a shot yourself? There are
many tutorials on this.
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampforum.blast.hk/showthread.php?tid=273088
Re: convert to dialouge -
MeDaKewlDude - 20.04.2012
in the OnPlayerConnect enter this:
Код:
if (!udb_Exists(PlayerName2(playerid)))
{
ShowPlayerDialog(playerid,30,DIALOG_STYLE_INPUT ,"Register","enter your desired password here:","Register","Cancel");
}
else
{
ShowPlayerDialog(playerid,31,DIALOG_STYLE_INPUT ,"Login","please enter your password:","Login","Cancel");
}
and in the OnDialogResponse callback paste this:
Код:
switch(dialogid)
{
case(30)
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged in...");
if (udb_Create(PlayerName2(playerid),inputtext[]))
{
SystemMsg(playerid,"Account successfully created. please login.");
ShowPlayerDialog(playerid,31,DIALOG_STYLE_INPUT ,"Login","please enter your password:","Login","Cancel");
}
return true;
}
case(31)
{
if (udb_CheckLogin(PlayerName2(playerid),inputtext[])) 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;
}
}
Re: convert to dialouge -
PaYkOK - 20.04.2012
thanks +1