15.06.2017, 07:57
When does SampSharp support Chinese?
@ikkentim would it be difficult to make a wrapper for FCNPC ?
And how it is going for 0.8, are you making some progress? Will you implement the "gamemode reload without server restart" option? |
Use GlobalObject not DynamicObject.
example: Код:
new GlobalObject(353, new Vector3(player.Position.X, player.Position.Y, player.Position.Z-1), new Vector3(90, 90, 90)); |
How to use other plugins if I fully write my gamemode in C#? How can I include colandreas, routeconnector, etc?
|
#server.cfg plugins crashdetect.dll ColAndreas.dll RNPC.dll SampSharp.dll
Hello again, is it possible to remove removebuildingforplayer limit with this plugin ?
|
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; using SampSharp.GameMode; // Contains BaseMode class using SampSharp.GameMode.Controllers; // Contains ControllerCollection class using SampSharp.GameMode.API.NativeObjects; using SampSharp.GameMode.World; using SampSharp.GameMode.SAMP; using SampSharp.GameMode.Definitions; namespace MyGamemode { public class GameMode : BaseMode { #region Overrides of BaseMode protected override void OnInitialized(EventArgs e) { Console.WriteLine("\n----------------------------------"); Console.WriteLine(" C# Mode"); Console.WriteLine("----------------------------------\n"); SetGameModeText("C Test Mode"); base.OnInitialized(e); } protected override void LoadControllers(ControllerCollection controllers) { base.LoadControllers(controllers); } public override void SetGameModeText(string text) { base.SetGameModeText(text); } protected override void OnPlayerConnected(SampSharp.GameMode.World.BasePlayer player, EventArgs e) { player.SendClientMessage(0xD33257FF, "[{0}] Welcome {1}({2})", DateTime.Now, player.Name, player.Id); player.GiveMoney(500); base.OnPlayerConnected(player, e); } protected override void OnPlayerDisconnected(SampSharp.GameMode.World.BasePlayer player, SampSharp.GameMode.Events.DisconnectEventArgs e) { base.OnPlayerDisconnected(player, e); } protected override void OnPlayerCommandText(SampSharp.GameMode.World.BasePlayer player, SampSharp.GameMode.Events.CommandTextEventArgs e) { base.OnPlayerCommandText(player, e); } #endregion } } class AnyClass { [Command("helloworld")] private static void HelloWorldCommand(BasePlayer sender, int times) { for (var i = 0; i < times; i++) sender.SendClientMessage("Hello, world!"); } }
[Command("helloworld")] <--- Error
This encoding also I'm a little clumsy. If you have training videos more quickly I can learn.
I'm waiting for your help @AwareWolf |
using SampSharp.GameMode.SAMP.Commands;
You can do it this way:
http://sampsharp.timpotze.nl/natives Or these ways (RNPC): (I made these, you can take them and improve them, all good) https://pastebin.com/KxeiAdaR (ColAndreas): https://pastebin.com/rMgFa8sp (Look at the RNPCInternal and ColAndreasInternal classes) Make sure the plugin.dll is in the plugins folder and loaded before SampSharp.dll Код:
#server.cfg plugins crashdetect.dll ColAndreas.dll RNPC.dll SampSharp.dll |
Thank you sir, for example, if a native returns me something, I can use it with the invoke?
For example: native FCNPC_GetPosition |
[NativeMethod(Function = "FCNPC_GetPosition")] public virtual int GetPosition(int id, out float x, out float y, out float z) { throw new NativeNotImplementedException(); }
Thank you sir, for example, if a native returns me something, I can use it with the invoke?
For example: native FCNPC_GetPosition |
[NativeMethod(11, 11, 11, 11, 11, Function = "CA_RayCastMultiLine")] public virtual int RayCastMultiLine(float startX, float startY, float startZ, float endX, float endY, float endZ, out float[] x, out float[] y, out float[] z, out float[] distance, out int[] modelId, int size) { throw new NativeNotImplementedException(); }
Well, I'm stuck again. This time with commands.
How do I make a command that doesn't need a sender? i.e if i wanted to make a /help command, I get "unknown command" unless i unclude BasePlayer, but that makes it "/help [player]" |
[Command("help")] public static void HelpCommand(BasePlayer sender) { sender.SendClientMessage("help here"); }
[Command("help")] public void HelpCommand() { SendClientMessage("help here"); }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SampSharp.GameMode; using SampSharp.GameMode.World; using SampSharp.GameMode.SAMP; using SampSharp.GameMode.SAMP.Commands; namespace RoleplayGM { class Player : BasePlayer { #region Player Commands [Command("help")] public void HelpCommand() { SendClientMessage("This is a command called help"); } #endregion } }
Okay, next problem. I have my player class (player.cs), and when I attempt to execute this command, it returns with "unknown command".
Edit: the command works when I put it in Gamemode.cs, but not in Player.cs |