sm-plugins/SMJSONAPI/example.txt
2018-08-07 22:22:27 +02:00

128 lines
2.4 KiB
Plaintext

request:
{
"method": "subscribe",
"module": "gameevents",
"events": [
"player_connect",
"player_disconnect",
"player_say",
"invalid"
]
}
response:
{
"method": "subscribe",
"module": "gameevents",
"error": 0,
"events": [
0,
1,
2,
-3
]
}
-----
events:
{
"method": "publish",
"module": "gameevents",
"event": {
"name": "player_connect",
"data": {
"name": "BotoX",
"index": 0,
"userid": 4,
"networkid": "[U:1:51174697]",
"address": "192.168.1.4:27006",
"bot": 0
}
}
}
{
"method": "publish",
"module": "gameevents",
"event": {
"name": "player_say",
"data": {
"text": "hello",
"userid": 4
}
}
}
{
"method": "publish",
"module": "gameevents",
"event": {
"name": "player_disconnect",
"data": {
"userid": 4,
"reason": "Disconnect by user.",
"name": "BotoX",
"networkid": "[U:1:51174697]",
"bot": 0
}
}
}
-----
request:
{
"method": "unsubscribe",
"module": "gameevents",
"events": [
"player_connect",
"player_disconnect",
"player_say",
"invalid"
]
}
response:
{
"method": "unsubscribe",
"module": "gameevents",
"error": 0,
"events": [
0,
0,
0,
0
]
}
-----
request:
{
"method": "function",
"function": "KickClient",
"parameters": [
1,
"%d hello %s",
1337,
"cat"
]
}
Other examples:
{ "method": "function", "function": "PrintToServer", "parameters": ["1: %s, 2: %d, 3: %s, 4: %d", "1test1", [2222], "3test3", [4444]] }
{ "method": "function", "function": "TeleportEntity", "parameters": [1, [206.472443, 2418.516357, -62.058395], [26.994024, -14.119852, 0.000000], [["NULL_VECTOR"]] ] }
{ "method": "function", "function": "GetClientName", "parameters": [ 1, "", 1024 ] }
{ "method": "function", "function": "GetClientAbsOrigin", "parameters": [ 1, [0.0,0,0] ] }
{ "method": "function", "function": "ServerCommandEx", "parameters": [ "", 1024, "echo hello mates %d %f %s", [123], [123.456], "test" ] }
{ "method": "subscribe", "module": "gameevents", "events": [ "player_say" ] }
{ "method": "function", "function": "GetUserFlagBits", "args": [ 9 ] }