Page 1 of 1

iSnipe v1.0

Posted: Tue Dec 25, 2012 3:39 pm
by fiki574
Hello!

So, today I saw that NoFaTe released pre-release of new client and that he made an extension system! I decided to mess around with it a bit, and created this "iSnipe" mod (which isn't nowhere near same like CoD's one, but still it's nice)! And as NoFaTe stated, there are just few functions that we can use at this point, but I hope there will be more in future!

[syntax lang="csharp" lines=""]using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using Nexus;

namespace iSnipe
{
public class iSnipe : RomeExt
{
public static DamageInfo info; //damage information class
public static RomeSoldier soldier; //player-soldier information class
public static Timer timer = new Timer(100); //initialising our timer which will be called 10 times a second
public override void OnLevelLoading(string name, bool is_singleplayer) //our callback that gets called by server when loading a level
{
if (!is_singleplayer) //check if there's more than 1 player
{
SetInstantSpawnEnabled(true); //allow instant spawn after death
SetUnlimitedMagsEnabled(false); //disallow unlimited bullet magazines
SetUnlimitedAmmoEnabled(false); //disallow unlimited ammo storage
SetVehiclesEnabled(false); //disallow all vehicles in server
SetWeaponsEnabled(false, new List<string> { "M24" }); //disallow all weapons except M24 sniper rifle
SetAllowedKits(new List<string>() { "KIT_RECON" }); //disallow all kits except Recon kit
info.ExplosionDamage = false; //explosions will now do 0 damage
info.DemolitionDamage = false; //destroyed building which will collapse won't do any damage to players beneath them
info.Stamina = 0x7F800000; //set stamina to infinity a.k.a never stop sprinting
}
}

public override void OnLevelLoaded() //our callback that gets called by server when level has been loaded
{
TimerCheck(); //calling a timer check
}

public void TimerCheck() //our timer check
{
timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); //call event when 0.1 second passed
timer.Interval = 100; //interval is set to 0.1 second
timer.Enabled = true; //enable elapsed event handler
}

public void OnTimedEvent(object source, ElapsedEventArgs e) //our timed event for each 0.1 second
{
OnPlayerUpdate(soldier, info); //call update function
}

public void OnPlayerUpdate(RomeSoldier r_sold, DamageInfo d_info) //our update callback thats called each 100 milliseconds
{
//do stuff here
}

public override void OnExtensionLoaded() //our callback that gets called when extension is loaded
{
//do stuff here
}
}
}
[/syntax]

There are quite of few stuff missing, like anti-camping and limiting the marksmanship mode with a timer, but I'll add that in later versions of this mod! Though anti-camping can already be made with provided vectors and other functions, I just "canceled" that part for future! You can also see that some functions are empty (like "OnPlayerUpdate") -> that's because of the previously named reasons and lack of flexibility, but I can guarantee you that they'll be used in future updates of this extension!

And as a note, I haven't yet tested this mod, so if anyone wanna host it we can try it out together (just find me on TS)! ;)

Also, I was not sure for meanings of some functions, but I tried to guess what they are doing and I've commented them nicely!


Have fun and merry christmas!
Regards,
Fiki! :)

Re: iSnipe v1.0

Posted: Tue Dec 25, 2012 11:38 pm
by Avail
That's amazing !
When I finally can be arsed, I will get a server with your mod on it. :P

Re: iSnipe v1.0

Posted: Wed Dec 26, 2012 5:46 am
by rohunter
nice .. maybe well host it for a test ... just wait a few days ;) ok so my server its up ... if u need to test it just pm me .. and help me put it:))

Re: iSnipe v1.0

Posted: Wed Dec 26, 2012 6:34 pm
by fiki574
Avail wrote:That's amazing !
When I finally can be arsed, I will get a server with your mod on it. :P


rohunter wrote:nice .. maybe well host it for a test ... just wait a few days ;) ok so my server its up ... if u need to test it just pm me .. and help me put it:))


OK, thanks both! :)

Re: iSnipe v1.0

Posted: Thu Dec 27, 2012 4:07 am
by rohunter
fiki574 wrote:
Avail wrote:That's amazing !
When I finally can be arsed, I will get a server with your mod on it. :P


rohunter wrote:nice .. maybe well host it for a test ... just wait a few days ;) ok so my server its up ... if u need to test it just pm me .. and help me put it:))


OK, thanks both! :)

as i see u know coding .. can u help me with a mod ? i need 1 in the chamber mod ... one in pistol and one in riffle thx and waiting ur answere

Re: iSnipe v1.0

Posted: Thu Dec 27, 2012 8:29 am
by fiki574
rohunter wrote:as i see u know coding .. can u help me with a mod ? i need 1 in the chamber mod ... one in pistol and one in riffle thx and waiting ur answere


Well I could, but unfortunately there's no function(s) for bullet ammount manipulating (except for unlimited mag/ammo stored), so you'll have to wait until NoFaTe (and IF he) implements it into extension thingy! ;)

Re: iSnipe v1.0

Posted: Thu Dec 27, 2012 12:39 pm
by RobbingHood
Yeah, fiki is right. The extension system as it is now only offers very limited functions.

But NoFaTe is working on it, so maybe we can do something like a One-In-The-Chamber Mod soon.

NoFaTe wrote:Yes, as previously stated this is just a pre-release with a limited set of features.
More modding features will come in the near future.

Re: iSnipe v1.0

Posted: Thu Dec 27, 2012 7:06 pm
by fiki574
RobbingHood wrote:But NoFaTe is working on it, so maybe we can do something like a One-In-The-Chamber Mod soon.


Indeed! :)

Re: iSnipe v1.0

Posted: Thu Dec 27, 2012 10:35 pm
by rohunter
RobbingHood wrote:Yeah, fiki is right. The extension system as it is now only offers very limited functions.

But NoFaTe is working on it, so maybe we can do something like a One-In-The-Chamber Mod soon.

NoFaTe wrote:Yes, as previously stated this is just a pre-release with a limited set of features.
More modding features will come in the near future.

i have a wery good ideea for that mod ,,,, hope it can be done soune

Re: iSnipe v1.0

Posted: Tue Feb 19, 2013 4:31 am
by yolarrydabomb
inb4 this becomes a popular mod. :)