[Plugin] [DEV] .NET for SA:MP (VB.NET, C#)
#12

The exact same example, in C#:
Code:
public class Script
{
	public static void OnGameModeInit()
	{
		SAMP.Util.Log("Creating Objects...");
		SAMP.World.CreateObject(19286, 16.20947266, 261.96289062, 12.74184227, 0.0, 0.0, 0.0);
		SAMP.Util.Log("Creating Classes...");
		SAMP.Server.AddPlayerClass(26, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0,
		0);
		SAMP.Server.AddPlayerClass(26, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0,
		0);
		SAMP.Util.Log("Creating Vehicles...");
		SAMP.Natives.CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);
		SAMP.Util.Log(".NET Gamemode Loaded!");
	}
	public static void OnPlayerConnect(int playerID)
	{
		SAMP.Player player = SAMP.Player.getPlayer(playerID);
		player.SetPos(144, 265, 11);
		player.SetCameraLookAt(14, 265, 11);
		player.SetCameraPos(158.0326, 24.4021, 33.2211);
		player.SendMessage(255, "{FF0000} Welcome to the server!");
		player.variables.Add("Money", 5000);
	}
	public static void OnPlayerDisconnect(int playerID)
	{
		return;
	}
	public static void OnPlayerDeath(int playerID, int killerID, int reason)
	{
		return;
	}
	public static int OnPlayerCommandText(int playerID, string command)
	{
		SAMP.Player player = SAMP.Player.getPlayer(playerID);
		command = command.Remove(0, 1);
		//remove /
		string[] SeperatedCommand = command.Split(" ");
		//split by space
		if (SeperatedCommand[0] == "help") {
			player.SendMessage(255, "{FF0000} No help available.");
			return 1;
		} else if (SeperatedCommand[0] == "money") {
			player.SendMessage(255, "{FF0000} Money: $" + player.variables("Money"));
			return 1;
		} else if (SeperatedCommand[0] == "dialog") {
			SAMP.Dialog myDialog = new SAMP.Dialog();
			myDialog.playerID = player.ID;
			myDialog.caption = "Cookies";
			myDialog.info = "Do you like cookies?";
			myDialog.style = 0;
			myDialog.button1 = "Yes";
			myDialog.button2 = "No";
			myDialog.response += Script.HandleTech;
			myDialog.show();
			return 1;
		} else if (SeperatedCommand[0] == "o") {
			SAMP.Natives.SendClientMessageToAll(255, "{C0C0C0} [OOC] " + player.Name + ": " + command.Remove(0, 2));
			return 1;
		} else {
			return 0;
		}
	}
	public static void HandleTech(object sender, bool response, int listitem, string textinput)
	{
		SAMP.Player player = SAMP.Player.getPlayer(((SAMP.Dialog)sender).playerID);
		if (response) {
			player.SendMessage(255, "{C0C0C0} [COOKIES] Me too!");
		} else {
			player.SendMessage(255, "{C0C0C0} [COOKIES] Really? Sucks.");
		}
	}
	public static void OnPlayerRequestClass(int playerID, int classID)
	{
		SAMP.Player player = SAMP.Player.getPlayer(playerID);
		switch (classID) {
			case 0:
				player.SetPos(14, 2665, 11);
				player.SetCameraLookAt(144, 25, 11);
				player.SetCameraPos(158.0326, 24.4021, 33.2211);
				break;
			case 1:
				player.SetPos(28, 26, 11);
				player.SetCameraPos(21.3079, 27.7612, 34.8534);
				player.SetCameraLookAt(28, 26, 11);
				break;
		}
	}
	public static int OnPlayerRequestSpawn(int playerID)
	{
		SAMP.Player player = SAMP.Player.getPlayer(playerID);
		return 1;
	}
	public static void OnPlayerSpawn(int playerID)
	{
		SAMP.Player player = SAMP.Player.getPlayer(playerID);
		SAMP.Util.Log("Player '" + player.Name + "' spawned.");
	}
}
Reply


Messages In This Thread
Project Dead - by jaymac407 - 30.12.2010, 23:27
Re: [DEV] .NET for SA:MP - by Maikel - 30.12.2010, 23:33
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by [L3th4l] - 30.12.2010, 23:39
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 30.12.2010, 23:41
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Souvlaki - 30.12.2010, 23:46
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Yagoda - 31.12.2010, 08:50
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Bumbis - 31.12.2010, 09:26
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Aleks7 - 31.12.2010, 11:09
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Hiddos - 31.12.2010, 11:52
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by JernejL - 31.12.2010, 12:36
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by sooky - 31.12.2010, 13:39
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 31.12.2010, 14:39
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by [Ask]Terminator - 31.12.2010, 14:56
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hencz - 31.12.2010, 15:29
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 31.12.2010, 17:47
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by frannic - 31.12.2010, 18:00
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Momo5000 - 01.01.2011, 11:31
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by psoftware - 01.01.2011, 19:15
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Maikel - 01.01.2011, 19:27
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by VIRUXE - 01.01.2011, 19:54
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Marty_Alex - 01.01.2011, 21:42
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by iLinx - 01.01.2011, 22:45
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 00:06
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Donny_k - 02.01.2011, 02:27
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Donny_k - 02.01.2011, 02:30
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 02:43
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Donny_k - 02.01.2011, 02:55
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 03:19
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Mr187 - 02.01.2011, 03:36
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by billiout - 02.01.2011, 09:02
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hencz - 02.01.2011, 09:05
Re: [DEV] .NET Scripthook for SA-MP (VB.NET, C#) - by hencz - 02.01.2011, 09:25
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by TheArcher - 02.01.2011, 09:27
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Maikel - 02.01.2011, 09:46
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hencz - 02.01.2011, 09:52
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 13:42
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 14:43
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 02.01.2011, 15:30
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hencz - 02.01.2011, 16:55
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Maikel - 02.01.2011, 19:47
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by XxCozzaxX - 02.01.2011, 19:58
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 04.01.2011, 06:09
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Retardedwolf - 04.01.2011, 09:15
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Maikel - 04.01.2011, 17:51
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 04.01.2011, 18:12
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Romanius - 08.01.2011, 10:31
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Romanius - 09.01.2011, 03:51
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hencz - 09.01.2011, 09:08
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by yass0016 - 16.01.2011, 20:47
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Retardedwolf - 16.01.2011, 21:03
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Romanius - 26.01.2011, 07:45
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 20.02.2011, 01:19
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Romanius - 05.03.2011, 17:07
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Whiteagle - 26.03.2011, 23:24
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Retardedwolf - 26.03.2011, 23:37
AW: [DEV] .NET for SA:MP (VB.NET, C#) - by Momo5000 - 27.03.2011, 03:27
Re: AW: [DEV] .NET for SA:MP (VB.NET, C#) - by Retardedwolf - 27.03.2011, 03:45
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 29.03.2011, 20:45
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 30.03.2011, 09:39
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by iToast - 30.03.2011, 15:08
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Mike Garber - 30.03.2011, 15:26
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by maij - 18.04.2011, 15:51
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by d3n4 - 17.07.2011, 07:39
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by KevinsL - 23.07.2011, 12:15
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Yasahiro - 05.09.2011, 19:22
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by xDeadlyBoy - 05.09.2011, 20:14
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by Excite - 14.09.2011, 04:42
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by hummer_4x4 - 15.10.2011, 21:55
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by d3n4 - 25.10.2011, 00:31
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by T0pAz - 25.10.2011, 16:38
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by JordanMaddox - 26.10.2011, 17:34
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by MrMADRYAN[GREIS] - 30.12.2011, 12:48
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by T0pAz - 30.12.2011, 13:22
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by jaymac407 - 01.01.2012, 02:40
Re: [DEV] .NET for SA:MP (VB.NET, C#) - by d3n4 - 01.01.2012, 22:27

Forum Jump:


Users browsing this thread: 1 Guest(s)