Y_INI Help
#1

Hi. I have been recently Making An Login System. Heres My On Player Login
Code:
        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]);
                    PlayerInfo[playerid][pAdmin] = INI_Int(file, "Admin");
                }
                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;
}
Just Note The Line

Code:
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    PlayerInfo[playerid][pAdmin] = INI_Int(file, "Admin"); // This ONe
When I Add It, And Compile, The Pawno Stops Responding. All I Want Is To Load THe Admin File When I
Login. Please Help
Reply
#2

you just parsed the LoadUser_%s. So, you don't need to use

Code:
PlayerInfo[playerid][pAdmin] = INI_Int(file, "Admin"); // This ONe
It probably auto loads the stats when parsed! .. (in mine though).
Reply
#3

NVM i am wrong.
Reply
#4

INI_WriteInt(File,"Admin",0);

Other wise u can load or save as normal send link 2 yini ur using, the tut
Reply
#5

But... WHen I use /kick Command. It Says i need to be level 2 to use this cmd.

Heres My Kick cmd

Code:
CMD:kick(playerid,params[])
{
	new id,reason[128],name[MAX_PLAYER_NAME], string1[128];
	if(PlayerInfo[playerid][pAdmin] > 2)
	{
	    if(sscanf(params,"us[128]",id,reason)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /kick <id> <reason>");
	    else
	    {
	        format(string1,sizeof(string1),"%s have been kicked from the server: reason: %s",GetPlayerName(id,name,sizeof(name)),reason);
	        SendClientMessageToAll(COLOR_RED,string1);
	        Kick(id);
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "ERROR: You Need To Be Level 2 To Use This Command");
	}
	return 1;
}
Reply
#6

and that has 2 do with? that has nothing 2 do with kick in dialog, i said the link of the tutorialu used 2 make that

this should help
https://sampforum.blast.hk/showthread.php?tid=273088
REP ++ if i helped in any way
Reply
#7

Are you sure you are parsing the file correctly give us the custom public that you are parsing and the INI_ParseFile lines.
Reply
#8

PHP Code:
INI_ParseFile 
Loads the user's file and LOADS ALL OF HIS DATA. So remove the
PHP Code:
PlayerInfo[playerid][pAdmin] = INI_Int(file"Admin"); 
EDIT:

Give this command a shot!

PHP Code:
CMD:kick(playeridparams[])
{
    new 
aname [MAX_PLAYER_NAME], reason[128], string[128], tname [MAX_PLAYER_NAME], targetid;
    if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playeridRed"You must be a level 2 Admin to use this command!");
     if(
sscanf(params"us[128]"targetidreason)) return SendClientMessage(playeridYellow"Correct Usage: /kick [PlayerID] [Reason]");
     if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridYellow"Player is not connected to the server");
    
GetPlayerName(playeridanameMAX_PLAYER_NAME);
    
GetPlayerName(targetidtnameMAX_PLAYER_NAME);
    
format(stringsizeof(string), "Admin %s has kicked %s. Reason: %s"anametnamereason);
    
SendClientMessageToAll(Yellowstring);
    
Kick(targetid);
    return 
1;

Reply
#9

It doesn't work. There might be someway....
Reply
#10

You have to put
PHP Code:
INI_Int("Admin"PlayerInfo[playerid][pAdmin]); 
under LoadUser_data, then just use INI_ParseFile.
Reply
#11

Quote:

[pAdmin] > 2)

You're saying if the pAdmin is bigger than 2. So you're asking if the pAdmin equals 3 or bigger, if you want it to be a level 2 command, change it to:

Quote:

[pAdmin] >= 2)

That's if you want level 2 admins to use it.
Reply
#12

I Am Level 7

It Might Be A Probelm Of My Setlevel COmmand To

Code:
CMD:setlevel(playerid,params[])
{
	new id,level,n[MAX_PLAYER_NAME], str[265];
	new playername[MAX_PLAYER_NAME];
	new adminname [MAX_PLAYER_NAME];
	if(IsPlayerAdmin(playerid))
	{
	    if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setlevel <id> level[1-7]!");
		else
		{
	        if(level > 7) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setlevel <id> level[1-7]!");
			else
			{
			    
			    GetPlayerName(id,n,MAX_PLAYER_NAME);
   				GetPlayerName(player1, playername, sizeof(playername));
				GetPlayerName(playerid, adminname, sizeof(adminname));
			    
	        	new INI:File = INI_Open(UserPath(id));
	        	INI_WriteInt(File,"Admin",level); 
	        	INI_Close(File); 
    			format(str,sizeof(str),"You have set %s's level to %d",n,level);
        		SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
     			format(str,sizeof(str),"Administrator %s Has Set Your Level To %d",adminname,level);
     			SendClientMessage(player1,COLOR_LIGHTBLUE,str);
			}
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "ERROR: You Are Not Rcon Admin!");
	}
	return 1;
}
Heres My Setlevel Command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)