[FilterScript] Blank admin filterscript [y_ini]
#1

Hello everyone! I noticed a lot of new scripters are having problems with making an admin filterscript.
So I decided to make one for them, I know it's very simple, but they can edit this, and make one that they want.
This is just the base.

Information:

Gives 1 score and 1$ to the player that kills another player.
Saves score, money and deaths.

Usage:

Use " /setlevel [id] [level] " to make someone an admin.

Use " pStats[playerid][admin] >= level " to create a new command that can only be used by that level or higher.

Installation:

Download adminfs.pwn and adminfs.amx and copy them to "Filterscripts"
Download sscanf.dll and copy it to "Plugins"
Download sscanf.inc and copy it to "Pawno\include"
Download YSI and copy YSI.inc and the folder YSI to "Pawno\include"
Download Whirlpool and copy it to "Plugins"
Open your "server.cfg" with notepad and add adminfs and Whirlpool to the line filterscripts
Add a new line and call it plugins and add to it sscanf
Make a new folder in "scriptfiles" and call it "Users"

Credits:
#****** for sscanf, y_ini and Whirlpool
#Zeex for ZCMD
#newbienoob - I learned how to make an admin system from his tutorial.

Download:

sscanf: https://sampforum.blast.hk/showthread.php?tid=120356
YSI/y_ini: https://sampforum.blast.hk/showthread.php?pid=1696956#pid1696956
Whirlpool: https://sampforum.blast.hk/showthread.php?tid=65290
zcmd: https://sampforum.blast.hk/showthread.php?tid=91354

adminfs:
http://www.solidfiles.com/d/240f6fe191/
http://pastebin.com/nDm0mJAu

Note:

I'm working on a big admin filterscript, as I said before, this is a very simple one, it's the base.
Reply
#2

[15:42:41] [join] iRonan has joined the server (0:127.0.0.1)
[15:42:53] *** YSI Error: INI_Open could not find or create file Users/iRonan.ini
[15:43:28] RCON (In-Game): Player #0 (iRonan) has logged in.
[15:43:32] *** YSI Error: INI_Open could not find or create file Users/iRonan.ini

When I created an account and tried to set my level. D:

EDIT: Solved, thanks for sharing this.
Reply
#3

Small problem came up.

Код:
CMD:kick(playerid,params[])
{
    pStats[playerid][admin] >= 1;
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} USAGE: /kick <id>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"{FFFF00}[ADMIN]{FFFFFF} That player is not connected!");
    Kick(id);
    SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} You have kicked the selected user!");
    return 1;
}
Normal players can use this and this warning comes up when compiling:

Код:
C:\Documents and Settings\Administrator\Bureaublad\GTA\A_SampServers\OriginalServer\gamemodes\NewServer.pwn(333) : warning 215: expression has no effect
I can't remove the ; at
Код:
    pStats[playerid][admin] >= 1;
because errors show up then.
Reply
#4

Quote:
Originally Posted by [WA]iRonan
Посмотреть сообщение
Small problem came up.

Код:
CMD:kick(playerid,params[])
{
    pStats[playerid][admin] >= 1;
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} USAGE: /kick <id>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"{FFFF00}[ADMIN]{FFFFFF} That player is not connected!");
    Kick(id);
    SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} You have kicked the selected user!");
    return 1;
}
Normal players can use this and this warning comes up when compiling:

Код:
C:\Documents and Settings\Administrator\Bureaublad\GTA\A_SampServers\OriginalServer\gamemodes\NewServer.pwn(333) : warning 215: expression has no effect
I can't remove the ; at
Код:
    pStats[playerid][admin] >= 1;
because errors show up then.
This shouldn't be like this.
pStats[playerid][admin] >=1 is used like IsPlayerAdmin(playerid)
This is how you use it:
pawn Код:
CMD:kick(playerid,params[])
{
    if(pStats[playerid][admin] >= 1)
    {
        new id;
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} USAGE: /kick <id>");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"{FFFF00}[ADMIN]{FFFFFF} That player is not connected!");
        Kick(id);
        SendClientMessage(playerid,-1,"{FFFF00}[ADMIN]{FFFFFF} You have kicked the selected user!");
    }
    else
    {
        SendClientMessage(playerid,-4,"You need to be a higher admin level to use this.");
    }
    return 1;
}
Reply
#5

But, It doesn't save kills.
Reply
#6

Quote:
Originally Posted by iDuckling
Посмотреть сообщение
But, I doesn't save kills.
What do you exactly mean?
For me, I take score as kills.
Reply
#7

Quote:
Originally Posted by iDuckling
Посмотреть сообщение
But, I doesn't save kills.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(playerid != INVALID_PLAYER_ID)
	{
		pStats[playerid][deaths]++;
	}

	if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid))
	{
		pStats[killerid][score]++;
		pStats[killerid][money]++;
		GivePlayerMoney(killerid, 1);
		SetPlayerScore(killerid, pStats[killerid][score]);
	}
	return 1;
}
Reply
#8

Quote:
Originally Posted by [SF]OutLawZ
Посмотреть сообщение
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(playerid != INVALID_PLAYER_ID)
	{
		pStats[playerid][deaths]++;
	}

	if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid))
	{
		pStats[killerid][score]++;
		pStats[killerid][money]++;
		GivePlayerMoney(killerid, 1);
		SetPlayerScore(killerid, pStats[killerid][score]);
	}
	return 1;
}
I didn't actually add deaths.
But yeah.. That's how you save them.
Reply
#9

Quote:
Originally Posted by Stinged
Посмотреть сообщение
What do you exactly mean?
For me, I take score as kills.
I'm sorry, it was a mistake. I meant, IT. lol
Reply
#10

Thank you very much! It helps me to get started with admin system using Y_INI. Very useful. Thank you. +rep

But I don't get it, can you explain this one?
pawn Код:
public OnPlayerSpawn(playerid)
{
        ResetPlayerMoney(playerid);
        GivePlayerMoney(playerid, pStats[playerid][money]);
        SetPlayerScore(playerid, pStats[playerid][score]);
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)