Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help for writing a plugin
#1
hi there,
i git some questions i want to create my own plugin for the awsome mw3 server addon i startet with coding but i dont know how i can create a dll with this code with visual studio.. what must i do pls help a little noob..

My idea is a working war plugin like short chat text elements to control the server like: !fr -> fast_restart, !mr -> map_restart, !mr10 ->roundlimit 10, !map alpha -> map mp_alpha and so on...

Pls take a look i just copied the code from iAegle and changed the way it might be working for me:

using System;
using System.Collections.Generic;
using Addon;

namespace plugin_test
{

public class plugin_test : CPlugin
{
List<string> admins = new List<string>();
bool disable = false;
public override ChatType OnSay(string Message, ServerClient Client)
{
if (disable)
return ChatType.ChatAll;

if (Message.StartsWith("!fr") && admins.Contains(Client.XUID))
{
if (Message.Length <= 6)
TellClient(Client.ClientNum, "^2Admin: ^3Usage: [COMMAND]", true);
else
{
string cmd = Message.Substring(6);
ServerPrint(Client.Name + " used Admin command: \"" + cmd + "\"");
ServerCommand(fast_restart);
}

return ChatType.ChatNone;
}
return ChatType.ChatAll;
}

public override void OnServerLoad()
{
string l = GetServerCFG("RCON", "Admin_xuids", "");
if (l == "")
foreach (string xuid in l.Split(','))
admins.Add(xuid);

if (admins.Count == 0)
disable = true;

ServerPrint("Ingame RCON loaded. Author: M@C. Version: 1.0");
}
}
}

this i entered in visual studio but i cant create a working dll with this...
Pls Help a Noob
Greetz M@C
Reply

#2

there is no thing to restart server, setdvar(fast_restart dont work...
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#3
(01-09-2012, 21:59)Se7en Wrote: there is no thing to restart server, setdvar(fast_restart dont work...

so i got somethings running but got some problems...

if (Message.StartsWith("!mr") && admins.Contains(Client.XUID))
if (Message.Length <= 6)
TellClient(Client.ClientNum, "^2Admin: ^3Map Restart", true);
System.Threading.Thread.Sleep(5000);
ServerCommand("map_restart");
if (Message.StartsWith("!fr") && admins.Contains(Client.XUID))
if (Message.Length <= 6)
TellClient(Client.ClientNum, "^2Admin: ^3Fast Restart", true);
System.Threading.Thread.Sleep(5000);
ServerCommand("fast_restart");
if (Message.StartsWith("!paris") && admins.Contains(Client.XUID))
if (Message.Length <= 6)
TellClient(Client.ClientNum, "^2Admin: ^3Map changed to Revolution", true);
System.Threading.Thread.Sleep(5000);
ServerCommand("map mp_paris");

this works half its way i want that the server prints in Map restart and after 5 seconds he will do this but this dont work he just jumps to server command map mp_paris.. whtas wrong?? if dont enter sleep and messages everything works fine..
Reply

#4
(01-09-2012, 21:59)Se7en Wrote: there is no thing to restart server, setdvar(fast_restart dont work...

CSHARP Code
  1. ServerCommand("fast_restart");
[Image: azuw.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 3,901 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 4,373 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 38,440 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 5,270 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 4,652 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 57,879 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 17,430 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 2,536 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 30,649 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 2,859 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.