Well i will show you guys the login and register code system.
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1234)
{
if(!response) return Kick(playerid);
if(response)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
}
}
if(dialogid == 1)
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File, "Level",PlayerInfo[playerid][pLevel] = 1);
INI_WriteInt(File, "Money",PlayerInfo[playerid][pCash] = 0);
INI_WriteInt(File, "Admin",PlayerInfo[playerid][pAdmin] = 0);
INI_WriteInt(File, "Tester",PlayerInfo[playerid][pTester] = 0);
INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip] = 0);
INI_WriteInt(File, "Spawn", PlayerInfo[playerid][pSpawn] = 1);
INI_WriteInt(File, "Model", PlayerInfo[playerid][pModel] = 23);
INI_WriteInt(File, "Locked", PlayerInfo[playerid][pLocked] = 0);
INI_WriteInt(File, "FirstJoined", PlayerInfo[playerid][pFirstJoined] = 0);
INI_WriteInt(File, "Continent", PlayerInfo[playerid][pPlace] = 0);
INI_WriteInt(File, "Sex", PlayerInfo[playerid][pSex] = 0);
INI_WriteInt(File, "Selected", PlayerInfo[playerid][pSelected] = 1);
INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge] = 0);
INI_WriteInt(File, "Origin", PlayerInfo[playerid][pOrigin] = 0);
INI_WriteInt(File, "Respect", PlayerInfo[playerid][pExp] = 0);
INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns] = 0);
INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted] = 0);
INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime] = 0);
new rp = 100000 + random(899999);
INI_WriteInt(File, "Ph", PlayerInfo[playerid][pNumber] = rp);
INI_WriteInt(File, "DriveLic",PlayerInfo[playerid][pDriveLic] = 0);
INI_Close(File);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
}
if(dialogid == 2)
{
if(!response ) return Kick (playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SpawnPlayer(playerid);
gPlayerLogged[playerid] = 1;
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 3)
{
Kick(playerid);
}
}
}
}
if(dialogid == 155)
{
if(response)
{
if (listitem == 0)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, COLOR_YELLOW2,"So you are Male");
ShowPlayerDialog(playerid,156,DIALOG_STYLE_INPUT,"Age","How old are you?:((This information is IC.))","Next","Leave Game");
}
else if (listitem == 1)
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, COLOR_YELLOW2,"So you are Female");
ShowPlayerDialog(playerid,156,DIALOG_STYLE_INPUT,"Age","How old are you?:((This information is IC.))","Next","Leave Game");
}
}
else
{
Kick(playerid);
}
}
if(dialogid == 156)
{
if(response)
{
PlayerInfo[playerid][pAge] = strval(inputtext);
new string[64];
format(string, sizeof(string),"So you are %s years old", inputtext);
SendClientMessage(playerid, COLOR_YELLOW2, string);
new sexthings[] = " Europe \n America \n Russia";
if(strval(inputtext) <= 15)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: This is a 16+ Only Server, Grow up and Come Back.");
Kick(playerid);
return 1;
}
if(strval(inputtext) >= 60)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Incorrect Age, You need to enter a Real Age.");
ShowPlayerDialog(playerid,156,DIALOG_STYLE_INPUT,"Age","How old are you?:((This information is IC.))","Next","Leave Game");
return 1;
}
ShowPlayerDialog(playerid,157,DIALOG_STYLE_LIST,"Where are you from?:((This information is IC.))",sexthings,"Select","Leave Game");
}
else
{
Kick(playerid);
}
}
if(dialogid == 157)
{
if(response)
{
if (listitem == 0)
{
PlayerInfo[playerid][pPlace] = 1;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from the Europe.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 1)
{
PlayerInfo[playerid][pPlace] = 2;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from United States.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 2)
{
PlayerInfo[playerid][pPlace] = 3;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from Russia.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
gPlayerLogged[playerid] = 1;
new packthings[] = " Package 1 \n Package 2";
ShowPlayerDialog(playerid,158,DIALOG_STYLE_LIST,"Please select a package that you want to start with",packthings,"Select","Leave Game");
}
else
{
Kick(playerid);
}
}
if(dialogid == 158)
{
if(response)
{
if (listitem == 0)
{
new DialogString[1024];
format(DialogString, sizeof DialogString, "Level 2 \n 4 Respect Points \n 1000$");
ShowPlayerDialog(playerid,159,DIALOG_STYLE_MSGBOX,"Package 1", DialogString,"Accept","Back");
}
else if (listitem == 1)
{
new DialogString[1024];
format(DialogString, sizeof DialogString, "Level 1 \n 4000$");
ShowPlayerDialog(playerid,160,DIALOG_STYLE_MSGBOX,"Package 1", DialogString,"Accept","Back");
}
}
else
{
Kick(playerid);
}
}
if(dialogid == 159)
{
if(response)
{
new playerexp = PlayerInfo[playerid][pExp];
PlayerInfo[playerid][pExp] = playerexp + 4;
new playerlvl = PlayerInfo[playerid][pLevel];
PlayerInfo[playerid][pLevel] = playerlvl + 1;
GivePlayerCash(playerid, 1000);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_YELLOW2,"That's all, if you need help you can /helpme, have fun!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"A taxi has bringed you to the DMV so you can take your Drivers License");
SetPlayerPos(playerid, 1424.1869,-1696.1482,13.5469);
}
else
{
new packthings[] = "Package 1 \n Package 2";
ShowPlayerDialog(playerid,158,DIALOG_STYLE_LIST,"Please select a package that you want to start with",packthings,"Select","Leave Game");
}
}
if(dialogid == 160)
{
if(response)
{
GivePlayerCash(playerid, 4000);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_YELLOW2,"That's all, if you need help you can /helpme, have fun!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"A taxi has bringed you to the DMV so you can take your Drivers License");
SetPlayerPos(playerid, 1424.1869,-1696.1482,13.5469);
}
else
{
new packthings[] = "Package 1 \n Package 2";
ShowPlayerDialog(playerid,158,DIALOG_STYLE_LIST,"Please select a package that you want to start with",packthings,"Select","Leave Game");
}
}