Jump to content

How can I stop a task?


mmods

Recommended Posts

private Ped myPed1;
private Ped myPed2;

public override bool OnCalloutAccepted() {
  
  myPed1.tasks.fightAgainst(myPed2);
  myPed2.tasks.fightAgainst(myPed1);
}
public override void Process() {

if (Game.Character.LocalPlayer.Position.DistanceTo(myPed1) <= 4f && Game.IskeyDown(Keys.Y){
  myPed1.keepTasks = false;
  myPed2.keepTasks = false;
}

Hello I'm making a callout and I want to make two peds fight but when I press a button I want the fight to stop. I tried this but it didn't worked. The code above is what I tried.

  

Link to comment
Share on other sites

47 minutes ago, mmods said:

private Ped myPed1;
private Ped myPed2;

public override bool OnCalloutAccepted() {
  
  myPed1.tasks.fightAgainst(myPed2);
  myPed2.tasks.fightAgainst(myPed1);
}
public override void Process() {

if (Game.Character.LocalPlayer.Position.DistanceTo(myPed1) <= 4f && Game.IskeyDown(Keys.Y){
  myPed1.keepTasks = false;
  myPed2.keepTasks = false;
}

Hello I'm making a callout and I want to make two peds fight but when I press a button I want the fight to stop. I tried this but it didn't worked. The code above is what I tried.

  


Spitballing here but try:

 

private Ped myPed1;
private Ped myPed2;

public override bool OnCalloutAccepted() {
  
  myPed1.tasks.fightAgainst(myPed2);
  myPed2.tasks.fightAgainst(myPed1);
}
public override void Process() {

if (Game.Character.LocalPlayer.Position.DistanceTo(myPed1) <= 4f && Game.IskeyDown(Keys.Y){
  myPed1.Tasks.Clear();
  myPed2.Tasks.Clear();
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...