Jump to content

CLR ASSEMBLY


KALIL

Recommended Posts

10 hours ago, KALIL said:

when ever I try to load my callout I get " The specified file is not a valid CLR assembly ", Anyone know what's going on? Suggestions?

Hi Sir Download that API Here > that will fix your assembly

to enter the project :-

API Examples > DemoProject > DemoProject > DemoProject.sln

And Add Your Script i hope your callouts will be good

Link to comment
Share on other sites

Sorry its been awhile since I responded, here's my script.

 

using System;

using LSPD_First_Response.Engine.Scripting.Entities;

using LSPD_First_Response.Mod.API;

using LSPD_First_Response.Mod.Callouts;

using Rage;

 

Functions.RegisterCallout(typeof(Callouts.ExampleCallout));

namespace APIExample.Callouts

{

 

[CalloutInfo("ExampleCallout", CalloutProbability.Medium)]

public class ExampleCallout : Callout

{

 

private Vehicle myVehicle; // a rage vehicle

private Ped myPed; // a rage ped

private Vector3 SpawnPoint; // a Vector3

private Blip myBlip; // a rage blip

private LHandle pursuit; // an API pursuit handle

/// <summary>

/// OnBeforeCalloutDisplayed is where we create a blip for the user to see where the pursuit is happening, we initiliaize any variables above and set

/// the callout message and position for the API to display

/// </summary>

/// <returns></returns>

public override bool OnBeforeCalloutDisplayed()

{

//Set our spawn point to be on a street around 300f (distance) away from the player.

SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(300f));

//Create our ped in the world

myPed = new Ped("a_m_y_mexthug_01", SpawnPoint, 0f);

//Create the vehicle for our ped

myVehicle = new Vehicle("DUKES2", SpawnPoint);

//Now we have spawned them, check they actually exist and if not return false (preventing the callout from being accepted and aborting it)

if (!myPed.Exists()) return false;

if (!myVehicle.Exists()) return false;

//If we made it this far both exist so let's warp the ped into the driver seat

myPed.WarpIntoVehicle(myVehicle, -1);

// Show the user where the pursuit is about to happen and block very close peds.

this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);

this.AddMinimumDistanceCheck(5f, myPed.Position);

// Set up our callout message and location

this.CalloutMessage = "Example Callout Message";

this.CalloutPosition = SpawnPoint;

//Play the police scanner audio for this callout (available as of the 0.2a API)

Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_RESIST_ARREST IN_OR_ON_POSITION", SpawnPoint);

return base.OnBeforeCalloutDisplayed();

}

 

/// <summary>

/// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well

/// </summary>

/// <returns></returns>

public override bool OnCalloutAccepted()

{

//We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is.

myBlip = myPed.AttachBlip();

this.pursuit = Functions.CreatePursuit();

Functions.AddPedToPursuit(this.pursuit, this.myPed);

return base.OnCalloutAccepted();

}

/// <summary>

/// If you don't accept the callout this will be called, we clear anything we spawned here to prevent it staying in the game

/// </summary>

public override void OnCalloutNotAccepted()

{

base.OnCalloutNotAccepted();

if (myPed.Exists()) myPed.Delete();

if (myVehicle.Exists()) myVehicle.Delete();

if (myBlip.Exists()) myBlip.Delete();

}

//This is where it all happens, run all of your callouts logic here

public override void Process()

{

base.Process();

 

//A simple check, if our pursuit has ended we end the callout

if (!Functions.IsPursuitStillRunning(pursuit))

{

this.End();

}

}

/// <summary>

/// More cleanup, when we call end you clean away anything left over

/// This is also important as this will be called if a callout gets aborted (for example if you force a new callout)

/// </summary>

public override void End()

{

base.End();

if (myBlip.Exists()) myBlip.Delete();

if (myPed.Exists()) myPed.Delete();

if (myVehicle.Exists()) myVehicle.Delete();

 

}

}

}

Link to comment
Share on other sites

It should go under Plugins\LSPDFR. LSPDFR will load it automatically. 

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Link to comment
Share on other sites

One thing I noticed is that you have " Functions.RegisterCallout(typeof(Callouts.ExampleCallout)); " on top of the namespace, I don't know if it originally is in other part and you just copy all together here but it should be inside a class method. Are you using VisualStudio? It should tell you about these errors.

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...