How to create filterscript for my own custom rcon commands
#1

Hello, I want to create few rcon commands, which I want to access through the console by rcon.
Any examples?
For example, I want to create command that promotes certain player to a certain Admin lvl. / VIP lvl.
Or a command that removes all nick/IP bans of a certain player by nick.

P.S.
For example, this is my current command for unban player.
I want to create an alternative rcon command like this, which I want to access from console.
Код:
dcmd_unban(playerid, params[])
	{
	if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, COLOR_RED, "You have no righs!");
	new target[30], user[128];
	if(sscanf(params, "s[30]", target)) return SendClientMessage(playerid, COLOR_ORANGE, "Use: /unban [player nick]");
	format(user, sizeof(user), "%s.ini", target);
	    if(INI_Exist(user))
	    {
	        new INI:File = INI_Open(user);
	        INI_SetTag(File,"Player's Data");
	        INI_WriteInt(File, "Banned", 0);
	        INI_Close(File);
			SendClientMessage(playerid,COLOR_ORANGE,"You can use /rcon unbanip [IP of the player] too!");
	    }
	    else
	    {
	        SendClientMessage(playerid, COLOR_RED, "This player is not existing!");
	        return 1;
	    }
	    return 1;
	}
Reply
#2

You first need an admin system / vip system. But here is an example

pawn Код:
CMD:yourcommandname(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) // Checks if player is rcon
    {
        // Do something here
    }
    else return SendClientMessage(playerid, -1, "You are not an RCON-Administrator"); // Send the error
    return 1;
}
Edit: Nevermind, didn't see "console"
Reply
#3

if you want a cmd only for the rcon you have to add this :


PHP код:
if(IsPlayerAdmin(playerid))
    {
        
// add what your cmd do here
    

Reply
#4

I have an admin system.
@GGW
I don't want command in the game, I want to connect to the server from console by rcon and to send commands to the server.
Reply
#5

He didn't say normal commands that have IsPlayerAdmin...

"Hello, I want to create few rcon commands, which I want to access through the console by rcon."

https://sampwiki.blast.hk/wiki/OnRconCommand

Use that ^

But you also can use this, which is easier:
https://sampforum.blast.hk/showthread.php?tid=88771
Reply
#6

I tried Fast rcon command processor: RCMD (modified DCMD)
But when I put that code in my gamemode, all rcon commands stop working.
Reply
#7

Any ideas for my question?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)