Skip to content

Commit

Permalink
Add various y_* syntax, reorganize snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiuraa committed Dec 10, 2022
1 parent afc8d51 commit 75dae7f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 106 deletions.
103 changes: 1 addition & 102 deletions snippets/functions-community.json
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@
"body":
"FCNPC_GoByMovePath(${1:npcid}, ${2:pathid}, ${3:type = MOVE_TYPE_AUTO}, ${4:Float:speed = MOVE_SPEED_AUTO}, ${5:bool:UseMapAndreas = false}, ${6:Float:radius = 0.0}, ${7:bool:setangle = true})$0"
},

"orm_create": {
"prefix": "orm_create",
"body": "orm_create(${1:const table[]}, ${2:MySQL:handle = MYSQL_DEFAULT_HANDLE})$0"
Expand Down Expand Up @@ -780,7 +779,6 @@
"prefix": "orm_setkey",
"body": "orm_setkey(${1:ORM:id}, ${2:const columnname[]})$0"
},

"mysql_log": {
"prefix": "mysql_log",
"body": "mysql_log(${1:E_LOGLEVEL:loglevel = ERROR | WARNING})$0"
Expand Down Expand Up @@ -1014,7 +1012,6 @@
"body":
"OnQueryError(${1:errorid}, ${2:const error[]}, ${3:const callback[]}, ${4:const query[]}, ${5:MySQL:handle})$0"
},

"CA_Init": {
"prefix": "CA_Init",
"body": "CA_Init()$0"
Expand Down Expand Up @@ -1127,7 +1124,6 @@
"prefix": "CA_OnGameModeExit",
"body": "CA_OnGameModeExit()$0"
},

"heapspace": {
"prefix": "heapspace",
"body": "heapspace()$0"
Expand Down Expand Up @@ -1194,7 +1190,6 @@
"prefix": "existproperty",
"body": "existproperty(${1:id=0}, ${2:const name[]=\"\"}, ${3:value=cellmin})$0"
},

"PrintAmxBacktrace": {
"prefix": "PrintAmxBacktrace",
"body": "PrintAmxBacktrace()$0"
Expand All @@ -1219,7 +1214,6 @@
"prefix": "IsCrashDetectPresent",
"body": "IsCrashDetectPresent()$0"
},

"sendstring": {
"prefix": "sendstring",
"body": "sendstring(${1:const message[]}, ${2:const destination[]=\"\"})$0"
Expand All @@ -1240,7 +1234,6 @@
"prefix": "receivepacket",
"body": "receivepacket(${1:const packet[]}, ${2:size}, ${3:const source[]})$0"
},

"OnDialogPerformed": {
"prefix": "OnDialogPerformed",
"body": "OnDialogPerformed(${1:playerid}, ${2:dialog[]}, ${3:response}, ${4:success})$0"
Expand All @@ -1262,7 +1255,6 @@
"prefix": "Dialog",
"body": "Dialog:${1:name}(${2:params})$0"
},

"IRC_Connect": {
"prefix": "IRC_Connect",
"body":
Expand Down Expand Up @@ -1475,7 +1467,6 @@
"prefix": "IRC_IsOwner",
"body": "IRC_IsOwner(${1:botid}, ${2:channel[]}, ${3:user[]})$0"
},

"mS_GetNumberOfPages": {
"prefix": "mS_GetNumberOfPages",
"body": "mS_GetNumberOfPages(${1:ListID})$0"
Expand Down Expand Up @@ -1563,13 +1554,11 @@
"prefix": "StringURLEncode",
"body": "StringURLEncode(${1:szString[ ]}, ${2:iSize = sizeof( szString })$0"
},

"SortDeepArray": {
"prefix": "SortDeepArray",
"body":
"SortDeepArray(${1:array[][]}, ${2:sort_index}, ${3:order = SORT_ASC}, ${4:ignorecase = false})$0"
},

"pb_percent": {
"prefix": "pb_percent",
"body":
Expand Down Expand Up @@ -1657,12 +1646,6 @@
"body":
"SetPlayerProgressBarDirection(${1:playerid}, ${2:PlayerBar:barid}, ${3:direction})$0"
},

"y_timers: ptask": {
"prefix": "ptask",
"body": "ptask ${1:name}[${2:delay}](playerid) \n{\n\t${3}\n}$0"
},

"SmartCMD command": {
"prefix": "command",
"body":
Expand Down Expand Up @@ -1758,7 +1741,6 @@
"body":
"ExecuteCommand(${1:const cmd[]}, ${2:command_mode}, ${3:playerid}, ${4:success}, ${5:params[]=\"\"})$0"
},

"socket_create": {
"prefix": "socket_create",
"body": "socket_create(${1:pType:TCP})$0"
Expand Down Expand Up @@ -1880,7 +1862,6 @@
"prefix": "onSocketRemoteDisconnect",
"body": "onSocketRemoteDisconnect(${1:Socket:id}, ${2:remote_clientid})$0"
},

