Register Script - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Register Script (
/showthread.php?tid=201769)
Register Script -
[NWA]Hannes - 22.12.2010
This doesnt work, it doesnt save any files and no sounds ever play.
OnPlayerConnect:
pawn Код:
if(udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
if(!udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_INPUT, "Register", "This name is not registered!\nYou can register it for you by typing in a password for it below.\nYou will use this password evry time you connect to this server.", "Register", "Cancel");
}
OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1500)
{
if(response)
{
new file[256];
udb_Create(GetName(playerid), inputtext);
GameTextForPlayer(playerid, "Registered", 3000, 4);
format(file,sizeof(file),"%s.sav",udb_encode(GetName(playerid)));
dini_Set(file,"password",inputtext);
PlayerPlaySound(playerid, 1056, 0, 0, 0);
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
if(!response)
{
Kick(playerid);
}
return 1;
}
if(dialogid == 1501)
{
if(response)
{
if(udb_CheckLogin(GetName(playerid), inputtext))
{
GameTextForPlayer(playerid, "Logged in!", 3000, 4);
PlayerPlaySound(playerid, 1057, 0, 0, 0);
}
}
if(!response)
{
Kick(playerid);
}
return 1;
}
return 0;
}
Re: Register Script -
HyperZ - 22.12.2010
Right different id's
it should be
OnPlayerConnect
pawn Код:
if(!udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Register", "This name is not registered!\nYou can register it for you by typing in a password for it below.\nYou will use this password evry time you connect to this server.", "Register", "Cancel");
}
if(udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2002)
{
if(response)
{
new file[256];
udb_Create(GetName(playerid), inputtext);
GameTextForPlayer(playerid, "Registered", 3000, 4);
format(file,sizeof(file),"%s.sav",udb_encode(GetName(playerid)));
dini_Set(file,"password",inputtext);
PlayerPlaySound(playerid, 1056, 0, 0, 0);
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
if(!response)
{
Kick(playerid);
}
return 1;
}
if(dialogid == 2003)
{
if(response)
{
if(udb_CheckLogin(GetName(playerid), inputtext))
{
GameTextForPlayer(playerid, "Logged in!", 3000, 4);
PlayerPlaySound(playerid, 1057, 0, 0, 0);
}
}
if(!response)
{
Kick(playerid);
}
return 1;
}
return 0;
}