SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/03/2013, 08:20 PM   #1
arathin
Big Clucker
 
arathin's Avatar
 
Join Date: Feb 2012
Posts: 153
Reputation: 9
Default New players are admins?

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.

Code:
	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;
}
__________________


_________________________________________________

My Releases:
[Map] Admin Island v1.0
[GameMode] UGO Gang-Wars
[GameMode] UGO Mini-Games

arathin is offline   Reply With Quote
Old 12/03/2013, 08:26 PM   #2
IstuntmanI
High-roller
 
IstuntmanI's Avatar
 
Join Date: Mar 2009
Location: Romania
Posts: 1,865
Reputation: 370
Default Re: New players are admins?

Reset the admin/vip variables at OnPlayerConnect.
__________________


IstuntmanI is offline   Reply With Quote
Old 12/03/2013, 08:27 PM   #3
Rock
Huge Clucker
 
Rock's Avatar
 
Join Date: Feb 2013
Location: C:\Windows\Rock.dll
Posts: 333
Reputation: 29
Default Re: New players are admins?

Ohh..nevermind, didn't see the post above.
__________________
Just Rock
Rock is offline   Reply With Quote
Old 12/03/2013, 08:34 PM   #4
Private200
High-roller
 
Private200's Avatar
 
Join Date: May 2012
Posts: 1,223
Reputation: 201
Default Re: New players are admins?

There's nothing wrong with the script you showed us, as Costel said, reset the admin variables in OnPlayerConnect or in OnPlayerSpawn.
__________________
Mood: Young, dumb and broke
Young, wild and free

Will return to the SAMP scene soon with the development of a new Trucking gamemode for my own server (which will also be new).
Looking for mappers to help me; PM if interested.
Private200 is offline   Reply With Quote
Old 12/03/2013, 08:38 PM   #5
arathin
Big Clucker
 
arathin's Avatar
 
Join Date: Feb 2012
Posts: 153
Reputation: 9
Default Re: New players are admins?

Alright thanks guys
__________________


_________________________________________________

My Releases:
[Map] Admin Island v1.0
[GameMode] UGO Gang-Wars
[GameMode] UGO Mini-Games

arathin is offline   Reply With Quote
Old 12/03/2013, 08:43 PM   #6
arathin
Big Clucker
 
arathin's Avatar
 
Join Date: Feb 2012
Posts: 153
Reputation: 9
Default Re: New players are admins?

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

Code:
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;
}
__________________


_________________________________________________

My Releases:
[Map] Admin Island v1.0
[GameMode] UGO Gang-Wars
[GameMode] UGO Mini-Games

arathin is offline   Reply With Quote
Old 12/03/2013, 08:48 PM   #7
2KY
High-roller
 
2KY's Avatar
 
Join Date: Jan 2012
Location: United States
Posts: 1,047
Reputation: 165
Default Re: New players are admins?

Quote:
Originally Posted by arathin View Post
Alright another question as my brain will not work today.. where should i put the resets?

Code:
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;
}
Code:
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;
}
__________________
Check out my wiki page
2KY is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I trust players who wants to be admins? nuriel8833 Everything and Nothing 21 08/06/2011 10:04 AM
Can't using commands. for players & admins, no one can do it Yaszine Help Archive 7 19/05/2010 08:30 AM
Players can ban admins and other players Laur13 Help Archive 5 06/04/2010 09:49 AM
MOVED: Players can ban admins and other players dugi Server Support 0 06/04/2010 09:01 AM
/answer for admins to send to players, Lia Help Archive 1 21/10/2009 08:43 AM


All times are GMT. The time now is 09:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.