Admin Rcon system
#1

hey everybody!!,
i have a question i want to make an admin system that i can kick someone out of the room and things like that but only available when you play with the Rcon password.

And how do i make a command that you can report someone?

srry if bad English but i'm Dutch
THNX for interrest and maybe helpin
Reply
#2

pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]");
            format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
            ABroadCast(COLOR_LIGHTYELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
        }
        return 1;
    }
/report Cmd

EDIT: Here RCON cmds
/rcon cmdlist - Shows a list with commands.
/rcon varlist - Shows a list with the current variables.
/rcon exit - Closes the server.
/rcon echo [text] - Shows the [text] in the console of the server (NOT the client-console in-game).
/rcon hostname [name] - change the hostname text (example: /rcon hostname my server).
/rcon gamemodetext [name] - change the gamemode text (example: /rcon gamemodetext my gamemode).
/rcon mapname [name] - change the map name text (example: /rcon mapname San Andreas).
/rcon exec [filename] - Executes the file which contains server cfg (example: /rcon exec blah.cfg).
/rcon kick [ID] - Kick the player with the given ID (example: /rcon kick 2).
/rcon ban [ID] - Ban the player with the given ID (example: /rcon ban 2).
/rcon changemode [mode] - This command will change the current gamemode to the given one (example: if you want to play sftdm: /rcon changemode sftdm).
/rcon gmx - Will load the next gamemode in server.cfg.
/rcon reloadbans - reloads the samp.ban where the banned IP addresses are stored. This will clear all the IP-addresses.
/rcon reloadlog - clears the server_log.txt.
/rcon say - shows a message to the players in the client-console (example: /rcon say blah).
/rcon players - Shows the players that are in the server (with their name, IP & ping).
/rcon banip [IP] - Ban the given IP (example: /rcon banip 127.0.0.1).
/rcon unbanip [IP] - Unban the given IP (example: /rcon unbanip 127.0.0.1).
/rcon gravity - Changes the gravity (example: /rcon gravity 0.00.
/rcon weather [ID] - Changes the weather (example: /rcon weather 1).
/rcon loadfs - Loads the given filterscript (example: /rcon loadfs adminfs).
/rcon unloadfs - Unload the given filterscript (example: /rcon unloadfs adminfs).
/rcon reloadfs - Reloads the given filterscript (example: /rcon reloadfs adminfs).
/rcon rcon_password [PASSWORD] - Change the rcon's password
Reply
#3

@WoodPecker
okay i putted it in the script but i get these errors:

Код:
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(307) : error 017: undefined symbol "cmd"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 017: undefined symbol "sendername"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 017: undefined symbol "sendername"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : error 029: invalid expression, assumed zero
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(311) : fatal error 107: too many error messages on one line
Reply
#4

Actually for kick/ban/admin chat only for RCON admins just add into your server.cfg
PHP код:
filterscripts baseaf 
Reply
#5

Add this at OnPlayerCommandText:

new sendername[MAX_PLAYER_NAME];
new cmd[128];
cmd = strtok(cmdtext, idx);
Reply
#6

@WoodPecker
okay but i don't know where to put it exactly in OnPlayerCommandText.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// do something here
		return 1;
	}
	if(strcmp("/report", cmdtext,true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]");
            format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
            ABroadCast(COLOR_LIGHTYELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
        }
        return 1;
    }
	return 0;
}
@[MG]Dimi
idk what you mean because when i put baseaf in filterscript line it doesn't make any difference
Reply
#7

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new sendername[MAX_PLAYER_NAME];
new cmd[128];
cmd = strtok(cmdtext, idx);
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // do something here
        return 1;
    }
    if(strcmp("/report", cmdtext,true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [text]");
            format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
            ABroadCast(COLOR_LIGHTYELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your report message was sent to online administrators, thank you.");
        }
        return 1;
    }
    return 0;
}
Here
Reply
#8

baseaf is Basic Admin FIlterscript that you get together with server. It has /ban, /kick, #(for admin chat), antiflood and /pm command. /kick, /ban and Admin chat can use only logged RCON Admin and you asked for
Quote:

...to make an admin system that i can kick someone out of the room and things like that but only available when you play with the Rcon password.

Reply
#9

Quote:
Originally Posted by WoodPecker
Посмотреть сообщение
Add this at OnPlayerCommandText:

new sendername[MAX_PLAYER_NAME];
new cmd[128];
cmd = strtok(cmdtext, idx);
Why STRTOK?

For a /report command, here it is.

Requirements :

ZCMD

SSCANF2

pawn Код:
stock pName( playerid ) {
    new b[ 24 ];
    return GetPlayerName( playerid, b, 24 ), b;
}

COMMAND:report( playerid, params[ ] )
{
    new
        userid,
        reason[ 64 ]
    ;

    if ( sscanf( params, "us[64]", userid, reason ) )
       return SendClientMessage( playerid, -1, "{FFDD00}/Report < PartOfName/ID > < Reason >" );

    if ( userid == playerid )
        return SendClientMessage( playerid, -1, "{FFDD00}You cannot report yourself." );

    if ( userid == INVALID_PLAYER_ID )
        return SendClientMessage( playerid, -1, "{FFDD00}Invalid player." );

    SendClientMessage( playerid, -1, "{FFDD00}Report has been sent to the online RCON administrators." );

    for ( new j = GetMaxPlayers( ), i; i < j; i ++ )
    {
        if ( !IsPlayerConnected( i ) )
            continue;

        if ( IsPlayerAdmin( i ) )
        {
            new
                szReportString[ 128 ]
            ;

            format( szReportString, sizeof szReportString, "Report from %s: %s(%d) = %s.",
                pName( playerid ), pName( userid ), userid, reason );

            SendClientMessage( i, 0xAA0000AA, szReportString );
        }
    }

    return 1;
}
Use BASE.PWN ( Filterscript, included in the default server folder ) for /kick, /ban, /pm commands.
Reply
#10

@WoodPecker
now i get these errors:
Код:
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(309) : error 017: undefined symbol "strtok"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(309) : error 033: array must be indexed (variable "cmd")
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(310) : warning 217: loose indentation
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(321) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(323) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(323) : warning 215: expression has no effect
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(325) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(327) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(329) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(330) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(330) : warning 215: expression has no effect
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(332) : error 017: undefined symbol "idx"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 017: undefined symbol "string"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 017: undefined symbol "string"
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : error 029: invalid expression, assumed zero
D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\LSF4A.pwn(334) : fatal error 107: too many error messages on one line
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)