These are chat archives for ikkentim/SampSharp

9th
Oct 2016
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 01:12
@ikkentim How do you SetWorldTime?
SomeDevil
@SomeDevil
Oct 09 2016 09:14
@NewbProgramming erm. SetWorldTime(12);
SomeDevil
@SomeDevil
Oct 09 2016 09:22
P.S. it's a static method in Server class
SomeDevil
@SomeDevil
Oct 09 2016 11:06
@ikkentim http://sampsharp.timpotze.nl/player-commands-vnext#permissions is this up to date documentation? cause it's not working for me :(
Tim Potze
@ikkentim
Oct 09 2016 14:43
Permission stuff needs fixing :/ will be in the next patch
Tim Potze
@ikkentim
Oct 09 2016 15:07
Fixed it just now. So will be in the next patch.
SomeDevil
@SomeDevil
Oct 09 2016 15:07
that's nice!
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 17:39
@SomeDevil Thank you.
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 18:42
It's BasePlayer not GtaPlayer right?
SomeDevil
@SomeDevil
Oct 09 2016 18:43
in 0.7 yes
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 18:43
Alright.
Thought so
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:00
What does e.PreventPropagation in PlayerUpdateEventArgs do? Is it like Sync control?
Tim Potze
@ikkentim
Oct 09 2016 19:00
true = 0 and false = 1 in this case.
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:02
So e.PreventPropagation = true; will make it so the player moves around but other players does not see the movement?
Tim Potze
@ikkentim
Oct 09 2016 19:02
yes
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:02
Alright thank you man.
Very useful
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:13
e.ReturnToClassSelection = true; did not work. (SpawnEventArgs)
Tim Potze
@ikkentim
Oct 09 2016 19:14
it just returns 0 like here http://wiki.sa-mp.com/wiki/OnPlayerSpawn
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:15
Oh okay so I need to make a timer to SpawnPlayer and it will work?
Tim Potze
@ikkentim
Oct 09 2016 19:15
I've no idea what you're trying to achieve.
Florian van Dillen
@fvandillen
Oct 09 2016 19:15
World domination, most likely :D
Tim Potze
@ikkentim
Oct 09 2016 19:15
Who wouldn't?
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:16
Well I'm just messing around with it, learning all the possibilities.
Florian van Dillen
@fvandillen
Oct 09 2016 19:16
Ghandi
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:16
:D
So from now on I know to look at the callback documentation before asking on here :P
Tim Potze
@ikkentim
Oct 09 2016 19:18
:P All callbacks/events are just wrappers around pawn events
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:22
I'm currently remaking Vortex Roleplay on it, someone asked me to make a Roleplay gamemode for them and sent me a list of features similar to what Vortex Roleplay has. Re-doing a SA-MP gamemode for this plugin is too easy for words. Just copy / pasting... I did re-do most systems, making them more dynamic and replaced the ini file system with Json.Net/System.IO.
dini*
Florian van Dillen
@fvandillen
Oct 09 2016 19:23
I really like the fact you can simply use the .NET packages via nuget, instead of waiting for some SA:MP dev to release a plugin
I'm currently doing a completely new thing based on the roleplay standards of ArgonathRPG
I'm a former developer for Argonath and recently quit to do my own thing.
Tim Potze
@ikkentim
Oct 09 2016 19:24
I'm working on the debugger, wishing I had time to work on LSRES, my old server (which I'll be recreating in c#)
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:24
Exactly, you can make a pretty effective RESTful website server using SampSharp, so when you code in JavaScript you can make like a map and update the player's positions on it, like a live server map.
Florian van Dillen
@fvandillen
Oct 09 2016 19:24
Imagine the kind of server we could create when working together :P
Tim Potze
@ikkentim
Oct 09 2016 19:24
I got a community, just need my gamemode back :P
Just need to announce it in a few places and I'd get a fair few players already I think
Florian van Dillen
@fvandillen
Oct 09 2016 19:25
I am working on a backend database connection with mongoDB for some parts of the database. I want to pair the MongoDB with a meteorJS instance for the panel
MeteorJS allows you to receive realtime updates on the webpage without any page refresh
Tim Potze
@ikkentim
Oct 09 2016 19:26
I'll be using sa-mp | C# > NHibernate > MySQL(I think) > Laravel > Vue | website
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:26
I'll check MeteorJS out thank you.
I used pure JavaScript/AJAX calls.
Florian van Dillen
@fvandillen
Oct 09 2016 19:27
Also made a group system for my gamemode. It's the most essential part of the entire gamemode since everything depends on some kind of faction management
Tim Potze
@ikkentim
Oct 09 2016 19:27
Vue + websockets + laravel is pure gold too :) But these days there are so many options, not worth competing
Florian van Dillen
@fvandillen
Oct 09 2016 19:27
Pretty cool layout
Florian van Dillen
@fvandillen
Oct 09 2016 19:28
It's quite extensible so that's cool
Groups can be used for anything. Ingame companies, government factions, crime families
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:29
blob
If you prntscr, and copy instead of upload you can paste into chat bar:
Tim Potze
@ikkentim
Oct 09 2016 19:30
then you've got the whole screen :P
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:30
Works that way with Facebook too.
Tim Potze
@ikkentim
Oct 09 2016 19:30
i prefer pushr
i mean puush
Florian van Dillen
@fvandillen
Oct 09 2016 19:30
I don't like puush, it's too slow
Lightshot takes over prntscr and allows me to select an area
Tim Potze
@ikkentim
Oct 09 2016 19:31
It's getting better, but sometimes, yea
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:32
prntscr allows me to select a portion of the screen, add text/highlight/draw, then upload, save, or copy... simple :P Binds to the prntscr key so I dont have to move my mouse off elements like this
blob
Have you guys worked with Unity3D before?
Florian van Dillen
@fvandillen
Oct 09 2016 19:35
Briefly
Didn't really have a plan (and not particularly creative hehe) so didn't do anything with it
Tim Potze
@ikkentim
Oct 09 2016 19:36
yes, it's my job.
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:36
I am going to make a server control panel thanks to SampSharp, I will probably release it for SampSharp developers, for Desktop/iOS/Android.
Florian van Dillen
@fvandillen
Oct 09 2016 19:36
Sweet
App development is nice :)
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:37
Because Unity3D is C# language too, you guys will be able to edit and tweak it to work for your personal needs.
Florian van Dillen
@fvandillen
Oct 09 2016 19:37
Consider making a backend to talk to, then use meteor for desktop+android+iOS cross platform app
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:39
I would LOVE to recreate GTA in Unity3D so we can have like map-editors and whatnot, I'm just not dedicated that much for that to happen :P
Tim Potze
@ikkentim
Oct 09 2016 19:41
some people have gone nuts already... back in 2011 https://www.youtube.com/watch?v=0Gn0hBmfgfg
Florian van Dillen
@fvandillen
Oct 09 2016 19:43
Saw that back in the day
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 19:43
Yeah I've seen all the Unity3D San Andreas/Vice City remakes on YouTube.
Florian van Dillen
@fvandillen
Oct 09 2016 20:30
Currently working on porting my pre-5.0 vehicle code to my current gamemode
It's surprisingly complete, with the only real work being the new dialog classes
Florian van Dillen
@fvandillen
Oct 09 2016 21:03
@ikkentim Running into a small issue when creating vehicles after loading them via nhibernate. What would you say is the best way of doing that?
Tim Potze
@ikkentim
Oct 09 2016 21:04
What's the problem?
Florian van Dillen
@fvandillen
Oct 09 2016 21:04
Well the old code used to work, however it was ugly and even crashes the current server
I have this utility class: http://prntscr.com/cru24i
Tim Potze
@ikkentim
Oct 09 2016 21:06
  public static Vehicle Load(VehicleInfo info)
        {
            var service = BaseMode.Instance.Services.GetService<IVehicleFactory>() as VehicleFactory;

            if (service == null) return null;

            var vehicle = service.Load(info);
            vehicle.Info = info;
            return vehicle;
        } 
    public class VehicleFactory : BaseVehicleFactory
    {
        public VehicleFactory(BaseMode gameMode) : base(gameMode)
        {
        }

        public override BaseVehicle Create(VehicleModelType vehicletype, Vector3 position, float rotation, int color1,
            int color2,
            int respawnDelay = -1, bool addAlarm = false)
        {
            var vehicle =
                base.Create(vehicletype, position, rotation, color1, color2, respawnDelay, addAlarm) as Vehicle;

            if (vehicle == null) return null;

            vehicle.Info.Model = vehicletype;
            vehicle.Info.Position = new SpawnPoint(position, rotation);
            vehicle.Info.Color1 = color1;
            vehicle.Info.Color2 = color2;

            if (DbSession.LastLession != null && DbSession.LastLession.IsOpen)
                vehicle.Info.NumberPlate = NumberPlateInfo.Generate(DbSession.LastLession, null);
            else
                using (var session = DbSession.Open())
                    vehicle.Info.NumberPlate = NumberPlateInfo.Generate(session, null);

            vehicle.SetNumberPlate(vehicle.Info.NumberPlate);
            return vehicle;
        }

        public Vehicle Load(VehicleInfo info)
        {
            var vehicle = base.Create(info.Model, info.Position, info.Position.Angle, info.Color1, info.Color2) as Vehicle;

            vehicle.ChangePaintjob(info.Paintjob);
            vehicle.UpdateDamageStatus(info.PanelsState, info.DoorsState, info.LightsState, info.TiresState);
            vehicle.Health = info.Health;

            foreach (VehicleModInfo mod in info.Mods)
                vehicle.AddComponent(mod.Component);

            vehicle.Engine = info.EngineOn;
            vehicle.Lights = info.LightsOn;

            vehicle.SetNumberPlate(info.NumberPlate);

            return vehicle;
        }

        public override BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
            int color1, int color2)
        {
            throw new NotImplementedException("Cannot spawn explicitly static vehicles");
        }

        public override BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
            int color1, int color2,
            int respawnDelay, bool addAlarm = false)
        {
            throw new NotImplementedException("Cannot spawn explicitly static vehicles");
        }
    }
