Jump to content

» «

Compiler errors? Read this first!

1 reply to this topic
  • Fireboyd78

    Strangely Animated

  • Members
  • Joined: 30 Apr 2011
  • United-States


Posted 01 June 2015 - 10:57 PM Edited by CarLuver69, 01 June 2015 - 11:07 PM.

While developing a plugin using ScriptHook V, you may encounter an error such as this:

argument of type "char *" is incompatible with parameter of type "Any *"

This may be due to any of the following reasons:
  • Your natives.h file may be outdated. You can download the latest version here from NativeDB.
  • The native you are trying to use has not been documented yet. You may need to edit natives.h manually, and/or update the NativeDB entry accordingly.
For example, let's say you're trying to use VEHICLE::SET_VEHICLE_NAME_DEBUG(Any p0, Any *p1), but it hasn't been documented yet. A good way to figure out how a native works is to download the latest version of the decompiled scripts and search for "SET_VEHICLE_NAME_DEBUG" using your preferred method of searching files. I personally recommend Notepad++, which is good for many other uses as well!
After some research, you have determined the native is as follows:
VEHICLE::SET_VEHICLE_NAME_DEBUG(Vehicle vehicle, char *name)
You should update the entry on NativeDB to reflect your changes. I believe NativeDB generates a new natives.h every 10 minutes, so you may want to manually update your file if you need to use it right away. If you do not do this, a compiler error will be generated if you try to use a string as the second parameter:
VEHICLE::SET_VEHICLE_NAME_DEBUG(vehicle, "MIKE'S TAILGATER"); // error: argument of type "char *" is incompatible with parameter of type "Any *"
If you have any more questions regarding this subject, feel free to ask them here. This thread may be updated occasionally with solutions to common problems.
  • whorse, Dock, Alexander and 1 other like this

  • whorse


  • Members
  • Joined: 11 Feb 2011


Posted 10 September 2015 - 12:32 PM Edited by whorse, 10 September 2015 - 12:38 PM.

This thread is great! But it has a pretty misleading title. For some reason I had never read it until just now because I thought you meant something entirely different by "compiler errors" (because I honestly didn't think you could just change types in the natives.h file like that.) I'd found out by experimenting that types like "Ped and "Entity" are all really just renamed ints, but I didn't know that there was really nothing more to it, since I just started programming.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users