Thread Rating:
  • 6 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release XP Manager V1.75 Fixed & Source Code
#1
Thumbs Up 
Hi people, this is my first shit coded-compiled EVER. This is not much useful, but im happy releasing something Smile
Also report bugs and +rep will help my reputation Wink
EDIT: YOU NEED THE Pozzuh's ADMIN PLUGIN OR ALL PEOPLE WILL BE ABLE TO CHANGE IT
New version now out! Use !setupxp at the first time you use this version!
Usage:
Code:
!setupxp                             <= Use this at first time!!!
!xp      [Number Optional]   <= XP Per Kill
!hxp    [Number Optional]   <= XP Per HeadShot
!sxp    [Number Optional]   <= XP Per Suicide
Example:

!hxp <= This will show how many XP do you get per HeadShot.

!sxp 1000 <= You will get 1000 XP per suicide.

Source Code:
Code:
using Addon;
using System;
using System.IO;
namespace xpmanager
{
    public class xpmanagerclass : CPlugin
    {
        public override void OnServerLoad()
        {
            ServerPrint("XP Manager V1.75 Loaded Successfully. Author: slipknotignacio");
        }
        public override ChatType OnSay(string Message, ServerClient Client)
        {
            if (Message.StartsWith("!setupxp"))
            {
                if (GetDvar("scr_dm_score_kill") == "")
                {
                    string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
                    string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
                    foreach (string file in files)
                        if (file.ToLower().EndsWith("server.cfg"))
                            Path = file;
                    string text = File.ReadAllText(Path) +
                        "\nseta scr_dm_score_kill \"100\"";
                    File.WriteAllText(Path, text);
                    TellClient(Client.ClientNum, "Kill XP fixed. You need to restart the map.", true);
                }
                else
                {
                    TellClient(Client.ClientNum, "You dont need to setup Kill XP. Its OK.", true);
                }
                if (GetDvar("scr_dm_score_headshot") == "")
                {
                    string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
                    string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
                    foreach (string file in files)
                        if (file.ToLower().EndsWith("server.cfg"))
                            Path = file;
                    string text = File.ReadAllText(Path) +
                        "\nseta scr_dm_score_headshot \"100\"";
                    File.WriteAllText(Path, text);
                    TellClient(Client.ClientNum, "HeadShot XP fixed. You need to restart the map.", true);
                }
                else
                {
                    TellClient(Client.ClientNum, "You dont need to setup HeadShot XP. Its OK.", true);
                }
                if (GetDvar("scr_dm_score_suicide") == "")
                {
                    string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
                    string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
                    foreach (string file in files)
                        if (file.ToLower().EndsWith("server.cfg"))
                            Path = file;
                    string text = File.ReadAllText(Path) +
                        "\nseta scr_dm_score_suicide \"0\"";
                    File.WriteAllText(Path, text);
                    TellClient(Client.ClientNum, "Suicide XP fixed. You need to restart the map.", true);
                }
                else
                {
                    TellClient(Client.ClientNum, "You dont need to setup Suicide XP. Its OK.", true);
                }
                return ChatType.ChatNone;
            }
                string lowMsg = Message.ToLower();
                if (lowMsg.StartsWith("!xp"))
                {
                    string[] splitMsg = lowMsg.Split(' ');
                    String xp = GetDvar("scr_dm_score_kill");
                    if (splitMsg.Length == 1)
                        TellClient(Client.ClientNum, "^1Your Current Kill XP Is: " + xp, true);
                    else
                    {
                        try
                        {
                            int NewXPValue = Convert.ToInt32(splitMsg[1]);
                            string qxp = NewXPValue.ToString();
                            SetDvar("scr_dm_score_kill", qxp);
                            TellClient(Client.ClientNum, "^1Kill XP Changed To: " + NewXPValue, true);
                        }
                        catch (Exception e)
                        {
                            TellClient(Client.ClientNum, "^1Invalid Kill XP Value!", true);
                        }
                    }
                    return ChatType.ChatNone;
                }

                if (lowMsg.StartsWith("!hxp"))
                {
                    string[] splitMsg = lowMsg.Split(' ');
                    String hxp = GetDvar("scr_dm_score_headshot");
                    if (splitMsg.Length == 1)
                        TellClient(Client.ClientNum, "^1Your Current HeadShot XP Is: " + hxp, true);
                    else
                    {
                        try
                        {
                            int NewHXPValue = Convert.ToInt32(splitMsg[1]);
                            string qhxp = NewHXPValue.ToString();
                            SetDvar("scr_dm_score_headshot", qhxp);
                            TellClient(Client.ClientNum, "^1HeadShot XP Changed To: " + NewHXPValue, true);
                        }
                        catch (Exception e)
                        {
                            TellClient(Client.ClientNum, "^1Invalid HeadShot XP Value!", true);
                        }
                    }
                    return ChatType.ChatNone;
                }

                if (lowMsg.StartsWith("!sxp"))
                {
                    string[] splitMsg = lowMsg.Split(' ');
                    String sxp = GetDvar("scr_dm_score_suicide");
                    if (splitMsg.Length == 1)
                        TellClient(Client.ClientNum, "^1Your Current Suicide XP Is: " + sxp, true);
                    else
                    {
                        try
                        {
                            int NewSuicideXPValue = Convert.ToInt32(splitMsg[1]);
                            string qsxp = NewSuicideXPValue.ToString();
                            SetDvar("scr_dm_score_suicide", qsxp);
                            TellClient(Client.ClientNum, "^1Suicide XP Changed To: " + NewSuicideXPValue, true);
                        }
                        catch (Exception e)
                        {
                            TellClient(Client.ClientNum, "^1Invalid Suicide XP Value!", true);
                        }
                    }
                    return ChatType.ChatNone;
                }
                return ChatType.ChatContinue;
            }
        }
    }