copy pasta of my code
wrote it a long while ago
in controller you got to load the service:
        /// <summary>
        /// Registers the services this controller provides.
        /// </summary>
        /// <param name="gameMode">The game mode.</param>
        /// <param name="serviceContainer">The service container.</param>
        public override void RegisterServices(BaseMode gameMode, GameModeServiceContainer serviceContainer)
        {
            serviceContainer.AddService<IVehicleFactory>(new VehicleFactory(gameMode));
        }
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 21:07
Seeing VehicleFactory made me think of Henry Ford for whatever reason... need to stop falling asleep to documentaries.
Tim Potze
@ikkentim
Oct 09 2016 21:07
:P
Florian van Dillen
@fvandillen
Oct 09 2016 21:08
Thanks :) Gonna try and play around with it
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 21:10
So this is interesting, if I wanted to make my own streamer, I could just override the BaseVehicle.Create function and make a call to base.Create within the same class when I want it to actually be created?
Tim Potze
@ikkentim
Oct 09 2016 21:11
Create is a BaseVehicle.Create is static, thus can't be overloaded. this is where the VehicleFactory kicks in. BaseVehicle.Create basically calls the Create method on the factory. You can do your custom implementation here.
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 21:12
Alright that's very nice to know, I don't have to make a whacky separate class.
Tim Potze
@ikkentim
Oct 09 2016 22:02
I'm trying to build a .csproj from code/from the debugger plugin... it's harder than it looks :( Can't find the right way to go yet
Michael Kilpatrick
@NewbProgramming
Oct 09 2016 22:03
Try think, it will be done and worth it once done :)