Need Help please - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need Help please (
/showthread.php?tid=499066)
Need Help please -
IbeatS - 06.03.2014
Hello,I got a script that any player enter with any admin name he can use all command before writing password ,can I get help plz ?
Re: Need Help please -
]Rafaellos[ - 06.03.2014
Create a Logged boolean and block all commands if player is not logged in.
Re: Need Help please -
Threshold - 06.03.2014
I take it you're using y_ini. I used to do this a lot when I started scripting too.
Basically, you just need to reset the variables after you've done INI_ParseFile. Or the better alternative would be, to load ONLY your password on OnPlayerConnect, and then the rest of the file when the player logs in.
Example:
Your code is currently something like:
pawn Код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(Userfile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
//Load the player's password, but this also loads everything else like 'Admin' and 'Money' etc.
ShowPlayerDialog(playerid, ... //Show the login dialog.
return 1;
}
Instead, you should have:
pawn Код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(Userfile(playerid), "LoadPassword_%s", .bExtra = true, .extra = playerid);
//Load ONLY the password, in a separate function.
ShowPlayerDialog(playerid, ... //show login dialog
return 1;
}
//When the player logs in:
INI_ParseFile(Userfile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
//Load the user's entire file once they log in.
Or another option is (NOT RECOMMENDED):
pawn Код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(Userfile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
//Load the whole user's file.
PlayerInfo[playerid][Admin] = 0; //Reset the admin level to 0.
ShowPlayerDialog(playerid, ... //Show the login dialog
return 1;
}
If you don't understand, or don't think you can do this yourself, feel free to send me your script and I will do it for you.