15.02.2012, 11:15
Hello,
I made Register And login System Today, It was going nice untill i saw scriptfiles....
i made myself administrator with makeadmin command (which was also made by myself) it worked fine but when i saw the file in scriptfiles it was something like admin = 0 password blah....
here is the actual code.
OnPlayerConnect Stuff.
OnPlayerDisconnect Stuff.
OnDialogResponce..
And here is the makeadmin command..
Whats Wrong
??
I made Register And login System Today, It was going nice untill i saw scriptfiles....
i made myself administrator with makeadmin command (which was also made by myself) it worked fine but when i saw the file in scriptfiles it was something like admin = 0 password blah....
here is the actual code.
Code:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Model",PlayerInfo[playerid][pModel]);
INI_Int("Muted",PlayerInfo[playerid][pMuted]);
INI_Int("Locked",PlayerInfo[playerid][pLocked]);
INI_Int("Warns",PlayerInfo[playerid][pWarns]);
INI_Int("Tester",PlayerInfo[playerid][pTester]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
Code:
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
Code:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Locked",PlayerInfo[playerid][pLocked]);
INI_WriteInt(File,"Warns",PlayerInfo[playerid][pWarns]);
INI_Close(File);
Code:
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Welcome To [DU]",""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,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SCM(playerid, COLOR_GREEN, "You've Successfully Registered! And Has Been Auto-Matically Logged In!");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SCM(playerid, COLOR_GREEN, "You Have Successfully Logged In!!");
SetSpawnInfo(playerid,0,164,-2380.1345,-578.2792,132.1117,123.4686,0,0,0,0,0,0);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
Code:
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /makeadmin [playerid/partofname] [level 1-5].");
else if (value < 0 || value > 5) return SendClientMessage(playerid, COLOR_RED, "Unknown level! Only 0 to 1338.");
else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED,"Invalid player id.");
else {
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You Have Promoted %s To Admin Level %i", tName, value);
SCM(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "You Have Been Promoted To Admin Level %i By %s", value, pName);
SCM(pID, COLOR_GREEN, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
??


