Hello All
I am trying to do a quick and simple Server Plugin where I have a list of
functions stored as text within a text file...
Example:
[cfg/plugin_commands.cfg]
request_admin
request_map
another_function
I have the following function which is coded in the Server Plugin:
void admin_src_func( void )
{
char *console_buffer =(char*) malloc(sizeof(char)*255);
memset(console_buffer,0,255);
edict_t *ed =
engine->PEntityOfEntIndex(g_EmtpyServerPlugin.GetCommandIndex()+1);
if(engine->GetPlayerNetworkIDString(ed) != NULL)
{
// Get player info of requested player.
IPlayerInfo *crapola = playerinfomanager->GetPlayerInfo(ed);
// Let the player know what they have requested.
strcpy(console_buffer,"You have requested an Admin.\n");
engine->ClientPrintf(ed, console_buffer);
strcpy(console_buffer,"[LOGGED] Command: ");
strcat(console_buffer,crapola->GetName());
strcat(console_buffer," used command ");
strcat(console_buffer,engine->Cmd_Argv(0));
strcat(console_buffer," ");
strcat(console_buffer,engine->Cmd_Args());
// Send console_buffer to LOG
engine->LogPrint( console_buffer );
}
free(console_buffer);
}
I know you use the following to point to the function:
ConCommand myPluginCommand( "request_admin", admin_src_func, "Help for this
command.", FCVAR_GAMEDLL );
Also where would I do all this?
I have tried different places, which all resulting in crashing the server.
Basically it needs to do the following:
1: On map change read plugin_commands.cfg
2: Register commands in file to function admin_src_func()
3: player sends command "request_admin server_name request_info"
Or
3: player sends command "request_map server_name request_info"
Or
3: player sends command "another_function server_name request_info"
Any help would be great.
Let me know if you require more info.
Thanks in advance.
Paul
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders