ItsMods

Full Version: 2 plugin help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Camelot

hi
Could you do me two plugin?
InfectedRestart v3
PHP Code:
using System;
using Addon;
using System.Threading;
 
namespace 
InfRestart
{
    
//"<class name> : CPlugin" is needed to inherit the functions
    
public class InfRestart CPlugin
    
{
 
        public 
override void OnServerLoad()
        {
            
ServerPrint("InfectedRestart by JariZ loaded (ThreadPools: zxz0O0, Recompile: Pieter)");
        }
 
        public 
override void OnMapChange()
        {
            
NumThreads++;
            
ThreadPool.QueueUserWorkItem(new WaitCallback(irth));
        }
 
        public 
override void OnFastRestart()
        {
            
OnMapChange();
        }
 
        
int NumThreads 0;
 
        
void irth(object o)
        {
            try
            {
                
Thread.Sleep(20000); //wait 20 seconds for enabling (to avoid fast_restart looping on mapchange 15 seconds)
                
while (NumThreads 2)
                {
                    
int axis 0;
                    
int allies 0;
                    foreach (
ServerClient client in GetClients())
                    {
                        if (
client.Team == Teams.Alliesallies++;
                        else if (
client.Team == Teams.Axisaxis++;
                    }
 
                    if (
allies && axis == 0)
                    {
                        
ServerSay("^2 ^1 ^2-   ^35 "true);
                        
Thread.Sleep(5000);
                        
ServerCommand("fast_restart");
                    }
                    
Thread.Sleep(30000); // run again after 30 seconds
                
}
            }
            catch (
ThreadAbortException) { }
            
NumThreads--;
        }
    }


NextMap v1.1
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Addon;
using System.Collections;
 
namespace 
nextmap
{
    public class 
nextmap CPlugin
    
{
        
ArrayList user = new ArrayList();
        public 
string dsr;
        public 
override void OnServerLoad()
        {
            
ServerPrint("NextMap Loaded Author:YAMRAJ");
            
dsr GetServerCFG("NextMap""DSR Name""");
        }
 
        public 
override ChatType OnSay(string MessageServerClient Client)
        {
            if (
Message.StartsWith("!nextmap"))
            {
                if (
user.Contains(Client.XUID))
                {
                    
TellClient(Client.ClientNum"^1  !!"true);
                }
                else
                {
                    
user.Add(Client.XUID);
                    if (
GetDvar("nextmap") == "mp_alpha " dsr)
                    {
                        
ServerSay("^3 (^1Lockdown^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_bravo " dsr)
                    {
                        
ServerSay("^3 (^1Mission^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_dome " dsr)
                    {
                        
ServerSay("^3 p(^1Dome^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_bootleg " dsr)
                    {
                        
ServerSay("^3 (^1Bootleg^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_radar " dsr)
                    {
                        
ServerSay("^3 (^1Outpost^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_plaza2 " dsr)
                    {
                        
ServerSay("^3 (^1Arcaden^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_mogadishu " dsr)
                    {
                        
ServerSay("^3 (^1Bakaraa^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_lambeth " dsr)
                    {
                        
ServerSay("^3 (^1Fallen^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_paris " dsr)
                    {
                        
ServerSay("^3 (^1Resistance^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_seatown " dsr)
                    {
                        
ServerSay("^3 (^1Seatown^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_underground " dsr)
                    {
                        
ServerSay("^3 (^1Underground^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_hardhat " dsr)
                    {
                        
ServerSay("^3 (^1Hardhat^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_exchange " dsr)
                    {
                        
ServerSay("^3 (^1Downturn^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_village " dsr)
                    {
                        
ServerSay("^3 (^1Village^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_interchange " dsr)
                    {
                        
ServerSay("^3 (^1Interchange^3)"false);
                    }
                    else if (
GetDvar("nextmap") == "mp_carbon " dsr)
                    {
                        
ServerSay("^3 (^1Carbon^3)"false);
                    }
                }
                return 
ChatType.ChatNone;
            }
            return 
ChatType.ChatContinue;
        }
        public 
override void OnMapChange()
        {
            
user.Clear();
        }
    }

use my plugin maker to compile it :Sss
(03-23-2012, 13:58)JayDi Wrote: [ -> ]use visual studio to compile it :Sss

FTFY