"db_query_hook": {
"prefix": "db_query_hook",
"description": "Part of the SQLitei(mproved). This is not part from the native sa-mp SQLite implementation.",
Expand Down Expand Up @@ -2116,7 +2097,6 @@
"description": "Part of the SQLitei(mproved). This is not part from the native sa-mp SQLite implementation.",
"body": "db_print_query(${1:DB:db}, ${2:szQuery[]}, ${3:iMaxFieldLength = 40})$0"
},

"sscanf": {
"prefix": "sscanf",
"body": "sscanf(${1:const data[]}, ${2:const format[]}, ${3:...})$0"
Expand All @@ -2125,7 +2105,6 @@
"prefix": "unformat",
"body": "unformat(${1:const data[]}, ${2:const format[]}, ${3:...})$0"
},

"Streamer_GetTickRate": {
"prefix": "Streamer_GetTickRate",
"body": "Streamer_GetTickRate()$0"
Expand Down Expand Up @@ -3282,10 +3261,6 @@
"prefix": "DINI_frenametextfile",
"body": "DINI_frenametextfile(${1:const filename[]}, ${2:const newfilename[]})$0"
},
"strlen": {
"prefix": "strlen",
"body": "strlen(${1:const string[]})$0"
},
"strpack": {
"prefix": "strpack",
"body": "strpack(${1:dest[]}, ${2:const source[]}, ${3:maxlength=sizeof dest})$0"
Expand All @@ -3294,50 +3269,10 @@
"prefix": "strunpack",
"body": "strunpack(${1:dest[]}, ${2:const source[]}, ${3:maxlength=sizeof dest})$0"
},
"strcat": {
"prefix": "strcat",
"body": "strcat(${1:dest[]}, ${2:const source[]}, ${3:maxlength=sizeof dest})$0"
},
"strcp": {
"strcpy": {
"prefix": "strcp",
"body": "strcpy(${1:dest[]}, ${2:src[]}, ${3:maxlength=sizeof dest})$0"
},
"strmid": {
"prefix": "strmid",
"body":
"strmid(${1:dest[]}, ${2:const source[]}, ${3:start}, ${4:end}, ${5:maxlength=sizeof dest})$0"
},
"strins": {
"prefix": "strins",
"body":
"strins(${1:string[]}, ${2:const substr[]}, ${3:pos}, ${4:maxlength=sizeof string})$0"
},
"strdel": {
"prefix": "strdel",
"body": "strdel(${1:string[]}, ${2:start}, ${3:end})$0"
},
"strcmp": {
"prefix": "strcmp",
"body":
"strcmp(${1:const string1[]}, ${2:const string2[]}, ${3:bool:ignorecase=false}, ${4:length=cellmax})$0"
},
"strfind": {
"prefix": "strfind",
"body":
"strfind(${1:const string[]}, ${2:const sub[]}, ${3:bool:ignorecase=false}, ${4:pos=0})$0"
},
"strval": {
"prefix": "strval",
"body": "strval(${1:const string[]})$0"
},
"valstr": {
"prefix": "valstr",
"body": "valstr(${1:dest[]}, ${2:value}, ${3:bool:pack=false})$0"
},
"ispacked": {
"prefix": "ispacked",
"body": "ispacked(${1:const string[]})$0"
},
"uudecode": {
"prefix": "uudecode",
"body": "uudecode(${1:dest[]}, ${2:const source[]}, ${3:maxlength=sizeof dest})$0"
Expand All @@ -3352,7 +3287,6 @@
"body":
"memcpy(${1:dest[]}, ${2:const source[]}, ${3:index=0}, ${4:numbytes}, ${5:maxlength=sizeof dest})$0"
},

"sprintf": {
"prefix": "sprintf",
"body": "sprintf(${1:const fmat[]}, ${2:...})$0"
Expand Down Expand Up @@ -3534,45 +3468,10 @@
"prefix": "ret_GetPlayerName",
"body": "ret_GetPlayerName(${1:playerid}, ${2:bool:pack = false})$0"
},

"y_timers: task": {
"prefix": "task",
"body": "task ${1:name}[${2:delay}]() \n{\n\t${3}\n}$0"
},

"gettime": {
"prefix": "gettime",
"body": "gettime(${1:hour=0}, ${2:minute=0}, ${3:second=0})$0"
},
"getdate": {
"prefix": "getdate",
"body": "getdate(${1:year=0}, ${2:month=0}, ${3:day=0})$0"
},
"tickcount": {
"prefix": "tickcount",
"body": "tickcount(${1:granularity=0})$0"
},

"y_timers: timer": {
"prefix": "timer",
"body": "timer ${1:name}[${2:delay}](${3:args}) \n{\n\t${4}\n}$0"
},

"y_command": {
"prefix": "YCMD",
"body": "YCMD:${1:command_name}(playerid, params[], help) \n{\n\t${4}\n\treturn 1;\n}$0"
},

"zcmd_command": {
"prefix": "ZCMD command",
"body": "CMD:${1:command_name}(playerid, params[])\n{\n\t${4}\n\treturn 1;\n}$0"
},

"zcmd_OnPlayerCommandReceived": {
"prefix": "ZCMD OnPlayerCommandReceived",
"body": "public OnPlayerCommandReceived(${1:playerid}, {$2:cmdtext[]})\n{\t\n${4}\n\treturn 1;\n}$0"
},

"zcmd_OnPlayerCommandPerformed": {
"prefix": "ZCMD OnPlayerCommandPerformed",
"body": "public OnPlayerCommandPerformed(${1:playerid}, ${2:cmdtext[]}, ${3:success})\n{\t\n${4}\n\treturn 1;\n}$0"
Expand Down
47 changes: 43 additions & 4 deletions snippets/functions-standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -2719,15 +2719,54 @@
"description": "Returns the amount of memory available for the heap/stack in bytes.",
"body": "heapspace()$0"
},
"strcat": {
"prefix": "strcat",
"body": "strcat(${1:dest[]}, ${2:const source[]}, ${3:maxlength=sizeof dest})$0"
},
"strlen": {
"prefix": "strlen",
"body": "strlen(${1:const string[]})$0"
},
"ispacked": {
"prefix": "ispacked",
"description": "Checks if the given string is packed.",
"body": "ispacked(${1:const string[]})$0"
},
"memcpy": {
"prefix": "memcpy",
"description": "Copy bytes from one location to another.",
"body": "memcpy(${1:dest[]}, ${2:const source[]}, ${3:index = 0}, ${4:numbytes}, ${5:maxlenght = sizeof dest})$0"
"strcopy": {
"prefix": "strcopy",
"body": "strcopy(${1:dest[]}, ${2:src[]}, ${3:maxlength=sizeof dest})$0"
},
"strmid": {
"prefix": "strmid",
"body":
"strmid(${1:dest[]}, ${2:const source[]}, ${3:start}, ${4:end}, ${5:maxlength=sizeof dest})$0"
},
"strins": {
"prefix": "strins",
"body":
"strins(${1:string[]}, ${2:const substr[]}, ${3:pos}, ${4:maxlength=sizeof string})$0"
},
"strdel": {
"prefix": "strdel",
"body": "strdel(${1:string[]}, ${2:start}, ${3:end})$0"
},
"strcmp": {
"prefix": "strcmp",
"body":
"strcmp(${1:const string1[]}, ${2:const string2[]}, ${3:bool:ignorecase=false}, ${4:length=cellmax})$0"
},
"strfind": {
"prefix": "strfind",
"body":
"strfind(${1:const string[]}, ${2:const sub[]}, ${3:bool:ignorecase=false}, ${4:pos=0})$0"
},
"strval": {
"prefix": "strval",
"body": "strval(${1:const string[]})$0"
},
"valstr": {
"prefix": "valstr",
"body": "valstr(${1:dest[]}, ${2:value}, ${3:bool:pack=false})$0"
},
"random": {
"prefix": "random",
Expand Down
36 changes: 36 additions & 0 deletions snippets/macros.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,41 @@
"description": "Callback hook.",
"body":
"public ${2:Function}(${3:Args})\n{\n\t${4}\n\t#if defined ${1:Prefix}_${2:Function}\n\t\treturn ${1:Prefix}_${2:Function}(${3:Args});\n\t#else\n\t\treturn 1;\n\t#endif\n}\n#if defined _ALS_${2:Function}\n\t#undef ${2:Function}\n#else\n\t#define _ALS_${2:Function}\n#endif\n\n#define ${2:Function} ${1:Prefix}_${2:Function}\n#if defined ${1:Prefix}_${2:Function}\n\tforward ${1:Prefix}_${2:Function}(${3:Args});\n#endif$0"
},
"y_timers: ptask": {
"prefix": "ptask",
"body": "ptask ${1:name}[${2:delay}](playerid) \n{\n\t${3}\n}$0"
},
"y_timers: timer": {
"prefix": "timer",
"body": "timer ${1:name}[${2:delay}](${3:args}) \n{\n\t${4}\n}$0"
},
"y_timers: task": {
"prefix": "task",
"body": "task ${1:name}[${2:delay}]() \n{\n\t${3}\n}$0"
},
"y_command": {
"prefix": "YCMD",
"body": "YCMD:${1:command_name}(playerid, params[], help) \n{\n\t${4}\n\treturn 1;\n}$0"
},
"y_foreach": {
"prefix": "foreach",
"body": "foreach (${1:expression}) \n{\n${4}\n}\n$0"
},
"y_hook: function": {
"prefix": "hook function",
"body": "hook function ${1:function_name}(${2:arguments}) \n${4}\nreturn continue(${2:arguments});\n$0"
},
"y_hook: callback": {
"prefix": "hook",
"body": "hook ${1:function_name}(${2:arguments}) \n${4}\nreturn 1;\n$0"
},
"y_scriptinit: final": {
"prefix": "final",
"body": "final ${1:variable_name} = ${2:function_name}\n$0"
},
"zcmd_command": {
"prefix": "ZCMD command",
"body": "CMD:${1:command_name}(playerid, params[])\n{\n\t${4}\n\treturn 1;\n}$0"
}
}

0 comments on commit 75dae7f

Please sign in to comment.