Changelog V1.75
Code:
Fixed major bug when the commands doesnt work if you dont have already set the values in your server.cfg
Code optimized

Changelog V1.00
Code:
Initial Release

Credits:
Me => Obvious
Users of ItsMods => To Releasing their source code and I studied it
Pozzuh and iAegle => For the big help

Virus Scan: https://www.virustotal.com/file/ead3e254...327141949/

MD5: 9AB2204C6BBDAED70E87275A7F265764


Attached Files
.rar   xp manager v1.75 fixed.rar (Size: 3 KB / Downloads: 408)
Reply

#2
You use a lot of my script, but no credits?
[Image: MaEIQ.png]
Reply

#3
(01-20-2012, 18:30)Pozzuh Wrote: You use a lot of my script, but no credits?

Your code? There's not really a different way for doing this, so its not your code Troll But you did help him
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#4
(01-20-2012, 18:35)iAegle Wrote:
(01-20-2012, 18:30)Pozzuh Wrote: You use a lot of my script, but no credits?

Your code? There's not really a different way for doing this, so its not your code Troll But you did help him

If you look at the help thread you could see he used 'lowMsg' like me, and startswith() instead of other pleople's ways.

Anyway, it's fine now, nice release.
[Image: MaEIQ.png]
Reply

#5
Also, how did you make the plugin? With Visual C#/Studio or with something else? Because Visual C#/Studio really help with the IntelliSense thingy. Whenever you type a function name they automatically tell you which parameters the function needs and what type the next parameter is (int, string etc) so you wouldn't have had the error Wink
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#6
(01-20-2012, 18:50)iAegle Wrote: Also, how did you make the plugin? With Visual C#/Studio or with something else? Because Visual C#/Studio really help with the IntelliSense thingy. Whenever you type a function name they automatically tell you which parameters the function needs and what type the next parameter is (int, string etc) so you wouldn't have had the error Wink

Well, I didnt say that I have a error, it was all ok, but not working. And I use Visual C# 2010
Reply

#7
(01-20-2012, 18:52)slipknotignacio Wrote:
(01-20-2012, 18:50)iAegle Wrote: Also, how did you make the plugin? With Visual C#/Studio or with something else? Because Visual C#/Studio really help with the IntelliSense thingy. Whenever you type a function name they automatically tell you which parameters the function needs and what type the next parameter is (int, string etc) so you wouldn't have had the error Wink

Well, I didnt say that I have a error, it was all ok, but not working. And I use Visual C# 2010

Hmmm, because you converted it to an integer and the function requires a string so it should show an error :o
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#8
k well, you say you use other people's sourcecodes, so why don't post it yourself?
Reply

#9
(01-20-2012, 18:58)jariz Wrote: k well, you say you use other people's sourcecodes, so why don't post it yourself?

sorry, what do you mean?
Reply

#10
(01-20-2012, 19:02)slipknotignacio Wrote:
(01-20-2012, 18:58)jariz Wrote: k well, you say you use other people's sourcecodes, so why don't post it yourself?

sorry, what do you mean?

Post le source code
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] [SOURCE] Random Weapons. [HARD] Tony. 1 4,106 11-08-2013, 11:11
Last Post: Nekochan
  Help source random weapons [HARD] Tony. 4 4,699 11-08-2013, 05:25
Last Post: [HARD] Tony.
  [Request] Health and Points on hud source robinvm 7 5,590 10-27-2013, 08:23
Last Post: robinvm
  Help Code color crosshairs koren30 3 4,015 10-02-2013, 19:26
Last Post: koren30
  [Release] [SOURCE] DOOR V2.0 [HARD] Tony. 5 5,332 09-26-2013, 14:01
Last Post: Nekochan
  Help need help?how to make plugins code hXnarutoXone 12 8,542 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,309 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,129 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,674 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,635 07-28-2013, 01:52
Last Post: First_Semyon

Forum Jump:


Users browsing this thread:
2 Guest(s)

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