You are not logged in.

Dear visitor, welcome to sourceserver.info. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

karow

Beginner

  • "karow" started this thread

Posts: 13

wcf.user.option.userOption53: Ja

  • Send private message

1

Saturday, December 31st 2011, 12:31am

Plugin zum ausführen von configs

Hallo Leute,

also ich habe mich an einem Plugin versuch, mit dem man per cvar eine cfg ausführt, executed.
Leider kommt bei mir immer, nachdem ich den Kommand in die Konsole eingebe:

Quoted

exec <filename> [path id]: execute a script file
Hier mal mein Plugin:

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <sourcemod>
#define TCFG            "tcfgs/train0.cfg"

public Plugin:myinfo =
{
name "Karows",
author "Karow",
description "Plugin 1",
version "1.2",
url ""
};

public OnPluginStart()
{
RegConsoleCmd("sm_train",Command_train);
}

public Action:Command_train(clientsargs)
{
    ServerCommand("exec"TCFG)
}


Kann mir da jemand helfen?
Danke :bigri:
mfg
Der Karow

GamerzHost.de !
http://www.gamerzhost.de/CSS-Server

Impact

Super Moderator

Posts: 1,276

wcf.user.option.userOption53: Nein

  • Send private message

2

Saturday, December 31st 2011, 12:44am

Das Plugin ist zwar nicht gerade vorbildlich aber.

PHP Source code

1
ServerCommand("exec"TCFG)

goes to:

PHP Source code

1
ServerCommand("exec %s"TCFG);

Siehe hier und hier.
Eine andere Möglichkeit wäre so etwas:

PHP Source code

1
2
3
new String:comBuf[64];
Format(comBufsizeof(comBuf), "exec "%s""TCFG);
ServerCommand(comBuf);

Das kannst du dann benutzen wenn dein Script etwas komplexer wird.

PS: Das ist keine Cvar sondern ein Command, daher auch RegConsoleCmd

MfG
Impact

This post has been edited 4 times, last edit by "Impact" (Dec 31st 2011, 1:01am)


karow

Beginner

  • "karow" started this thread

Posts: 13

wcf.user.option.userOption53: Ja

  • Send private message

3

Saturday, December 31st 2011, 3:02pm

DANKE !!

*CLOSE PLS* :) :wilk:
mfg
Der Karow

GamerzHost.de !
http://www.gamerzhost.de/CSS-Server

Similar threads