SA-MP Forums Archive
Admin system, without loging/register system. - 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: Admin system, without loging/register system. (/showthread.php?tid=603906)



Admin system, without loging/register system. - Beasthian - 29.03.2016

Can someone help me begin me script. I want all data to save under the user's nickname.

Please tell me how i could start the script.. I need these things to be saved under the nick name in a file

playeradminlevel
kills
deaths
cash

I have no idea how to begin i never scripted admin system or scripted where data gets saved


Re: Admin system, without loging/register system. - fuckingcruse - 29.03.2016

https://sampforum.blast.hk/showthread.php?tid=273088

Just don't use the login registering part. Make a command /makeadmin under that create the files. ( what we do under register dialog)


Re: Admin system, without loging/register system. - Beasthian - 29.03.2016

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <YSI\y_ini>

#if defined FILTERSCRIPT

#define PATH "/Users/%s.ini"

enum pInfo
{
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];


forward LoadUser_data(playerid,name[],value[]);
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("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
 	return 1;
}

stock UserPath(playerid)
{
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string,sizeof(string),PATH,playername);
	return string;
}

/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
	new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}


public OnPlayerDisconnect(playerid, reason)
{
	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_Close(File);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	PlayerInfo[killerid][pKills]++;
	PlayerInfo[playerid][pDeaths]++;
	return 1;
}

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}



#endif
well I have done this so far. I seem to have no errors, now how can i continue from this.


Re: Admin system, without loging/register system. - Beasthian - 29.03.2016

Accidental double post.Wrong post delete


Re: Admin system, without loging/register system. - itsCody - 29.03.2016

You do know without a proper registry/login system ANYBODY can join your server with ANY given name (may it be your name) and have complete access to admin commands?

What you're planning to make is just a security risk.

Also, get rid of this trash.
PHP код:
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;

Use Whirlpool.


Re: Admin system, without loging/register system. - Beasthian - 29.03.2016

Yes i understand, this is for a filterscript my gamemode already has a login system except i cant edit it.

Alright i got rid of it, so how can i continue


Re: Admin system, without loging/register system. - itsCody - 29.03.2016

You'll probably have to use PVARs to transfer values from your gamemode to the filterscript, unless there's an easier way of doing so.

https://sampwiki.blast.hk/wiki/Per-player_variable_system


Re: Admin system, without loging/register system. - Beasthian - 29.03.2016

i cant touch my gamemode... its and .amx file which i cant edit.

I just need to make a admin filter script. That the data saves to a file.