Admin system, without loging/register system.
#1

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
Reply
#2

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)
Reply
#3

Код:
// 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.
Reply
#4

Accidental double post.Wrong post delete
Reply
#5

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.
Reply
#6

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
Reply
#7

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
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)