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
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#1
2021-03-30, 11:17 AM (This post was last modified: 2021-03-31, 04:00 AM by PutuSuhartawan.)
How do I create new native functions that can be suggested to the autotext system later? so far I can only walk with #define only.

FIXED

[ First Install the All Autocomplete - Packages - Package Control ]


[Image: 167018997_5565589703481329_5851269852517...e=6088143A]
[Image: 166749805_5565592510147715_7986765319724...e=60882027]
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 »



  • 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