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."); } }
PLEASE at least don't dumb down users with vb.net's brainfuck syntax and make examples in c#-only.
|
PLEASE at least don't dumb down users with vb.net's brainfuck syntax and make examples in c#-only.
|