Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < a_samp >
- #include < YSI\y_ini >
- #include < YSI\y_inline >
- new pName[MAX_PLAYERS][25];
- new pIP[MAX_PLAYERS][30];
- new RegFile[MAX_PLAYERS][40];
- new Password[MAX_PLAYERS][30];
- new bool:Logged[MAX_PLAYERS];
- new Str[256];
- #define GetName(%0) pName[%0]
- #define GetIP(%0) pIP[%0]
- #define RFile(%0) RegFile[%0]
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, pName[playerid], 25);
- GetPlayerIp(playerid, pIP[playerid], 30);
- format(RegFile[playerid], sizeof RegFile, "Users/%s.ini", GetName(playerid));
- inline LoadPlayerData(string:name[], string:value[])
- {
- INI_String("Name", GetName(playerid), 25);
- INI_String("IP", GetIP(playerid), 30);
- INI_String("Password", Password[playerid], 30);
- }
- if(fexist(RFile(playerid)))
- {
- INI_ParseFile(RFile(playerid), using inline "LoadPlayerData");
- ShowPlayerDialog(playerid, 78, DIALOG_STYLE_INPUT, "{FF0000}Login", "{9E0000}Welcome, Please login to system", "äúçáø", "öà");
- }
- else
- {
- ShowPlayerDialog(playerid, 79, DIALOG_STYLE_INPUT, "{FF0000}Register", "{9E0000}Enter password to register\n{00FF2F}Welcome to the server", "äúçáø", "öà");
- }
- return true;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- new INI:File = INI_Open(RFile(playerid));
- INI_WriteString(File, "Name", GetName(playerid));
- INI_WriteString(File, "IP", GetIP(playerid));
- INI_WriteString(File, "Password", Password[playerid]);
- INI_Close(File);
- format(Str,sizeof Str,"{9E0000}éöà îäùøú {0800FF}%s {FFFFFF}:äùç÷ï",GetName(playerid));
- SendClientMessageToAll(-1, Str);
- return true;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(Logged[playerid] == false) return SendClientMessage(playerid, -1, "{9E0000}Are you don't login"),false;
- return true;
- }
- public OnPlayerText(playerid, text[])
- {
- if(Logged[playerid] == false) return SendClientMessage(playerid, -1, "{9E0000}Are you don't login"),false;
- return true;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 79)
- {
- if(!response) return Kick(playerid);
- strcat(Password[playerid], inputtext, 30);
- new INI:File = INI_Open(RFile(playerid));
- INI_WriteString(File, "Name", GetName(playerid));
- INI_WriteString(File, "IP", GetIP(playerid));
- INI_WriteString(File, "Password", Password[playerid]);
- INI_Close(File);
- Logged[playerid] = true;
- format(Str,sizeof Str, "{FFFFFF}Player: {9E0000}%s {0800FF}Login to server",GetName(playerid));
- SendClientMessageToAll(-1, Str);
- }
- if(dialogid == 78)
- {
- if(!response) return Kick(playerid);
- if(!strcmp(inputtext,Password[playerid],true))
- {
- Logged[playerid] = true;
- format(Str,sizeof Str, "{FFFFFF}Player: {9E0000}%s {0800FF}Regiter to server",GetName(playerid));
- SendClientMessageToAll(-1,Str);
- }
- else
- {
- ShowPlayerDialog(playerid, 78, DIALOG_STYLE_INPUT, "{FF0000}Login", "{9E0000}Enter password to login!", "äúçáø", "öà");
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment