public User(StateManager stateMgr, API.Geo.World world) { this.mStateMgr = stateMgr; this.mWorld = world; this.mTimeSinceGUIOpen = new Timer(); this.mCameraMan = null; this.IsAllowedToMoveCam = true; this.IsFreeCamMode = true; Camera cam = this.mStateMgr.Camera; cam.Position = new Vector3(-203, 633, -183); cam.Orientation = new Quaternion(0.3977548f, -0.1096644f, -0.8781486f, -0.2421133f); this.mCameraMan = new CameraMan(cam); this.mSelectedAllies = new HashSet<VanillaNonPlayer>(); this.mRandom = new Random(); this.mFigures = new MOIS.KeyCode[10]; for (int i = 0; i < 9; i++) this.mFigures[i] = (MOIS.KeyCode)System.Enum.Parse(typeof(MOIS.KeyCode), "KC_" + (i + 1)); this.mFigures[9] = MOIS.KeyCode.KC_0; this.mWireCube = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode(); this.mWireCube.AttachObject(StaticRectangle.CreateRectangle(this.mStateMgr.SceneMgr, Vector3.UNIT_SCALE * Cst.CUBE_SIDE)); this.mWireCube.SetVisible(false); this.Inventory = new Inventory(10, 4, new int[] { 3, 0, 1, 2 }, true); }
public static void SaveSettings(API.Settings.Settings s) { using (var sr = new StreamWriter("settings.config")) { sr.Write(Utilities.Serialize(s)); } }
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (ExpectValueArguments)arguments; Guard.ArgumentNotNullForCommand<ExpectValue>(args.Value, args.ValueExpression); Guard.ArgumentNotNullForCommand<ExpectValue>(args.Selector); API.ExpectCommands.Value valueExpect = null; if (args.Value != null) { valueExpect = manager.Expect.Value(args.Value); } else { valueExpect = manager.Expect.Value(args.ValueExpression); } if (args.MatchConditions.HasValue) { valueExpect.In(args.Selector, args.MatchConditions.Value); } else { valueExpect.In(args.Selector); } }
public GitHubRequest(string resource, API version, Method method, params Parameter[] parameters) : this(resource, version, method, /*body:*/null, parameters) { }
internal void Update(API.Invite model) { if (model.Channel != null) ChannelId = model.Channel.Id; if (model.Inviter != null) InviterId = model.Inviter.Id; }
private void RunProcessor(API.Request request, Processor processor, string processorName) { API.Response response = null; try { // Threadpooling response = processor.process(request); } catch (Exception e) { Logger.Error("Failed to process message with processor " + processor.GetType() + " : " + e.Message, e); try { Type responseType = Type.GetType("Gwupe.Cloud.Messaging.Response." + processorName + "Rs"); response = (API.Response) responseType.GetConstructor(Type.EmptyTypes).Invoke(new object[] {}); response.error = "UNKNOWN_ERROR"; response.errorMessage = e.Message; } catch (Exception exception) { Logger.Error("Failed to determine return type for " + processorName); response = new ErrorRs { errorMessage = "Failed to determine return type for " + processorName, error = "INTERNAL_SERVER_ERROR" }; } } finally { SendResponse(response, request); } }
public A2iAOcrProcessingService(API a2iaEngine, string parameterPath, string tableFilename, LoadMethod loadMethod) { _a2iaEngine = a2iaEngine; _parameterDirectory = parameterPath; _documentTableFilename = tableFilename; _loadMethod = loadMethod; }
private void balanceButton_Click(object sender, EventArgs e) { try { API api = new API(key.Text); Clockwork.Balance result = api.GetBalance(); balance.Text = result.CurrencySymbol + result.Amount.ToString("#,0.00"); } catch (APIException ex) { // You'll get an API exception for errors // such as wrong key MessageBox.Show("API Exception: " + ex.Message); } catch (WebException ex) { // Web exceptions mean you couldn't reach the mediaburst server MessageBox.Show("Web Exception: " + ex.Message); } catch (ArgumentException ex) { // Argument exceptions are thrown for missing parameters, // such as forgetting to set the username MessageBox.Show("Argument Exception: " + ex.Message); } catch (Exception ex) { // Something else went wrong, the error message should help MessageBox.Show("Unknown Exception: " + ex.Message); } }
public static Func<List<ImportedKit>> ListImportedKits(API.V1 api) { return delegate() { string root = FileUtils.Root + FileUtils.NormalizePathForPlatform ("/Fabric/Kits/"); List<ImportedKit> kits = new List<ImportedKit> (); if (!Directory.Exists (root)) { return kits; } foreach (string kit in Directory.GetDirectories (root)) { string unqualified = kit.Substring (kit.LastIndexOf (Path.DirectorySeparatorChar) + 1); string qualified = String.Format ("Fabric.Internal.{0}.Editor.Controller.Controller", unqualified); Type type = Type.GetType (qualified); // Those kits without a controller will not be displayed in the KitSelector // as they do not have a GUI component to them. if (type == null) { continue; } object instance = Activator.CreateInstance (type, api); kits.Add (new ImportedKit (unqualified, instance)); } return kits; }; }
public TestParameters_WaitAllAny(API api, int waitTime, WaitBy waitBy, TaskInfo[] allTasks) { Api = api; WaitBy = waitBy; WaitTime = waitTime; AllTaskInfos = allTasks; }
private async void Autenticar() { API api = new API(); string resposta; // ObservableCollection<Users> x =await api.GetAllUser(); resposta = api.GetAsync(User, Senha); if (resposta == "Logado") { await _dialogservice.DisplayAlertAsync("Sucess", "Loading...", "ok,"); await _navigationService.NavigateAsync("InicialPage"); } else { await _dialogservice.DisplayAlertAsync("Erro", "Senha e/ou Usuario incorreto", "ok,"); } }
public void PostData(StringContent content, API api) { var client = PrepareHttpClient(); using (client) { string apiStr = Enum.GetName(typeof(API), api); var request = client.PostAsync("api/"+apiStr, content).Result; var result = request.Content.ReadAsStringAsync().Result; // result = "{\"StatusCode\":201,\"StatusDescription\":\"New call was created with id : 5631004a4ca8e9290cddd46b\"}" on success Dictionary<string, string> jsonDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(result); var statusCode = jsonDictionary["StatusCode"]; var statusDesc = jsonDictionary["StatusDescription"]; var seperator = statusDesc.IndexOf(":"); var callId = statusDesc.Substring(seperator+1).Trim(); MongoCallId = callId; // If result is not as below, throw exception if (!statusCode.Contains("201")) { throw new Exception("Error sending call: Response result code not 201!"); } } }
/// <summary> /// /// </summary> /// <param name="container"></param> public FacebookService(IContainer container) { if (container != null) container.Add(this); api = new API(); InitializeComponent(); }
protected void SendJson(API.ReturnObject o) { Response.ContentType = "application/json"; Response.StatusCode = 200; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(o)); Response.End(); }
public EditAPI(Project project, API api) { InitializeComponent(); _project = project; _api = api; }
public void display(Island currentIsland, API.Geo.World currentWorld) { if (this.faceNumber > 0) { block.End(); this.node = this.mIsland.Node.CreateChildSceneNode("MultiBlockNode-" + this.mName); this.node.AttachObject(block); } }
public TaskFromAsyncTest(TestParameters parameters) { _api = parameters.Api; _sourceType = parameters.SourceTaskType; _fromAsyncType = parameters.FromAsyncTaskType; _errorCase = parameters.ErrorCase; _overloadChoice = parameters.OverloadChoice; }
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (NavigateArguments)arguments; Guard.ArgumentNotNullForCommand<Navigate>(args.Direction); manager.Navigate(args.Direction.Value); }
public void play() { beginPlay (); spinFlag = true; // call the API API request = new API("/game/" + PlayerPrefs.GetString("gameId") + "/play", endAPICall); request.AddField ("token", PlayerPrefs.GetString ("token")); request.Send (); }
private CountdownEvent _countdownEvent; // event to signal the main thread that the whole task tree has been created #endregion /// <summary> /// .ctor /// </summary> public TaskCancelWaitTest(TestParameters parameters) { _api = parameters.API_CancelWait; _waitBy = parameters.WaitBy_CancelWait; _waitTimeout = parameters.WaitTime; _taskTree = parameters.RootNode; _countdownEvent = new CountdownEvent(CaluateLeafNodes(_taskTree)); }
public A2iABatchPoolService(API a2IaEngine, IA2iaConfiguration configuration) : base(a2IaEngine, configuration) { const int capacity = 100; batchRegistration = new ConcurrentDictionary<string, int>(GetMaxThreadCount(3), capacity); VoucherQueue = new ConcurrentQueue<OcrVoucher>(); VoucherProcessingBag = new ConcurrentBag<OcrVoucher>(); }
internal void Update(API.RoleInfo model) { Name = model.Name; Permissions.RawValue = (uint)model.Permissions; foreach (var member in Members) member.UpdatePermissions(); }
protected override string Generate_ProjectFile(API.IZetboxContext ctx, string projectGuid, List<string> generatedFileNames, IEnumerable<ISchemaProvider> schemaProviders) { return RunTemplate(ctx, "ProjectFile", TargetNameSpace + ".csproj", projectGuid, generatedFileNames.Where(s => !String.IsNullOrEmpty(s)).ToList(), schemaProviders); }
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (TypeArguments)arguments; Guard.ArgumentNotNullForCommand<Type>(args.Value); manager.Type(args.Value); }
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (PressArguments)arguments; Guard.ArgumentNotNullForCommand<Press>(args.Keys); manager.Press(args.Keys); }
internal void Update(API.ExtendedInvite model) { Update(model as API.Invite); IsRevoked = model.IsRevoked; IsTemporary = model.IsTemporary; MaxAge = model.MaxAge; MaxUses = model.MaxUses; Uses = model.Uses; }
internal void Update(API.UserReference model) { if (model.Avatar != null) AvatarId = model.Avatar; if (model.Discriminator != null) Discriminator = model.Discriminator; if (model.Username != null) Name = model.Username; }
void OnAllLevelsUnload_Normal(Level sender, API.Events.LevelLoadEventArgs args) { if ( !lstUnloaded.Items.Contains(sender.Name) ) lstUnloaded.Items.Add(sender.Name); int index = GetRowIndexFromLevel(sender); if ( index != -1 ) { dtaLoaded.Rows.RemoveAt(index); } }
void sendAnswer() { API request = new API(); request.Post ("/game/" + PlayerPrefs.GetString ("gameId") + "/answer/" + PlayerPrefs.GetString ("questionId"), responseReady); request.AddField ("token", PlayerPrefs.GetString ("token")); request.AddField ("answer", answerText.text); request.AddField ("correct", correctAnswer.ToString()); request.AddField ("position", answer.ToString()); request.Send (); }
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (DragArguments)arguments; Guard.ArgumentNotNullForCommand<Drag>(args.From); Guard.ArgumentNotNullForCommand<Drag>(args.To); manager.Drag(args.From).To(args.To); }
public async Task LoadNpcComps(string skin_json, string cloths_json) { JObject jskin = JObject.Parse(skin_json); JObject jcomp = JObject.Parse(cloths_json); Dictionary <string, string> skin = new Dictionary <string, string>(); foreach (var s in jskin) { skin[s.Key] = s.Value.ToString(); } Dictionary <string, uint> cloths = new Dictionary <string, uint>(); foreach (var s in jcomp) { cloths[s.Key] = LoadPlayer.ConvertValue(s.Value.ToString()); } uint model_hash = (uint)API.GetHashKey(skin["sex"]); await Utils.Miscellanea.LoadModel(model_hash); ppid = API.CreatePed(model_hash, 1701.316f, 1512.134f, 146.87f, 116.70f, false, false, true, true); CreateCharacter.ApplyDefaultSkinCanaryEdition(ppid); await Delay(200); //PreLoad TextureFace if (skin["sex"].ToString().Equals("mp_male")) { CreateCharacter.texture_types["albedo"] = int.Parse(skin["albedo"]); CreateCharacter.texture_types["normal"] = API.GetHashKey("mp_head_mr1_000_nm"); CreateCharacter.texture_types["material"] = 0x7FC5B1E1; CreateCharacter.texture_types["color_type"] = 1; CreateCharacter.texture_types["texture_opacity"] = 1.0f; CreateCharacter.texture_types["unk_arg"] = 0; } else { CreateCharacter.texture_types["albedo"] = int.Parse(skin["albedo"]); CreateCharacter.texture_types["normal"] = API.GetHashKey("head_fr1_mp_002_nm"); CreateCharacter.texture_types["material"] = 0x7FC5B1E1; CreateCharacter.texture_types["color_type"] = 1; CreateCharacter.texture_types["texture_opacity"] = 1.0f; CreateCharacter.texture_types["unk_arg"] = 0; } //End //LoadSkin Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["HeadType"]), true, true, true); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["BodyType"]), true, true, true); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["LegsType"]), true, true, true); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x84D6, float.Parse(skin["HeadSize"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x3303, float.Parse(skin["EyeBrowH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x2FF9, float.Parse(skin["EyeBrowW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x4AD1, float.Parse(skin["EyeBrowD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xC04F, float.Parse(skin["EarsH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xB6CE, float.Parse(skin["EarsW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x2844, float.Parse(skin["EarsD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xED30, float.Parse(skin["EarsL"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x8B2B, float.Parse(skin["EyeLidH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x1B6B, float.Parse(skin["EyeLidW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xEE44, float.Parse(skin["EyeD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xD266, float.Parse(skin["EyeAng"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xA54E, float.Parse(skin["EyeDis"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xDDFB, float.Parse(skin["EyeH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x6E7F, float.Parse(skin["NoseW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x3471, float.Parse(skin["NoseS"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x03F5, float.Parse(skin["NoseH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x34B1, float.Parse(skin["NoseAng"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xF156, float.Parse(skin["NoseC"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x561E, float.Parse(skin["NoseDis"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x6A0B, float.Parse(skin["CheekBonesH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xABCF, float.Parse(skin["CheekBonesW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x358D, float.Parse(skin["CheekBonesD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xF065, float.Parse(skin["MouthW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xAA69, float.Parse(skin["MouthD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x7AC3, float.Parse(skin["MouthX"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x410D, float.Parse(skin["MouthY"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x1A00, float.Parse(skin["ULiphH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x91C1, float.Parse(skin["ULiphW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xC375, float.Parse(skin["ULiphD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xBB4D, float.Parse(skin["LLiphH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xB0B0, float.Parse(skin["LLiphW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x5D16, float.Parse(skin["LLiphD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x8D0A, float.Parse(skin["JawH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xEBAE, float.Parse(skin["JawW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x1DF6, float.Parse(skin["JawD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0x3C0F, float.Parse(skin["ChinH"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xC3B2, float.Parse(skin["ChinW"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0x5653AB26C82938CF, ppid, 0xE323, float.Parse(skin["ChinD"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //await Delay(100); Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["Eyes"]), true, true, true); Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["Hair"]), true, true, true); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); await Delay(100); Function.Call((Hash)0x1902C4CFCC5BE57C, ppid, LoadPlayer.ConvertValue(skin["Body"])); //Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); await Delay(100); Function.Call((Hash)0x1902C4CFCC5BE57C, ppid, LoadPlayer.ConvertValue(skin["Waist"])); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); await Delay(500); SetPlayerComponent(skin["sex"], 0x9925C067, "Hat", cloths); SetPlayerComponent(skin["sex"], 0x5E47CA6, "EyeWear", cloths); SetPlayerComponent(skin["sex"], 0x7505EF42, "Mask", cloths); SetPlayerComponent(skin["sex"], 0x5FC29285, "NeckWear", cloths); SetPlayerComponent(skin["sex"], 0x7A96FACA, "NeckTies", cloths); SetPlayerComponent(skin["sex"], 0x2026C46D, "Shirt", cloths); SetPlayerComponent(skin["sex"], 0x877A2CF7, "Suspender", cloths); SetPlayerComponent(skin["sex"], 0x485EE834, "Vest", cloths); SetPlayerComponent(skin["sex"], 0xE06D30CE, "Coat", cloths); SetPlayerComponent(skin["sex"], 0xAF14310B, "Poncho", cloths); SetPlayerComponent(skin["sex"], 0x3C1A74CD, "Cloak", cloths); SetPlayerComponent(skin["sex"], 0xEABE0032, "Glove", cloths); SetPlayerComponent(skin["sex"], 0x7A6BBD0B, "RingRh", cloths); SetPlayerComponent(skin["sex"], 0xF16A1D23, "RingLh", cloths); SetPlayerComponent(skin["sex"], 0x7BC10759, "Bracelet", cloths); SetPlayerComponent(skin["sex"], 0x9B2C8B89, "Gunbelt", cloths); SetPlayerComponent(skin["sex"], 0xA6D134C6, "Belt", cloths); SetPlayerComponent(skin["sex"], 0xFAE9107F, "Buckle", cloths); SetPlayerComponent(skin["sex"], 0xB6B6122D, "Holster", cloths); if (cloths["Skirt"] != -1) // Prevents both Pant & Skirt in female ped. { SetPlayerComponent(skin["sex"], 0x1D4C528A, "Pant", cloths); } SetPlayerComponent(skin["sex"], 0xA0E3AB7F, "Skirt", cloths); SetPlayerComponent(skin["sex"], 0x3107499B, "Chap", cloths); SetPlayerComponent(skin["sex"], 0x777EC6EF, "Boots", cloths); SetPlayerComponent(skin["sex"], 0x18729F39, "Spurs", cloths); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); //Function.Call((Hash)0xCC8CA3E88256E58F, pPedID, 0, 1, 1, 1, false); // this fix Hair not appears //Load Face Texture //CreateCharacter.toggleOverlayChange("eyebrows", int.Parse(skin["eyebrows_visibility"]), int.Parse(skin["eyebrows_tx_id"]), 0, 0, 0, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("scars", int.Parse(skin["scars_visibility"]), int.Parse(skin["scars_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("spots", int.Parse(skin["spots_visibility"]), int.Parse(skin["spots_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("disc", int.Parse(skin["disc_visibility"]), int.Parse(skin["disc_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("complex", int.Parse(skin["complex_visibility"]), int.Parse(skin["complex_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("acne", int.Parse(skin["acne_visibility"]), int.Parse(skin["acne_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("ageing", int.Parse(skin["ageing_visibility"]), int.Parse(skin["ageing_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("freckles", int.Parse(skin["freckles_visibility"]), int.Parse(skin["freckles_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("moles", int.Parse(skin["moles_visibility"]), int.Parse(skin["moles_tx_id"]), 0, 0, 1, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("grime", int.Parse(skin["grime_visibility"]), int.Parse(skin["grime_tx_id"]), 0, 0, 0, 1.0f, 0, 0, 0, 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("lipsticks", int.Parse(skin["lipsticks_visibility"]), int.Parse(skin["lipsticks_tx_id"]), 0, 0, 0, 1.0f, 0, int.Parse(skin["lipsticks_palette_id"]), int.Parse(skin["lipsticks_palette_color_primary"]), 0, 0, 0, 1.0f); //CreateCharacter.toggleOverlayChange("shadows", int.Parse(skin["shadows_visibility"]), int.Parse(skin["shadows_tx_id"]), 0, 0, 0, 1.0f, 0, int.Parse(skin["shadows_palette_id"]), int.Parse(skin["shadows_palette_color_primary"]), 0, 0, 0, 1.0f); await Delay(500); Function.Call((Hash)0x59BD177A1A48600A, ppid, 0xF8016BCA); Function.Call((Hash)0xD3A7B003ED343FD9, ppid, LoadPlayer.ConvertValue(skin["Beard"]), true, true, true); Function.Call((Hash)0xCC8CA3E88256E58F, ppid, 0, 1, 1, 1, false); }
public async Task Controller() { while (isInCharacterSelector) { if (API.IsControlJustPressed(0, 0xDEB34313) && !swappingChar) { if (selectedChar == myChars.Count - 1) { selectedChar = 0; } else { selectedChar += 1; } await StartSwapCharacter(); } if (API.IsControlJustPressed(0, 0xA65EBAB4) && !swappingChar) { if (selectedChar == 0) { selectedChar = myChars.Count - 1; } else { selectedChar -= 1; } await StartSwapCharacter(); } if (API.IsControlJustPressed(0, 0xC7B5340A) && !swappingChar) { CharSelect(); isInCharacterSelector = false; await Delay(200); } if (API.PromptHasHoldModeCompleted(CreatePrompt) && !swappingChar) { if (myChars.Count < vorpcharacter_cl.MaxCharacters) { TriggerEvent("vorpcharacter:createCharacter"); API.PromptSetEnabled(DeletePrompt, 0); API.PromptSetVisible(DeletePrompt, 0); API.PromptSetEnabled(CreatePrompt, 0); API.PromptSetVisible(CreatePrompt, 0); API.DeletePed(ref ppid); isInCharacterSelector = false; } else { vorpcharacter_cl.CORE.displayRightTip(GetConfig.Langs["CharactersFull"], 4000); await Delay(1000); } } if (API.PromptHasHoldModeCompleted(DeletePrompt) && !swappingChar) { TriggerServerEvent("vorp_DeleteCharacter", (int)myChars[selectedChar].charIdentifier); if (myChars.Count <= 1) { TriggerEvent("vorpcharacter:createCharacter"); API.PromptSetEnabled(DeletePrompt, 0); API.PromptSetVisible(DeletePrompt, 0); API.PromptSetEnabled(CreatePrompt, 0); API.PromptSetVisible(CreatePrompt, 0); API.DeletePed(ref ppid); isInCharacterSelector = false; } else { myChars.RemoveAt(selectedChar); Function.Call((Hash)0x7D6F58F69DA92530, 1696.17f, 1508.474f, 147.85f, 26, 50.0f, true, false, true); if (selectedChar == 0) { selectedChar = myChars.Count - 1; } else { selectedChar -= 1; } await StartSwapCharacter(); } } await Delay(0); } }
protected override bool ReleaseHandle() { API.destroy(handle); return(true); }
public DeltaRequestExample(API api) { _ynabApi = api; }
void CreateLeg(float s, Vector2 wheelAnchor) { Vector2 p1 = new Vector2(5.4f * s, -6.1f); Vector2 p2 = new Vector2(7.2f * s, -1.2f); Vector2 p3 = new Vector2(4.3f * s, -1.9f); Vector2 p4 = new Vector2(3.1f * s, 0.8f); Vector2 p5 = new Vector2(6.0f * s, 1.5f); Vector2 p6 = new Vector2(2.5f * s, 3.7f); ShapeDef sp = new ShapeDef(1.0f); sp.groupIndex = -1; Vector2[] vertices1 = new Vector2[3]; Vector2[] vertices2 = new Vector2[3]; if (s > 0.0f) { vertices1[0] = p1; vertices1[1] = p2; vertices1[2] = p3; vertices2[0] = Vector2.zero; vertices2[1] = p5 - p4; vertices2[2] = p6 - p4; } else { vertices1[0] = p1; vertices1[1] = p3; vertices1[2] = p2; vertices2[0] = Vector2.zero; vertices2[1] = p6 - p4; vertices2[2] = p5 - p4; } BodyDef bd1 = new BodyDef(BodyType.DYNAMIC_BODY); BodyDef bd2 = new BodyDef(BodyType.DYNAMIC_BODY); bd1.position = m_offset; bd2.position = p4 + m_offset; bd1.angularDamping = 10.0f; bd2.angularDamping = 10.0f; var body1 = API.CreateBody(world, bd1); var body2 = API.CreateBody(world, bd2); API.AddPolygonShape(body1, vertices1, vertices1.Length, sp); API.AddPolygonShape(body2, vertices2, vertices2.Length, sp); DistanceJointDef djd = new DistanceJointDef(); djd.dampingRatio = 0.5f; djd.frequencyHz = 10.0f; djd.Initialize(body1, body2, p2 + m_offset, p5 + m_offset); API.CreateDistanceJoint(world, djd); djd.Initialize(body1, body2, p3 + m_offset, p4 + m_offset); API.CreateDistanceJoint(world, djd); djd.Initialize(body1, m_wheel, p3 + m_offset, wheelAnchor + m_offset); API.CreateDistanceJoint(world, djd); djd.Initialize(body2, m_wheel, p6 + m_offset, wheelAnchor + m_offset); API.CreateDistanceJoint(world, djd); RevoluteJointDef rjd = new RevoluteJointDef(); rjd.Initialize(body2, m_chassis, p4 + m_offset); API.CreateRevoluteJoint(world, rjd); }
// Use this for initialization protected override void Init() { m_offset = new Vector2(0, 8); m_motorSpeed = 2.0f; m_motorOn = true; Vector2 pivot = new Vector2(0, 0.8f); //ground var ground = API.CreateBody(world, new Vector2(0, 0), 0, BodyType.STATIC_BODY); API.AddEdgeShape(ground, new Vector2(-50, 0), new Vector2(50, 0), new ShapeDef(0)); API.AddEdgeShape(ground, new Vector2(-50, 0), new Vector2(-50, 10), new ShapeDef(0)); API.AddEdgeShape(ground, new Vector2(50, 0), new Vector2(50, 10), new ShapeDef(0)); //Balls for (int i = 0; i < 40; ++i) { var b = API.CreateBody(world, new Vector2(-40 + 2 * i, 0.5f), 0, BodyType.DYNAMIC_BODY); API.AddCircleShape(b, 0.25f, new ShapeDef(1.0f)); } //Chassis ShapeDef sp = new ShapeDef(1.0f); sp.groupIndex = -1; m_chassis = API.CreateBody(world, pivot + m_offset, 0, BodyType.DYNAMIC_BODY); API.AddBoxShape(m_chassis, 2.5f, 1.0f, Vector2.zero, 0, sp); m_wheel = API.CreateBody(world, pivot + m_offset, 0, BodyType.DYNAMIC_BODY); API.AddCircleShape(m_wheel, 1.6f, sp); // Vector2 localArchorA,localArchorB; // // API.GetLocalPoint(m_wheel,pivot + m_offset,out localArchorA); // API.GetLocalPoint(m_chassis,pivot + m_offset,out localArchorB); // float referenceAngle = API.GetBodyAngle(m_chassis) - API.GetBodyAngle(m_wheel); // API.CreateRevoluteJoint(m_wheel, m_chassis, localArchorA, localArchorB, false, // referenceAngle,false, 0, 0, m_motorOn, m_motorSpeed, 400.0f); RevoluteJointDef rjd = new RevoluteJointDef(); rjd.Initialize(m_wheel, m_chassis, pivot + m_offset); rjd.collideConnected = false; rjd.motorSpeed = m_motorSpeed; rjd.maxMotorTorque = 400.0f; rjd.enableMotor = m_motorOn; API.CreateRevoluteJoint(world, rjd); Vector2 wheelAnchor = pivot + new Vector2(0, -0.8f); CreateLeg(-1.0f, wheelAnchor); CreateLeg(1.0f, wheelAnchor); Vector2 pos; API.GetPosition(m_wheel, out pos); API.SetTransform(m_wheel, pos, 120.0f * Mathf.PI / 180.0f); CreateLeg(-1.0f, wheelAnchor); CreateLeg(1.0f, wheelAnchor); API.GetPosition(m_wheel, out pos); API.SetTransform(m_wheel, pos, -120.0f * Mathf.PI / 180.0f); CreateLeg(-1.0f, wheelAnchor); CreateLeg(1.0f, wheelAnchor); }
private void API_onPlayerDisconnected(Client player, string reason) { API.triggerClientEventForAll("playerlist_leave", player.socialClubName); }
private void createNpcs() { tellerNpc = API.createPed(API.pedNameToModel(tellerModel), tellerPos, tellerRot); }
public DomingoBlError SendEmailWithAttachments(string emailAlias, List<MailAddress> deliveryAddresses, Dictionary<String, String> parameters, string attachmentPath) { try { using (TravelogyDevEntities1 context = new TravelogyDevEntities1()) { // get the xml template from DB HtmlEmailTemplate emailTemplate = context.HtmlEmailTemplates.Where(p => p.Alias == emailAlias).FirstOrDefault(); if (emailTemplate == null) { return new DomingoBlError() { ErrorCode = 200, ErrorMessage = "Invalid template alias" }; } // replace the parameters into the template HtmlEmail processedTemplate = ProcessTemplate(emailTemplate, parameters); MailMessage objMessage = new MailMessage(); objMessage.From = new MailAddress(processedTemplate.FromAddress, processedTemplate.FromName); foreach (MailAddress address in deliveryAddresses) { processedTemplate.ToAddress = address.Address; // construct the SMTP mail and send objMessage.From = new MailAddress(processedTemplate.FromAddress, processedTemplate.FromName); objMessage.Subject = processedTemplate.EmailSubject; objMessage.IsBodyHtml = true; objMessage.Body = processedTemplate.EmailText; objMessage.To.Clear(); objMessage.To.Add(address); var sendinBlue = new API("ICdw29ZamvD0WXcJ"); // sendinblue access key from the portal Dictionary<string, Object> data = new Dictionary<string, Object>(); Dictionary<string, string> to = new Dictionary<string, string>(); to.Add(address.Address, address.DisplayName); List<string> from_name = new List<string>(); from_name.Add(processedTemplate.FromAddress); from_name.Add(processedTemplate.FromName); List<string> attachment = new List<string>(); attachment.Add(attachmentPath); data.Add("to", to); data.Add("from", from_name); data.Add("subject", processedTemplate.EmailSubject); data.Add("html", processedTemplate.EmailText); data.Add("attachment", attachment); Object sendEmail = sendinBlue.send_email(data); Console.WriteLine(sendEmail); // save the mail to DB // to save the mail on DB context.HtmlEmails.Add(processedTemplate); context.SaveChanges(); } } return new DomingoBlError() { ErrorCode = 0, ErrorMessage = "" }; } // exception part catch (FormatException ex) { return new DomingoBlError() { ErrorCode = 100, ErrorMessage = string.Format("Error : {0}", ex) }; } }
public void UpdateTeamspeak() { var players = API.getAllPlayers().ToList(); players.ForEach(p => { try { UpdateTeamspeakForUser(p, players); } catch (Exception ex) { logger.Error(ex, $"UpdateTeamspeakForUser {p.socialClubName} : {ex.Message}"); } }); }
private Client GetPlayerByConnectionId(long connectionId) { return(API.getAllPlayers().ToList().FirstOrDefault(p => p.GetVoiceConnectionID() == connectionId)); }
private Client GetPlayerByTeamspeakId(string teamspeakId) { return(API.getAllPlayers().ToList().FirstOrDefault(p => p.GetTeamspeakID() == teamspeakId)); }
public void onUpdate(object sender, EventArgs e) { if (!IsRaceOngoing) { return; } lock (Opponents) { lock (CurrentRaceCheckpoints) foreach (var opponent in Opponents) { if (opponent.HasFinished || !opponent.HasStarted) { continue; } if (CurrentRaceCheckpoints.Any() && opponent.Client.Position.IsInRangeOf(CurrentRaceCheckpoints[opponent.CheckpointsPassed], 10f)) { opponent.CheckpointsPassed++; if (opponent.CheckpointsPassed >= CurrentRaceCheckpoints.Count) { if (Opponents.All(op => !op.HasFinished)) { API.startThread((ThreadStart) delegate { API.sleep(10000); API.sendChatMessageToAll("Vote for next map will start in 60 seconds!"); API.sleep(30000); API.sendChatMessageToAll("Vote for next map will start in 30 seconds!"); API.sleep(30000); if (!IsVoteActive()) { StartVote(); } }); } opponent.HasFinished = true; var pos = Opponents.Count(o => o.HasFinished); var suffix = pos.ToString().EndsWith("1") ? "st" : pos.ToString().EndsWith("2") ? "nd" : pos.ToString().EndsWith("3") ? "rd" : "th"; API.sendChatMessageToAll("~h~" + opponent.Client.Name + "~h~ has finished " + pos + suffix); API.triggerClientEvent(opponent.Client, "finishRace"); continue; } Vector3 nextPos = CurrentRaceCheckpoints[opponent.CheckpointsPassed]; Vector3 nextDir = null; if (CurrentRaceCheckpoints.Count > opponent.CheckpointsPassed + 1) { var nextCp = CurrentRaceCheckpoints[opponent.CheckpointsPassed + 1]; var curCp = CurrentRaceCheckpoints[opponent.CheckpointsPassed]; if (nextCp != null && curCp != null) { Vector3 dir = nextCp.Subtract(curCp); dir = dir.Normalize(); nextDir = dir; } } if (nextDir == null) { API.triggerClientEvent(opponent.Client, "setNextCheckpoint", nextPos, true, true); } else { API.triggerClientEvent(opponent.Client, "setNextCheckpoint", nextPos, false, true, nextDir, CurrentRaceCheckpoints[opponent.CheckpointsPassed + 1]); } } } } }
private async Task OnTick() { if (API.IsControlJustPressed(2, (uint)Controls.Keys.FrontendRight) && isSelectSexActive) { if (API.IsCamActive(Camera)) { API.SetCamActiveWithInterp(Camera_Female, Camera, 2000, 0, 0); API.SetCamActive(Camera, false); } else if (API.IsCamActive(Camera_Male)) { API.SetCamActiveWithInterp(Camera_Female, Camera_Male, 2000, 0, 0); API.SetCamActive(Camera_Male, false); } else { API.SetCamActiveWithInterp(Camera, Camera_Female, 2000, 0, 0); API.SetCamActive(Camera_Female, false); } await Delay(2000); } if (API.IsControlJustPressed(2, (uint)Controls.Keys.FrontendLeft) && isSelectSexActive) { if (API.IsCamActive(Camera)) { API.SetCamActiveWithInterp(Camera_Male, Camera, 2000, 0, 0); API.SetCamActive(Camera, false); } else if (API.IsCamActive(Camera_Female)) { API.SetCamActiveWithInterp(Camera_Male, Camera_Female, 2000, 0, 0); API.SetCamActive(Camera_Female, false); } else { API.SetCamActiveWithInterp(Camera, Camera_Male, 2000, 0, 0); API.SetCamActive(Camera_Male, false); } await Delay(2000); } if (API.IsControlJustPressed(2, (uint)Controls.Keys.FrontendAccept) && isSelectSexActive) { if (API.IsCamActive(Camera_Male)) { Debug.WriteLine("Hombre"); CreationSexPed(model_m, Camera_Male); isSelectSexActive = false; } else if (API.IsCamActive(Camera_Female)) { Debug.WriteLine("Mujer"); CreationSexPed(model_f, Camera_Female); isSelectSexActive = false; } else { } await Delay(100); } if (isSelectSexActive) { await DrawTxt(GetConfig.Langs["PressRightOrLeft"], 0.5f, 0.9f, 0.7f, 0.7f, 255, 255, 255, 255, true, true); } if (isInCharCreation) //Fix Run Ped { await DrawTxt(GetConfig.Langs["PressGuide"], 0.5f, 0.9f, 0.7f, 0.7f, 255, 255, 255, 255, true, true); API.FreezeEntityPosition(API.PlayerPedId(), true); API.ClearPedTasks(API.PlayerPedId(), 1, 1); API.DrawLightWithRange(-560.1646f, -3782.066f, 238.5975f, 255, 255, 255, 7.0f, 150.0f); } }
public static async Task changeScale(float scale) { skinPlayer["Scale"] = scale; Function.Call((Hash)0x25ACFC650B65C538, API.PlayerPedId(), scale); }
private void API_onPlayerConnected(Client player) { API.triggerClientEventForAll("playerlist_join", player.socialClubName, player.name, ColorForPlayer(player)); }
/// <summary> /// Resets the motion tracking system. /// /// This reinitializes the <c>TANGO_COORDINATE_FRAME_START_OF_SERVICE</c> coordinate frame to where the /// device is when you call this function; afterwards, if you ask for the pose with relation to start of /// service, it uses this as the new origin. You can call this function at any time. /// /// If you are using Area Learning, the <c>TANGO_COORDINATE_FRAME_AREA_DESCRIPTION</c> coordinate frame /// is not affected by calling this function; however, the device needs to localize again before you can use /// the area description. /// </summary> public static void ResetMotionTracking() { API.TangoService_resetMotionTracking(); }
public PauseMenuTitleHandler() { API.AddTextEntry("FE_THDR_GTAO", Strings.FE_THDR_GTAO); }
public void open_sevtixM_menu() { Menu hauptmenu = new Menu("sevtixM", "Hauptmenu") { Visible = true }; MenuController.AddMenu(hauptmenu); MenuItem fahrzeugeButton = new MenuItem("Fahrzeuge"); MenuItem spielerButton = new MenuItem("Spieler"); hauptmenu.AddMenuItem(fahrzeugeButton); hauptmenu.AddMenuItem(spielerButton); hauptmenu.AddMenuItem(new MenuItem("Schliessen")); hauptmenu.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 2: // OPTIONEN hauptmenu.CloseMenu(); break; } }; // --------------------------------------------------------------------- Menu fahrzeuge = new Menu("sevtixM", "Fahrzeuge") { Visible = false }; MenuController.AddSubmenu(hauptmenu, fahrzeuge); MenuItem upgradesButton = new MenuItem("Upgrades", ""); MenuItem reparierenButton = new MenuItem("Reparieren", ""); MenuItem customFahrzeugeButton = new MenuItem("Custom Fahrzeuge", ""); if (!IsPedInVehicle()) { reparierenButton.Enabled = false; upgradesButton.Enabled = false; } else { reparierenButton.Enabled = true; upgradesButton.Enabled = true; } fahrzeuge.AddMenuItem(reparierenButton); fahrzeuge.AddMenuItem(upgradesButton); fahrzeuge.AddMenuItem(customFahrzeugeButton); fahrzeuge.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; veh.Repair(); } else { SendMessageNoVehicleMessage(); } break; } }; // --------------------------------------------------------------------- // --------------------------------------------------------------------- Menu spieler = new Menu("sevtixM", "Spieler") { Visible = false }; MenuController.AddSubmenu(hauptmenu, spieler); spieler.AddMenuItem(new MenuItem("Heilen")); spieler.AddMenuItem(new MenuItem("Fahndungslevel zurücksetzen")); MenuItem godmodeButton = new MenuItem("Godmode"); spieler.AddMenuItem(godmodeButton); spieler.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: // Heilen Game.PlayerPed.Health = Game.PlayerPed.MaxHealth; SendMessage("sevtixM - Freeroam", "Du wurdest geheilt", 0, 255, 0); break; case 1: // Fahndung entfernen Game.Player.WantedLevel = 0; SendMessage("sevtixM - Freeroam", "Dein Fahndungslevel wurde zurückgesetzt", 0, 255, 0); break; } }; // --------------------------------------------------------------------- Ped ped = Game.PlayerPed; Menu godmode = new Menu("sevtixM", "Godmode") { Visible = false }; MenuController.AddSubmenu(spieler, godmode); godmode.AddMenuItem(new MenuItem("An")); godmode.AddMenuItem(new MenuItem("Aus")); godmode.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: // Heilen API.SetCurrentPedWeapon(ped.Handle, 2725352035, true); API.SetEntityInvincible(ped.Handle, true); //API.SetEnableHandcuffs(ped.Handle, true); API.SetPedCanSwitchWeapon(ped.Handle, false); API.SetPoliceIgnorePlayer(Game.Player.Handle, true); SendMessage("sevtixM - Freeroam", "Du bist nun Unverwundbar", 0, 255, 0); break; case 1: API.SetEntityInvincible(ped.Handle, false); //API.SetEnableHandcuffs(ped.Handle, false); API.SetPedCanSwitchWeapon(ped.Handle, true); API.SetPoliceIgnorePlayer(Game.Player.Handle, false); SendMessage("sevtixM - Freeroam", "Du bist nicht mehr Unverwundbar", 255, 0, 0); break; } }; // --------------------------------------------------------------------- Menu upgradesMenu = new Menu("sevtixM", "Upgrades") { Visible = false }; MenuController.AddSubmenu(fahrzeuge, upgradesMenu); List <string> engineUpgrades = new List <string>() { "Stock", "Level 1", "Level 2", "Level 3", "Level 4" }; MenuListItem engineItem = new MenuListItem("Motor", engineUpgrades, GetModIndexOfVehicleOr0(11)); upgradesMenu.AddMenuItem(engineItem); List <string> exhaustUpgrades = new List <string>() { "Stock", "Level 1", "Level 2", "Level 3", "Level 4" }; MenuListItem exhaust = new MenuListItem("Auspuff", exhaustUpgrades, GetModIndexOfVehicleOr0(4)); upgradesMenu.AddMenuItem(exhaust); upgradesMenu.OnListItemSelect += (_menu, _listItem, _listIndex, _itemIndex) => { int itemIndex = _itemIndex; int listIndex = _listIndex; switch (itemIndex) { case 0: // ENGINE if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; API.SetVehicleMod(veh.Handle, 11, listIndex - 1, false); } else { SendMessageNoVehicleMessage(); } break; case 4: // EXHAUST if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; API.SetVehicleMod(veh.Handle, 4, listIndex - 1, false); } else { SendMessageNoVehicleMessage(); } break; } }; // --------------------------------------------------------------------- Menu customfahrzeuge = new Menu("sevtixM", "Custom Fahrzeuge") { Visible = false }; MenuController.AddSubmenu(fahrzeuge, customfahrzeuge); customfahrzeuge.AddMenuItem(new MenuItem("KTM SX-F 450 Supermotard", "")); customfahrzeuge.AddMenuItem(new MenuItem("KTM EXC 530 Supermotard", "")); customfahrzeuge.AddMenuItem(new MenuItem("Toyota Supra", "")); customfahrzeuge.AddMenuItem(new MenuItem("Nissan Skyline GTR R34", "")); customfahrzeuge.AddMenuItem(new MenuItem("Nissan GTR R35", "")); customfahrzeuge.OnItemSelect += async(_menu, _item, _index) => { int index = _index; Vehicle spawned = null; switch (index) { case 0: spawned = await World.CreateVehicle(API.GetHashKey("sxf450sm"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 1: spawned = await World.CreateVehicle(API.GetHashKey("exc530sm"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 2: spawned = await World.CreateVehicle(API.GetHashKey("supra2"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 3: spawned = await World.CreateVehicle(API.GetHashKey("skyline"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 4: spawned = await World.CreateVehicle(API.GetHashKey("gtr"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; } spawned.NeedsToBeHotwired = false; API.SetPedIntoVehicle(Game.PlayerPed.Handle, spawned.Handle, -1); }; // --------------------------------------------------------------------- MenuController.BindMenuItem(hauptmenu, fahrzeuge, fahrzeugeButton); MenuController.BindMenuItem(hauptmenu, spieler, spielerButton); MenuController.BindMenuItem(fahrzeuge, customfahrzeuge, customFahrzeugeButton); MenuController.BindMenuItem(fahrzeuge, upgradesMenu, upgradesButton); MenuController.BindMenuItem(spieler, godmode, godmodeButton); }
public async Task UpdateCompanyStocksAsync() { var companyStocks = await API.GetCompanyHistory(this.CompanySymbol); CompanyStocks = companyStocks[0]; }
public override void LoadContentNow() { this._audioEngine = new AudioEngine(Path.Combine(this.Content.RootDirectory, "Content/audio/the_pit.xgs")); this._effectsWaveBank = new WaveBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/fx.xwb")); this._speechWaveBank = new WaveBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/speech.xwb"), 0, (short)16); this._effectsSoundBank = new SoundBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/fx.xsb")); this._musicWaveBank = new WaveBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/music.xwb"), 0, (short)16); this._musicSoundBank = new SoundBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/music.xsb")); this._tutorialWaveBank = new WaveBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/tutorial.xwb"), 0, (short)16); this._tutorialSoundBank = new SoundBank(this._audioEngine, Path.Combine(this.Content.RootDirectory, "Content/audio/tutorial.xsb")); this._audioEngine = new AudioEngine("Content/audio/the_pit.xgs"); this._effectsWaveBank = new WaveBank(this._audioEngine, "Content/audio/fx.xwb"); this._speechWaveBank = new WaveBank(this._audioEngine, "Content/audio/speech.xwb", 0, (short)16); this._effectsSoundBank = new SoundBank(this._audioEngine, "Content/audio/fx.xsb"); this._musicWaveBank = new WaveBank(this._audioEngine, "Content/audio/music.xwb", 0, (short)16); this._musicSoundBank = new SoundBank(this._audioEngine, "Content/audio/music.xsb"); this._tutorialWaveBank = new WaveBank(this._audioEngine, "Content/audio/tutorial.xwb", 0, (short)16); this._tutorialSoundBank = new SoundBank(this._audioEngine, "Content/audio/tutorial.xsb"); Game1.RunContext.Sound.Engine = this._audioEngine; Game1.RunContext.Sound.Effects = this._effectsSoundBank; Game1.RunContext.Sound.Music = this._musicSoundBank; Game1.RunContext.Sound.Tutorial = this._tutorialSoundBank; Data.Initialize(this.Content); Game1.SpriteManager.Initialize(); if (API.IsAvailable) { if (Profiles.Current.ForceCloudDisabled) { Profiles.Current.ForceCloudDisabled = false; Log.Trace("Disabling cloud storage by default for pre-existing profile."); API.SetCloudEnabledForApp(false); } Game1.RunContext.StatsAndAchievements = new ThePit.StatsAndAchievements(); } this.graphicsContext.DefaultFont = Data.GetFont(Names.Assets.DefaultFont); this.graphicsContext.DebugFont = Data.GetFont(Names.Assets.StatsFont); this.graphicsContext.WorldRenderer = new OrthographicRenderer(); this.graphicsContext.WorldRenderer.Init(this.Content); this.uiManager = new Manager((IGameMessageQueue)this, this.Content, this.graphicsContext.DefaultFont); this.uiManager.MainPanel.Size = Tweaks.NativeScreenSize.ToVector2(); this.uiManager.AddScreen(Names.Screens.MainMenu, (Screen) new MainMenuScreen()); this.uiManager.AddScreen(Names.Screens.InGame, (Screen) new InGameScreen()); this.uiManager.AddScreen(Names.Screens.SelectPlayer, (Screen) new SelectPlayerScreen()); this.uiManager.AddScreen(Names.Screens.GameOver, (Screen) new GameOverScreen()); this.uiManager.AddScreen(Names.Screens.Logo, (Screen) new LogoScreen()); this.uiManager.AddScreen(Names.Screens.Cinematic, (Screen) new CinematicScreen()); this.uiManager.AddScreen(Names.Screens.Scores, (Screen) new ScoresScreen()); this.uiManager.AddScreen(Names.Screens.GameOptions, (Screen) new GameOptionsScreen()); this.uiManager.AddScreen(Names.Screens.DemoEnd, (Screen) new DemoEndSplash()); this.uiManager.AddScreen(Names.Screens.DemoExit, (Screen) new DemoExitSplash()); this.uiManager.AddScreen(Names.Screens.DebugAnimations, (Screen) new DebugAnimations()); foreach (VolumeSetting setting in Volume.Settings) { this.SetVolume(setting.Category, Profiles.Current.GetVolume(setting.Category)); } Profiles.Current.LoadKeyBindings(KeyCommands.Commands); Profiles.Current.LoadGamePadBindings(GamePadCommands.Commands); if (this.GraphicsContext.SupportedDisplayResolutions.Contains <DisplayResolution>(Profiles.Current.DisplayResolution)) { this.DisplayResolution = Profiles.Current.DisplayResolution; } GameSetupParams startGameParams = this.GetStartGameParams(); if (startGameParams != null) { this.NewGame(startGameParams); } else { this.uiManager.ShowScreen(Names.Screens.Logo); } // now go back and inject our own ingame screen handler // (this allows us to hook things like player input and in game menus) var screen = (Screen) new InGameScreenHook(); screen.Name = Names.Screens.InGame; this.uiManager._screens[Names.Screens.InGame] = screen; // inject select player and main menu screens // (so we can add characters) screen = (Screen) new SelectPlayerScreenHook(); screen.Name = Names.Screens.SelectPlayer; this.uiManager._screens[Names.Screens.SelectPlayer] = screen; screen = (Screen) new MainMenuScreenHook(); screen.Name = Names.Screens.MainMenu; this.uiManager._screens[Names.Screens.MainMenu] = screen; }
public WeaponOnBack() { _previousWeaponInHand = Game.PlayerPed.Weapons[WeaponHash.Unarmed]; Tick += UpdateWeaponsOnBackAsync; Tick += LoadWeaponAsset; Tick += ReAttachWeapons; API.RegisterCommand("wob", new Action <int, List <object>, string>((source, args, raw) => { try { var commandArg1 = args[0].ToString().ToLower(); var weapon = _latestWeaponOnBack; var weaponObject = _latestWeaponObjectOnBack; switch (commandArg1) { case "pos": case "position": var position = new Vector3( float.Parse(args[1].ToString()) / 100, float.Parse(args[2].ToString()) / 100, float.Parse(args[3].ToString()) / 100); WeaponOffset.Set(weapon.Hash, WeaponOffset.OffsetType.Position, position); AttachWeapon(weapon, weaponObject); Debug.WriteLine($"[{ResourceName}]{GameModeName}:{ResourceName}:CommandSucceed: {raw}"); TriggerEvent($"{GameModeName}:{ResourceName}:CommandSucceed", raw); break; case "rot": case "rotation": var rotation = new Vector3( float.Parse(args[1].ToString()), float.Parse(args[2].ToString()), float.Parse(args[3].ToString())); WeaponOffset.Set(weapon.Hash, WeaponOffset.OffsetType.Rotation, rotation); AttachWeapon(weapon, weaponObject); Debug.WriteLine($"[{ResourceName}]{GameModeName}:{ResourceName}:CommandSucceed: {raw}"); TriggerEvent($"{GameModeName}:{ResourceName}:CommandSucceed", raw); break; // case "reg": // // Sync // var handle = weaponObject.Handle; // // if (API.NetworkGetEntityIsNetworked(weaponObject.Handle)) // { // Debug.WriteLine($"not networked {weaponObject.Handle}"); // } // weaponObject.IsPersistent = true; // var netId = API.NetworkGetNetworkIdFromEntity(handle); // API.NetworkRegisterEntityAsNetworked(API.ObjToNet(handle)); // API.SetNetworkIdCanMigrate(netId, true); // API.SetNetworkIdExistsOnAllMachines(netId, true); // API.NetworkRequestControlOfEntity(handle); // Debug.WriteLine($"try set prop as networked {weaponObject.Handle}"); // break; default: Debug.WriteLine($"[{ResourceName}]{GameModeName}:{ResourceName}:CommandFailed: {raw}"); TriggerEvent($"{GameModeName}:{ResourceName}:CommandFailed", raw); break; } } catch (Exception e) { Debug.WriteLine($"[{ResourceName}][ERROR]{e.Message}"); // Debug.WriteLine($"[{ResourceName}]Usage: /wob pos [posX] [posY] [posZ]"); // Debug.WriteLine($"[{ResourceName}]Usage: /wob rot [rotX] [rotY] [rotZ]"); Debug.WriteLine($"[{ResourceName}]{GameModeName}:{ResourceName}:CommandFailed: {raw}"); TriggerEvent($"{GameModeName}:{ResourceName}:CommandFailed", raw); } }), false); #if DEBUG API.RegisterCommand("wob-current", new Action(() => { var currentWeapon = Game.PlayerPed.Weapons.Current; var currentWeaponSlot = API.GetWeapontypeSlot((uint)currentWeapon.Hash); var currentWeapontypeInSlot = API.GetPedWeapontypeInSlot(Game.PlayerPed.Handle, (uint)currentWeaponSlot); Debug.WriteLine($"currentWeapon: {(uint)currentWeapon.Hash}"); Debug.WriteLine($"Game.PlayerPed.Weapons.Current.Group: {(uint)Game.PlayerPed.Weapons.Current.Group}"); Debug.WriteLine($"currentWeaponSlot: {(uint)currentWeaponSlot}"); Debug.WriteLine($"currentWeapontypeInSlot: {(uint)currentWeapontypeInSlot}"); }), false); API.RegisterCommand("wob-pos", new Action <int, List <object>, string>((source, args, raw) => { var weaponObject = Entity.FromHandle(int.Parse(args[0].ToString())); if (weaponObject is null || !weaponObject.Exists()) { return; } var pedBone = Game.PlayerPed.Bones[(Bone)int.Parse(args[1].ToString())]; var attachPos = new Vector3(float.Parse(args[2].ToString()), float.Parse(args[3].ToString()), float.Parse(args[4].ToString())); var attachRot = new Vector3(float.Parse(args[5].ToString()), float.Parse(args[6].ToString()), float.Parse(args[7].ToString())); weaponObject.AttachTo(pedBone, attachPos, attachRot); // CurrentWeaponsOnBack.Values.ForEach(weaponObject => { }); }), false); API.RegisterCommand("wob-view", new Action(() => { Debug.WriteLine("_weaponAttachedObject"); WeaponDisplay.GetAllDisplayedWeaponObjects().ForEach(kvp => { var weaponObject = kvp.Value; Debug.WriteLine($"weapon: {weaponObject?.Model}({weaponObject?.Model.Hash}), modelHandle: {weaponObject?.Handle}"); }); }), false); #endif }
private void Form1_Load(object sender, EventArgs e) { API.RadioAdded += new API.RadioAddedEventHandler(API_RadioAdded); API.RadioRemoved += new API.RadioRemovedEventHandler(API_RadioRemoved); API.Init(); }
private void ColoredNames_onGotColoredName(object[] args) { var client = (Client)args[0]; API.triggerClientEventForAll("playerlist_join", client.socialClubName, client.name, ColorForPlayer(client)); }
private string GetFriendlyAvatarFileName(string type) { return("Avatar - " + blueprintName.text + " - " + type + " - " + Application.unityVersion + "_" + ApiWorld.VERSION.ApiVersion + "_" + API.GetAssetPlatformString() + "_" + API.GetServerEnvironmentForApiUrl()); }
public Config() { MaxClients = API.GetConvarInt("sv_maxclients", 32); ServerName = API.GetConvar("sv_hostname", ""); }
private void Start() { api = GameObject.Find("Manager").GetComponent <API>(); }
private void OnClientEvent(Client sender, string eventName, params object[] arguments) { switch (eventName) { case "JobService": { if (!sender.hasData("JobMarker_ID")) { return; } Job job = Main.Jobs.FirstOrDefault(h => h.ID == sender.getData("JobMarker_ID")); if (job == null) { return; } if (job.Type != JobType.SecurityGuard) { return; } int index = (int)arguments[0]; switch (index) { case 0: if (job.Vehicles.Count < 1) { sender.sendNotification("ERROR", "Estamos sem veículos no momento."); return; } var atms = Gameplay.Bank.Main.Banks.Where(x => x.Type != 0).ToList(); if (atms.Count < 1) { sender.sendNotification("ERROR", "Todos os caixas estão vazios."); return; } if (PlayerVehicle.ContainsKey(sender)) { if (API.doesEntityExist(PlayerVehicle[sender])) { API.deleteEntity(PlayerVehicle[sender]); } PlayerVehicle.Remove(sender); } Random random = new Random(); int i = random.Next(job.Vehicles.Count); var vehicle = API.createVehicle(job.Vehicles[i].Model, job.Vehicles[i].Position, job.Vehicles[i].Rotation, job.Vehicles[i].PrimaryColor, job.Vehicles[i].SecondaryColor); vehicle.engineStatus = false; PlayerVehicle.Add(sender, vehicle); PlayerJobProgress[sender] = 0; sender.sendNotification("", "Pegue o caminhão e vá coletar o dinheiro"); sender.triggerEvent("SecurityGuardJobStart", vehicle, atms[random.Next(atms.Count)].Position); break; } break; } case "SecurityGuardGetNextCheckpoint": { PlayerJobProgress[sender]++; if (PlayerJobProgress[sender] < 5) { Random random = new Random(); var atms = Gameplay.Bank.Main.Banks.Where(x => x.Type != 0).ToList(); sender.sendNotification("", "Vá para o próximo endereço"); sender.triggerEvent("SecurityGuardGetNextCheckpoint", atms[random.Next(atms.Count)].Position); } else if (PlayerJobProgress[sender] == 5) { List <Vector3> positions = new List <Vector3>() { new Vector3(-143.3035, -822.2595, 31.32913), new Vector3(-46.75024, -764.0831, 32.82755) }; Random rand = new Random(); sender.triggerEvent("SecurityGuardGetNextCheckpoint", positions[rand.Next(positions.Count)], true); sender.sendNotification("", "Vá até o banco entregar o dinheiro."); } else { int payment = 2500; sender.sendNotification("", $"Você finalizou o serviço e recebeu ~g~$~w~{payment}."); sender.giveMoney(payment); sender.triggerEvent("SecurityGuardDeleteEntities"); } break; } case "SecurityGuardCarryAnimPlay": { var obj = API.createObject(289396019, sender.position, new Vector3(0, 0, 0)); API.attachEntityToEntity(obj, sender, "SKEL_L_Hand", new Vector3(0.2, 0.05, 0.05), new Vector3(0, 0, 0)); sender.setData("SECURITY_JOB_OBJ", obj); sender.playAnimation("anim@heists@box_carry@", "idle", (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl)); break; } case "SecurityGuardCarryAnimStop": { if (!sender.hasData("SECURITY_JOB_OBJ")) { return; } var obj = sender.getData("SECURITY_JOB_OBJ"); API.deleteEntity(obj); sender.resetData("SECURITY_JOB_OBJ"); sender.stopAnimation(); break; } } }
private Client GetPlayerBySessionId(string clientGUID) { return(API.getAllPlayers().ToList().FirstOrDefault(p => p.GetName() == clientGUID)); }
private void SetUpPlayerForRace(Client client, Race race, bool freeze, int spawnpoint) { if (race == null) { return; } var selectedModel = unchecked ((int)((uint)race.AvailableVehicles[randGen.Next(race.AvailableVehicles.Length)])); var position = race.SpawnPoints[spawnpoint % race.SpawnPoints.Length].Position; var heading = race.SpawnPoints[spawnpoint % race.SpawnPoints.Length].Heading; API.setEntityPosition(client.CharacterHandle, position); Vector3 newDir = null; if (race.Checkpoints.Length >= 2) { Vector3 dir = race.Checkpoints[1].Subtract(race.Checkpoints[0]); dir = dir.Normalize(); newDir = dir; } var nextPos = race.Checkpoints[0]; if (newDir == null) { API.triggerClientEvent(client, "setNextCheckpoint", nextPos, true, false); } else { API.triggerClientEvent(client, "setNextCheckpoint", nextPos, false, false, newDir, race.Checkpoints[1]); } var playerVehicle = API.createVehicle(selectedModel, position, new Vector3(0, 0, heading), 0, 0); Thread.Sleep(500); API.setPlayerIntoVehicle(client, playerVehicle, -1); if (freeze) { API.setEntityPositionFrozen(client, playerVehicle, true); } Opponent inOp = Opponents.FirstOrDefault(op => op.Client == client); lock (Opponents) { if (inOp != null) { inOp.Vehicle = playerVehicle; inOp.HasStarted = true; } else { Opponents.Add(new Opponent(client) { Vehicle = playerVehicle, HasStarted = true }); } } }