New players are admins?
#1

Alright guys so we have a bug in our script or at least I think its our script. The deal is whevener a new player joins they are either Admins lvl 1-5 or Vips lvl 1-3 Anyway to fix this? here is my register and login script.

Код:
	switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, 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,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Vip",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Ban",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Talent",0);
                INI_Close(File);

                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome to Urban-Gaming Online.\nWe Highly recommend you  re-log to successfully save your Account.","Ok","");
            }
        }

        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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, 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");
                }
                return 1;
            }
        }
	}
	return 1;
}
Reply
#2

Reset the admin/vip variables at OnPlayerConnect.
Reply
#3

Ohh..nevermind, didn't see the post above.
Reply
#4

There's nothing wrong with the script you showed us, as Costel said, reset the admin variables in OnPlayerConnect or in OnPlayerSpawn.
Reply
#5

Alright thanks guys
Reply
#6

Alright another question as my brain will not work today.. where should i put the resets?

Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
		
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
	if(PlayerInfo[playerid][pVip] >=1 )
	{
		SendClientMessage(playerid, COLOR_VIOLET, "Welcome back to Urban Gang-Wars, VIP. Make sure to use /vhelp for your special commands.");
	}
	return 1;
}
Reply
#7

Quote:
Originally Posted by arathin
Посмотреть сообщение
Alright another question as my brain will not work today.. where should i put the resets?

Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
		
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
	if(PlayerInfo[playerid][pVip] >=1 )
	{
		SendClientMessage(playerid, COLOR_VIOLET, "Welcome back to Urban Gang-Wars, VIP. Make sure to use /vhelp for your special commands.");
	}
	return 1;
}
Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
		
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
	if(PlayerInfo[playerid][pVip] >=1 )
	{
		SendClientMessage(playerid, COLOR_VIOLET, "Welcome back to Urban Gang-Wars, VIP. Make sure to use /vhelp for your special commands.");
	}

	PlayerInfo[playerid][pAdmin] = 0; // Reset the rest of them here as well.
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)