These are chat archives for ikkentim/SampSharp

9th
May 2016
Tim Potze
@ikkentim
May 09 2016 15:59
Yea or whereever you need it
Vladyslav
@Seprum
May 09 2016 16:16
I think it will be good idea to Add double constructor for Vector2 & Vector3 to avoid annoying casting everytime.
Vladyslav
@Seprum
May 09 2016 16:22
And there is also a problem with Kick (See https://wiki.sa-mp.com/wiki/Kick). When you try to inform user about kick reason (and it is very frequently used practice) you have to use Timer for Kick because SendClientMessage will not work when used directly before Kick. You could simply add Kick(string reason) overload for us to avoid adding own extension methods like that:
public static void Kick(this Player player, string reason)
{
    player.SendClientMessage("You where kicked for the following reason:");
    player.SendClientMessage(reason);
    var kickTimer = new Timer(100, false);
    kickTimer.Tick += (sender, e) =>
    {
        player.Kick();
    };
}
Vladyslav
@Seprum
May 09 2016 19:00

A question about porting native calls of Streamer to version 0.7.0. Have it to be done in such way?

// Before
public static int AttachDynamicAreaToVehicle(int areaid, int vehicleid)
{
    return Native.CallNative("AttachDynamicAreaToVehicle", __arglist(areaid, vehicleid));
}

//After
delegate int AttachDynamicAreaToVehicleImpl(int areaid, int vehicleid);
[Native("AttachDynamicAreaToVehicle")] private static readonly AttachDynamicAreaToVehicleImpl AttachDynamicAreaToVehicle = null;

And in what way have such natives to be ported?

public static int SetArrayData(StreamType type, int id, StreamerDataType data, int[] src, int maxlength = -1)
{
    if (src == null)
    {
        throw new ArgumentNullException("src");
    }

    if (maxlength == -1)
    {
        maxlength = src.Length;
    }

    return Native.CallNative("Streamer_SetArrayData", __arglist((int) type, id, (int) data, src, maxlength));
}