4th of July VIP Sale! Use Coupon Code “1776” at Checkout for 55% Off All VIP Tiers! Thank you for supporting us! ×
Jump to content
×
×
  • Create New...

Advice for beginners for making callouts


Recommended Posts

This wall of text was designed for those of you who have no or limited coding experience with callouts.  Although there may be a few helpful tips for veteran coders, the purpose of this is to target beginners who have no idea what they’re doing or feel overwhelmed trying to learn how to make their own callouts.

 

First and foremost, the community isn’t toxic nor are they unwilling to help new coders, but they will not just write a bunch of code for you or tell you exactly how to make something work unless it’s related directly to code you’ve attempted to write already.  If you’re unable to figure something out, explicitly state what the issue is you’re having and what code you’re using or have used that would not work.  Most people with issues will simply ask what code they need to use to get the end result, this sort of thinking will unfortunately get the assumption response of you asking for someone to write the code for you even if you’re just trying to understand what you’re writing in the code.  The fallacy of this is that sometimes you won’t know what you don’t know, and no amount of telling you to Google or search something you’re not familiar with in the first place will get you any sort of assistance as it will only get you information you’re not looking for.

 

The best advice I can give for learning the basics is going out and finding guides that have been previously written and posted on this forum, and going through the callouts on Github that have been released by members of this community to get an understanding of what the code is going to look like.  Once you’ve given them a look, start editing some of them with whatever you want to add.  If you can’t think of anything, think of a callout you want to create and think how you could test parts of the idea in the premade callouts.  If you can’t think of anything specific or you have no idea what you're, look at what each callout lacks in terms of code from the others, make an alteration to the differences if you feel comfortable doing so, and then introduce that difference in code (usually a line or three) into the other callouts.

 

Please do not forget that just because there is no errors in your code does not mean it will function as intended.  Be prepared to test your callouts several times before the function properly.

 

Now here’s several key points that will help you in your coding future that I’ll touch on;

• Repetition, repetition, repetition.

• // (comments)

• Notes of specific code

• Planning

 

Repetition is important in understanding code.  Repetition is important in learning code.  Repetition is important, period.  Doing the same thing over and over does not have the intention of helping you memorize every line of code, but rather to remember key sections of code so when you’re coding something else you can just relay back to said code instead of having to look it up.  This will also help in reducing the massive amount of time you’ll spend getting callouts written by removing the need to research how to write the same or similar code, it’ll also help not needing to save forum posts or Discord messages when trying to remember where you found code to help your task.  Just don’t expect to begin memorizing what you need right off the bat, which leads me to my next key point.

 

“ // ” is the “ ignore me ” sign, so you can leave all sorts of notes for yourself or anyone else within your code.  This is wonderful for keeping callouts organized or you just need to remind yourself why you’re having someone run in a circle and then ragdoll.  You can also have the callout ignore sections of code if you’re just wanting to test certain parts of your callout at a time.

 

Saving notes of specific lines of code that you’ve either used or seen used for specific tasks that you would want to potentially use later helps a lot more than many people would realize.  A good example would be having a few various ways of getting a random location from spots chosen to start a callout;

 

// Reminder; each coordinate (x/y/z) in the callout must end in the letter “ f “, so it will be shown as (xf, yf, zf) in the code.

// Standard ‘random’ location

// Under - public <Callout name> ()

Random <local variable> = new Random();
int <local variable 2> = <local variable>.Next(1, 100 + 1);  // Numbers can be changed.
if (<local variable 2> >= <number> && <local variable 2> <= <number>)

         InitInfo(new Vector3(xf,yf,zf));

if(<local variable 2> >= <number> && <local variable 2> <= <number>)

         InitInfo(new Vector3(xf,yf,zf));

// etc.


||

// List ‘random’ location

// Under - public class <callout name> : Callout

private vector3[] coordinates = 

{

     new Vector3(xf,yf,zf),

     new Vector3(xf,yf,zf),

     new Vector3(xf,yf,zf),

     // etc.

}

// Under public <Callout name>()

{

     InitInfo(coordinates[RandomUtils.Random.Next(coordinates.Length)]);

}

 

Now the first thing you must think is, why would anyone use the first set of code if you can use less lines and code with the second?  Well it completely depends on what you intend to occur with the callout.  Looking back at the first set of code, this is stating that code will occur if the random number generator decides to be between two numbers, meaning we can add additional code besides just the location if the number is between two numbers.  For example;

Random <local variable> = new Random();
int <local variable 2> = <local variable>.Next(1, 100 + 1);  // Numbers can be changed.
if (<local variable 2> >= <number> && <local variable 2> <= <number>)

     InitInfo(new Vector3(xf,yf,zf));

     ShortName = Assault”;

     CalloutDescription = Caller reports an assault in progress.”

if (<local variable> >= <number> && <local variable> <= <number>)

     InitInfo(new Vector3(xf,yf,zf));

     ShortName = Battery

     CalloutDescription = Caller reports a battery in progress.”

 

// Please note; not all functions (code) will work under an if or else, so some stuff you can’t directly randomize everything using this set of code.

 

For the second set of code, the focus is simply on locations only, so this may work better for you if you’re not concerned with the start location in reference to the rest of the callout.

 

Planning callouts may seem like a daunting or waste of time, but it will help you immensely after you’ve tried to make a callout from scratch with whatever you felt like at the time.  Similar to keeping notes to save time, planning something out before you work on it will ensure that you aren’t deleting code because your inspiration changed from having a Fast and Furious pursuit to trying to recreate the opening to The Negotiator halfway through.  It’ll also help reduce time spent coding, meaning you can spend more time enjoying the fruits of your labor.  A few items you want to keep in mind to record in your notes when planning a callout; specific items on peds/vehicles (if any), general location(s) of callout, specific peds (if any), specific vehicles (if any), specific questions and answers (if any), and any other little details you may want to add to give your callout life. 

 

I hope this has helped you better understand the code and possibly the API of FivePD so you can begin creating your art.  If this is your first time dabbling in coding, I highly suggest looking into the basics of C# as it will help better understand the format of your code and other techniques that you could use in callout creation.

  • Like 1
Link to post
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.   Restore formatting

  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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Important Information

Thanks for visiting GPM. As a user of the GTAPoliceMods platform, we ask that you review the Terms of Use, Privacy Policy, and Guidelines. These principles allow us to continue fostering a great community. We have placed cookies on your device to help improve your experience. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.