Пример #1
0
/*
============
Cmd_RemoteSetPermission
Changes minimum-PowerLevel of a command
============
*/
void SV_RemoteCmdSetPermission(char* command, int power)
{


    NV_ProcessBegin();
    if(Cmd_SetPower(command, power))
    {
        SV_PrintAdministrativeLog("changed required power of cmd: %s to new power: %i", command, power);
        Com_Printf("changed required power of cmd: %s to new power: %i\n", command, power);
    }else{
        Com_Printf("Failed to change power of cmd: %s Maybe this is not a valid command.\n", command);
    }
    NV_ProcessEnd();
}
Пример #2
0
qboolean Cmd_InfoSetPower( const char *infostring )
{
        int power;
        char cmdname[40];

        power = atoi(Info_ValueForKey(infostring, "power"));
        Q_strncpyz(cmdname, Info_ValueForKey(infostring, "cmd"), sizeof(cmdname));

        if(!Cmd_SetPower(cmdname, power)){
            Com_DPrintf("Warning: Commandname %s is not known yet\n", cmdname);
            return qfalse;
        }
        return qtrue;

}
Пример #3
0
void GScr_AddScriptCommand()
{

    if(Scr_GetNumParam() != 2)
    {
        Scr_Error("Usage: addScriptCommand <commandname> <default powerpoints is number between 1 and 100>");
        return;
    }
    const char* command = Scr_GetString(0);
    int defaultpower = Scr_GetInt(1);

    if(command[0] == '\0')
    {
        Scr_Error("addScriptCommand: empty command");
        return;
    }

    Cmd_AddCommandGeneric(command, NULL, GScr_ScriptCommandCB, qfalse);
    Cmd_SetPower(command, defaultpower);

}
Пример #4
0
P_P_F void Plugin_AddCommand(char *name, xcommand_t xcommand, int power)
{
    volatile int pID;
    pID = PHandler_CallerID();
    if(pID>=MAX_PLUGINS){
        Com_PrintError("Tried adding a command for a plugin with non existent pID. pID supplied: %d.\n",pID);
        return;
    }else if(pID<0){
        Com_PrintError("Plugin_AddCommand called from not within a plugin or from a disabled plugin!\n");
        return;
    }
    if(!pluginFunctions.plugins[pID].loaded){
        Com_PrintError("Tried adding a command for not loaded plugin! PID: %d.\n",pID);
    }
    Com_DPrintf("Adding a plugin command for plugin %d, command name: %s.\n",pID,name);
    Cmd_AddCommand(name,PHandler_CmdExecute_f);
    Cmd_SetPower(name, power);
    pluginFunctions.plugins[pID].cmd[pluginFunctions.plugins[pID].cmds].xcommand = xcommand;
    strcpy(pluginFunctions.plugins[pID].cmd[pluginFunctions.plugins[pID].cmds++].name,name);
    Com_DPrintf("Command added.\n");
   // pluginFunctions.plugins[pID].


}
Пример #5
0
void SV_RemoteCmdInit(){

    sv_rconsys = Cvar_RegisterBool("sv_rconsys", qtrue, CVAR_ARCHIVE, "Disable/enable the internal remote-command-system");

    if(!sv_rconsys->boolean) return;

    //Init the permission table with default values
    Cmd_ResetPower();

    Cmd_SetPower("cmdlist", 1);
    Cmd_SetPower("serverinfo", 1);
    Cmd_SetPower("systeminfo", 1);
    Cmd_SetPower("ministatus", 1);
    Cmd_SetPower("status", 30);
    Cmd_SetPower("dumpuser", 40);
    Cmd_SetPower("kick", 35);
    Cmd_SetPower("tempban", 50);
    Cmd_SetPower("unban", 50);
    Cmd_SetPower("permban", 80);
    Cmd_SetPower("btempban", 80);
    Cmd_SetPower("bpermban", 70);
    Cmd_SetPower("map", 60);
    Cmd_SetPower("map_restart", 50);
    Cmd_SetPower("adminlist", 90);
    Cmd_SetPower("cmdpowerlist", 90);
    Cmd_SetPower("tell", 60);
    Cmd_SetPower("say", 60);
    Cmd_SetPower("screentell", 70);
    Cmd_SetPower("screensay", 70);
    Cmd_SetPower("dumpbanlist", 30);
    Cmd_SetPower("setcmdminpower", 95);
    Cmd_SetPower("setadmin", 95);
    Cmd_SetPower("unsetadmin", 95);
    Cbuf_AddText("addCommand gametype \"set g_gametype $arg; map_restart\"\n");
    Cmd_SetPower("gametype", 60);
    Cmd_SetPower("authLogin", 1);
    Cmd_SetPower("authChangePassword", 10);
    Cmd_SetPower("authSetAdmin",95);
    Cmd_SetPower("authUnsetAdmin",95);

    cmdInvoker.currentCmdPower = 100; //Set the default to 100 to prevent any blocking on local system. If a command gets remotely executed it will be set temporarely to the expected power
    //Now read the rest from file - Changed this will happen by executing nvconfig.cfg (nonvolatile config)
    cmdSystemInitialized = qtrue;
}