Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [FIXED] how create new native functions can be suggested by the autotext system

 
  • 0 Vote(s) - 0 Average
Pawn [FIXED] how create new native functions can be suggested by the autotext system
Kwarde
Offline

Burgershot Member
Posts: 99
Threads: 2
Joined: Sep 2020
Reputation: 8
Location: The Netherlands
#2
2021-03-30, 02:32 PM (This post was last modified: 2021-03-30, 02:34 PM by Kwarde.)
Native functions are functions inside the host application. Has nothing to do with creating a function list. Just so happens that pawno does this, but it's not what they are intended for (just making sure you know what native functions are). To truly create one you'd need to create a plugin.
https://raw.githubusercontent.com/compuphase/pawn/66e67291326b193045e52e4d6bcb51663260d6c3/doc/pawn-lang.pdf
Quote:The only means that a pawn program has to manipulate objects in the host application is by calling subroutines, so called “native functions”, that the host application provides.

Anyway, now the correct way to create custom function (snippet) list: You'll need a .code-snippets file in your .vscode directory for that. Syntax is as follows:
Code:
{
    "FunctionName": { //Displayed on the right of the popup
        "prefix": "FunctionName", //Displayed on the left of the popup
        "description": "Little description about the function", //Not displayed, as far as I know
        "body": "FunctionName()$0" //Text to insert to your file when the function is selected. See code below for an example of two of your functions
    }
}
For example: ./.vscode/my-functions.code-snippets
Code:
{
    "SEM": {
        "prefix": "SEM",
        "description": "Send an error message to a player",
        "body": "SEM(${1:playerid}, ${2:yourstring[]})$0"
    },
    "AddOwnableCarData": {
        "prefix": "AddOwnableCarData",
        "description": "Add ownable car data",
        "body": "AddOwnableCarData(${1:vehicleid}, ${2:OC_SQL_ID}, ${3:plus}, ${4:new_value})$0"
    }
}

More (and better) information about snippets here: https://code.visualstudio.com/docs/editor/userdefinedsnippets
« Next Oldest | Next Newest »



Messages In This Thread
[FIXED] how create new native functions can be suggested by the autotext system - by PutuSuhartawan - 2021-03-30, 11:17 AM
RE: Help! how create new native functions can be suggested by the autotext system - by Kwarde - 2021-03-30, 02:32 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode