From 59b935d84acb5c4b0be068bcc27804450465d468 Mon Sep 17 00:00:00 2001 From: Aldrin John Olaer Manalansan <39627255+Aldrin-John-Olaer-Manalansan@users.noreply.github.com> Date: Mon, 3 Mar 2025 23:59:11 +0800 Subject: [PATCH] :memo: update commands --- sa/sa.json | 115 +++++++++++++++++---------------- sa/snippets/SAMPFUNCS/0B39.txt | 2 +- sa/snippets/SAMPFUNCS/0B3A.txt | 4 +- sa/snippets/SAMPFUNCS/0B3C.txt | 2 +- sa/snippets/SAMPFUNCS/0B41.txt | 2 +- sa/snippets/SAMPFUNCS/0B42.txt | 2 +- sa/snippets/SAMPFUNCS/0B4A.txt | 2 +- sa/snippets/SAMPFUNCS/0B5B.txt | 2 +- sa/snippets/SAMPFUNCS/0B75.txt | 8 ++- sa/snippets/SAMPFUNCS/0B77.txt | 2 +- sa/snippets/SAMPFUNCS/0B8A.txt | 15 +++++ sa/snippets/SAMPFUNCS/0B8B.txt | 12 ++++ sa/version.txt | 2 +- 13 files changed, 102 insertions(+), 68 deletions(-) create mode 100644 sa/snippets/SAMPFUNCS/0B8A.txt create mode 100644 sa/snippets/SAMPFUNCS/0B8B.txt diff --git a/sa/sa.json b/sa/sa.json index 79716980..93024888 100644 --- a/sa/sa.json +++ b/sa/sa.json @@ -1,7 +1,7 @@ { "meta": { - "last_update": 1741008902287, - "version": "0.873", + "last_update": 1741016623724, + "version": "0.874", "url": "https://library.sannybuilder.com/#/sa" }, "extensions": [ @@ -60457,12 +60457,14 @@ "short_desc": "Connects to the specified samp server information" }, { - "output": [ + "input": [ { - "name": "stringbufferserverip", - "type": "int", + "name": "bufferserverip", + "type": "string", "source": "var_any" - }, + } + ], + "output": [ { "name": "port", "type": "int", @@ -60475,9 +60477,9 @@ "short_desc": "Returns the server's IP address and port" }, { - "output": [ + "input": [ { - "name": "stringbufferservername", + "name": "buffer", "type": "int", "source": "var_any" } @@ -60534,7 +60536,7 @@ "type": "int" }, { - "name": "inputtextwritetostringbuffer", + "name": "bufferinputtext", "type": "int" } ], @@ -60657,14 +60659,14 @@ } ], "id": "0B41", - "name": "SAMP_RAKNET_SEND_BITSTREAM_AS_RPC_TO_SERVER", + "name": "SAMP_RAKNET_SEND_RPC_WITH_PARAMS_TO_SERVER", "num_params": 6, "attrs": { "is_condition": true }, "short_desc": "Sends a BitStream as an RPC with the specified parameters", "class": "Bitstream", - "member": "SendAsRpc" + "member": "SendAsRpcWithParams" }, { "input": [ @@ -60686,14 +60688,14 @@ } ], "id": "0B42", - "name": "SAMP_RAKNET_SEND_RAW_BITSTREAM_TO_SERVER", + "name": "SAMP_RAKNET_SEND_PACKET_WITH_PARAMS_TO_SERVER", "num_params": 4, "attrs": { "is_condition": true }, "class": "Bitstream", - "member": "SendRaw", - "short_desc": "Sends a Raw BitStream with the specified parameters. Commonly used to send dacket data to server" + "member": "SendAsPacketWithParams", + "short_desc": "Sends a Packet BitStream with the specified parameters. Commonly used to send dacket data to server" }, { "id": "0B43", @@ -60832,9 +60834,9 @@ "short_desc": "Selects the id of an element in the dialog list" }, { - "output": [ + "input": [ { - "name": "stringbuffer", + "name": "buffer", "type": "int", "source": "var_any" } @@ -61175,11 +61177,9 @@ { "name": "itemid", "type": "int" - } - ], - "output": [ + }, { - "name": "stringbufferitemtext", + "name": "buffer", "type": "int", "source": "var_any" } @@ -61190,7 +61190,7 @@ "attrs": { "is_condition": true }, - "short_desc": "Writes the text of an item from the currently opened dialog's list" + "short_desc": "Writes the text of an item with specific id from the currently opened dialog's list, to buffer" }, { "input": [ @@ -61816,19 +61816,17 @@ { "name": "chatlineid", "type": "int" - } - ], - "output": [ - { - "name": "stringbuffertext", - "type": "int", - "source": "var_any" }, { - "name": "stringbufferprefix", - "type": "int", - "source": "var_any" + "name": "buffertext", + "type": "int" }, + { + "name": "bufferprefix", + "type": "int" + } + ], + "output": [ { "name": "textcolor", "type": "int", @@ -61861,11 +61859,10 @@ "short_desc": "Overwrites the content written at the chat input box" }, { - "output": [ + "input": [ { - "name": "stringbuffertext", - "type": "int", - "source": "var_any" + "name": "buffer", + "type": "int" } ], "id": "0B77", @@ -62298,36 +62295,42 @@ "member": "GetControlText" }, { + "input": [ + { + "name": "rpcid", + "type": "SampRpc" + }, + { + "name": "self", + "type": "Bitstream" + } + ], "id": "0B8A", - "name": "RAKNET_SEND_RPC", + "name": "SAMP_RAKNET_SEND_RPC_TO_SERVER", "num_params": 2, "attrs": { "is_condition": true }, + "short_desc": "Sends BitStream as RPC to Server", + "class": "Bitstream", + "member": "SendAsRpc" + }, + { "input": [ { - "name": "_p1", - "type": "int" - }, - { - "name": "_p2", - "type": "int" + "name": "self", + "type": "Bitstream" } - ] - }, - { + ], "id": "0B8B", - "name": "RAKNET_SEND_BIT_STREAM", + "name": "SAMP_RAKNET_SEND_PACKET_TO_SERVER", "num_params": 1, "attrs": { "is_condition": true }, - "input": [ - { - "name": "_p1", - "type": "int" - } - ] + "class": "Bitstream", + "member": "SendAsPacket", + "short_desc": "Sends Packet BitStream to Server" }, { "id": "0B8C", @@ -62367,9 +62370,6 @@ "short_desc": "Returns the current mouse cursor mode" }, { - "id": "0B8F", - "name": "SAMP_CONVERT_SCREEN_COORDS_TO_WORLD_3D", - "num_params": 6, "input": [ { "name": "_p1", @@ -62395,7 +62395,10 @@ "name": "_p6", "type": "int" } - ] + ], + "id": "0B8F", + "name": "SF_CONVERT_WINDOW_SCREEN_COORDS_TO_WORLD_COORDS", + "num_params": 6 }, { "id": "0B90", diff --git a/sa/snippets/SAMPFUNCS/0B39.txt b/sa/snippets/SAMPFUNCS/0B39.txt index 110f1789..c2433d75 100644 --- a/sa/snippets/SAMPFUNCS/0B39.txt +++ b/sa/snippets/SAMPFUNCS/0B39.txt @@ -10,7 +10,7 @@ strBuf, port = SAMP_GET_CURRENT_SERVER_ADDRESS // Example 2, write server IP to a temporarily allocated memory int strBuf, port strBuf = ALLOCATE_MEMORY {size} 16 -strBuf, port = SAMP_GET_CURRENT_SERVER_ADDRESS +port = SAMP_GET_CURRENT_SERVER_ADDRESS {bufferserverip} strBuf // server ip in string format has been written at the allocated memory region strBuf // do something to strBuf and port FREE_MEMORY {address} strBuf // free this temporary memory region to avoid memory leak \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B3A.txt b/sa/snippets/SAMPFUNCS/0B3A.txt index 8a4106bd..690bfbda 100644 --- a/sa/snippets/SAMPFUNCS/0B3A.txt +++ b/sa/snippets/SAMPFUNCS/0B3A.txt @@ -1,4 +1,4 @@ int strBuf = ALLOCATE_MEMORY {size} 256 -strBuf = SAMP_GET_CURRENT_SERVER_NAME -// do something to strBuf +SAMP_GET_CURRENT_SERVER_NAME strBuf +// do something to {buffer} strBuf FREE_MEMORY strBuf \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B3C.txt b/sa/snippets/SAMPFUNCS/0B3C.txt index 7101aa92..4f2e5c5c 100644 --- a/sa/snippets/SAMPFUNCS/0B3C.txt +++ b/sa/snippets/SAMPFUNCS/0B3C.txt @@ -8,7 +8,7 @@ end // Example 2: Get Pressed Button ID, Selected Item ID, and the Input Text int whichButton, whichItem int inputtedText = ALLOCATE_MEMORY {size} 300 -if SAMP_HAS_DIALOG_RESPONDED {dialogid} 117 {buttonidstore} whichButton {buttonidstore} whichItem {inputtextwritetostringbuffer} inputtedText +if SAMP_HAS_DIALOG_RESPONDED {dialogid} 117 {buttonidstore} whichButton {buttonidstore} whichItem {bufferinputtext} inputtedText then // we have responded to dialog 117 do something to whichButton, whichItem, and inputtedText else // we are still interacting with dialog 117, or dialog 117 still hasn't shown up. diff --git a/sa/snippets/SAMPFUNCS/0B41.txt b/sa/snippets/SAMPFUNCS/0B41.txt index 391fac55..0c10875c 100644 --- a/sa/snippets/SAMPFUNCS/0B41.txt +++ b/sa/snippets/SAMPFUNCS/0B41.txt @@ -11,5 +11,5 @@ then SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} 0xFF {datatype} SampBitStreamDataType.Byte {datasize} DataTypeSize.Byte // wheelflags // // Bitstream is ready to be transmitted - SAMP_RAKNET_SEND_BITSTREAM_AS_RPC_TO_SERVER {rpcid} SampRpc.DamageCar {bitstream} myBitStream {priorityid} SampPriority.Medium {reliabilityid} SampReliability.ReliableOrdered {orderingchannel} 0 {shifttimestamp} 0 + SAMP_RAKNET_SEND_RPC_WITH_PARAMS_TO_SERVER {rpcid} SampRpc.DamageCar {bitstream} myBitStream {priorityid} SampPriority.Medium {reliabilityid} SampReliability.ReliableOrdered {orderingchannel} 0 {shifttimestamp} 0 end \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B42.txt b/sa/snippets/SAMPFUNCS/0B42.txt index 5387fe88..b3b82c8e 100644 --- a/sa/snippets/SAMPFUNCS/0B42.txt +++ b/sa/snippets/SAMPFUNCS/0B42.txt @@ -8,5 +8,5 @@ SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} textLength {datatype} SampBitStr SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} myRCONCommand {datatype} SampBitStreamDataType.Array {datasize} textLength // CMDText // // Bitstream is ready to be transmitted -SAMP_RAKNET_SEND_RAW_BITSTREAM_TO_SERVER {bitstream} myBitStream {priorityid} SampPriority.Medium {reliabilityid} SampReliability.ReliableOrdered {orderingchannel} 0 +SAMP_RAKNET_SEND_PACKET_WITH_PARAMS_TO_SERVER {bitstream} myBitStream {priorityid} SampPriority.Medium {reliabilityid} SampReliability.ReliableOrdered {orderingchannel} 0 FREE_MEMORY myRCONCommand \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B4A.txt b/sa/snippets/SAMPFUNCS/0B4A.txt index da667dd4..a66fa895 100644 --- a/sa/snippets/SAMPFUNCS/0B4A.txt +++ b/sa/snippets/SAMPFUNCS/0B4A.txt @@ -1,5 +1,5 @@ int strbuf = ALLOCATE_MEMORY {size} 300 -if strbuf = SAMP_GET_CURRENT_DIALOG_EDITBOX_TEXT +if SAMP_GET_CURRENT_DIALOG_EDITBOX_TEXT {buffer} strbuf then // do something to strbuf else diff --git a/sa/snippets/SAMPFUNCS/0B5B.txt b/sa/snippets/SAMPFUNCS/0B5B.txt index 225f5e8b..e9031660 100644 --- a/sa/snippets/SAMPFUNCS/0B5B.txt +++ b/sa/snippets/SAMPFUNCS/0B5B.txt @@ -1,5 +1,5 @@ int strBufItemText = ALLOCATE_MEMORY {size} 300 -if strBufItemText = SAMP_GET_LISTBOX_ITEM_TEXT_OF_DIALOG {itemid} 3 +if SAMP_GET_LISTBOX_ITEM_TEXT_OF_DIALOG {itemid} 3 {buffer} strBufItemText then // opened dialog has itemid 3 // do something to strBufItemText else // dialog or itemid 3 not found diff --git a/sa/snippets/SAMPFUNCS/0B75.txt b/sa/snippets/SAMPFUNCS/0B75.txt index cdc76f60..61894ee9 100644 --- a/sa/snippets/SAMPFUNCS/0B75.txt +++ b/sa/snippets/SAMPFUNCS/0B75.txt @@ -1,16 +1,20 @@ +int textColor, prefixColor strBufText = ALLOCATE_MEMORY {size} 256 strBufPrefix = ALLOCATE_MEMORY {size} 256 -if int strBufText, strBufPrefix, textColor, prefixColor = SAMP_GET_CHAT_LINE_PARAMS {chatlineid} 0 // test a valid chatlineid + +if textColor, prefixColor = SAMP_GET_CHAT_LINE_PARAMS {chatlineid} 0 {buffertext} strBufText {bufferprefix} strBufPrefix // test a valid chatlineid then // do something to strBufText, strBufPrefix, textColor, prefixColor else // this section will not execute end -if int strBufText, strBufPrefix, textColor, prefixColor = SAMP_GET_CHAT_LINE_PARAMS {chatlineid} 100 // test an invalid chatlineid + +if textColor, prefixColor = SAMP_GET_CHAT_LINE_PARAMS {chatlineid} 100 {buffertext} strBufText {bufferprefix} strBufPrefix // test an invalid chatlineid then // this section will not execute else // chatlineid is not valid end + FREE_MEMORY {address} strBufText FREE_MEMORY {address} strBufPrefix \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B77.txt b/sa/snippets/SAMPFUNCS/0B77.txt index 2803f372..168319f4 100644 --- a/sa/snippets/SAMPFUNCS/0B77.txt +++ b/sa/snippets/SAMPFUNCS/0B77.txt @@ -1,5 +1,5 @@ int strBufText = ALLOCATE_MEMORY {size} 256 -if strBufText = SAMP_GET_CHAT_INPUT_TEXT +if SAMP_GET_CHAT_INPUT_TEXT {buffer} strBufText then // do something to strBufText else // strBufText is unwritable end diff --git a/sa/snippets/SAMPFUNCS/0B8A.txt b/sa/snippets/SAMPFUNCS/0B8A.txt new file mode 100644 index 00000000..b6f263ca --- /dev/null +++ b/sa/snippets/SAMPFUNCS/0B8A.txt @@ -0,0 +1,15 @@ +if IS_CHAR_SITTING_IN_ANY_CAR $scplayer +then + int myCar = STORE_CAR_CHAR_IS_IN_NO_SAVE $scplayer + int myCarID = SAMP_GET_CAR_ID myCar + // Construct a Bitstream holding a SampRpc.DamageCar data + int myBitStream = SAMP_RAKNET_CREATE_BITSTREAM // create bitstream object with class Bitstream + SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} myCarID {datatype} SampBitStreamDataType.Short {datasize} DataTypeSize.Short // CarID + SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} 0xFFFFFFFF {datatype} SampBitStreamDataType.Int {datasize} DataTypeSize.Int // bodyflags + SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} 0xFFFFFFFF {datatype} SampBitStreamDataType.Int {datasize} DataTypeSize.Int // doorflags + SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} 0xFF {datatype} SampBitStreamDataType.Byte {datasize} DataTypeSize.Byte // lightflags + SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} 0xFF {datatype} SampBitStreamDataType.Byte {datasize} DataTypeSize.Byte // wheelflags + // + // Bitstream is ready to be transmitted + SAMP_RAKNET_SEND_RPC_TO_SERVER {rpcid} SampRpc.DamageCar {bitstream} myBitStream +end \ No newline at end of file diff --git a/sa/snippets/SAMPFUNCS/0B8B.txt b/sa/snippets/SAMPFUNCS/0B8B.txt new file mode 100644 index 00000000..87b474a2 --- /dev/null +++ b/sa/snippets/SAMPFUNCS/0B8B.txt @@ -0,0 +1,12 @@ +int myRCONCommand = ALLOCATE_MEMORY 58 +myRCONCommand = STRING_FORMAT "This_is_a_very_long_String_Example_we_will_send_to_Server" +int textLength = SF_STRLEN myRCONCommand + // Construct a Bitstream holding a SampRpc.RconCommand data +int myBitStream = SAMP_RAKNET_CREATE_BITSTREAM // create bitstream object with class Bitstream +SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} SampRpc.RconCommand {datatype} SampBitStreamDataType.Byte {datasize} DataTypeSize.Byte // PacketID +SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} textLength {datatype} SampBitStreamDataType.Int {datasize} DataTypeSize.Int // TextLength +SAMP_RAKNET_BITSTREAM_WRITE myBitStream {value} myRCONCommand {datatype} SampBitStreamDataType.Array {datasize} textLength // CMDText + // +// Bitstream is ready to be transmitted +RAKNET_SEND_BIT_STREAM {bitstream} myBitStream {priorityid} +FREE_MEMORY myRCONCommand \ No newline at end of file diff --git a/sa/version.txt b/sa/version.txt index e3d81a86..97c109de 100644 --- a/sa/version.txt +++ b/sa/version.txt @@ -1 +1 @@ -0.873 \ No newline at end of file +0.874 \ No newline at end of file