Fixing some values by making a temporary mess
This commit is contained in:
parent
4b3fbf2be3
commit
dd315d31d0
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"python.pythonPath": "/usr/bin/python3"
|
"python.pythonPath": "C:\\Users\\Emily\\AppData\\Local\\Programs\\Python\\Python36\\python.exe"
|
||||||
}
|
}
|
|
@ -45,8 +45,8 @@ def query_r():
|
||||||
|
|
||||||
flat_packet_data = dataHelper.flatten(packet_data)
|
flat_packet_data = dataHelper.flatten(packet_data)
|
||||||
|
|
||||||
packet = struct.pack(b"<H" + b"c%dsc%ds" * flat_packet_data[0] # using len_rules
|
packet = struct.pack(b"<H" + b"B%dsB%ds" * flat_packet_data[0] # using len_rules
|
||||||
% [len(y) for x in rules.items() for y in x], # array of only rules entries
|
% tuple(len(y) for x in rules.items() for y in x), # tuple of only rules entries
|
||||||
*flat_packet_data)
|
*flat_packet_data)
|
||||||
|
|
||||||
return packet
|
return packet
|
||||||
|
@ -65,8 +65,8 @@ def query_c():
|
||||||
|
|
||||||
flat_packet_data = dataHelper.flatten(packet_data)
|
flat_packet_data = dataHelper.flatten(packet_data)
|
||||||
|
|
||||||
packet = struct.pack(b"<H" + b"c%dscI" * flat_packet_data[0]
|
packet = struct.pack(b"<H" + b"B%dsI" * flat_packet_data[0]
|
||||||
% [len(x) for x in players_scores.keys()],
|
% tuple(len(x) for x in players_scores.keys()),
|
||||||
*flat_packet_data)
|
*flat_packet_data)
|
||||||
|
|
||||||
return packet
|
return packet
|
||||||
|
@ -95,14 +95,14 @@ def query_d():
|
||||||
|
|
||||||
def get_online_players(): #TODO: Get data from server's client objects
|
def get_online_players(): #TODO: Get data from server's client objects
|
||||||
return [
|
return [
|
||||||
{"nick": "Sunpy", "score": 64, "ping": 8} + {"id": 1} # replace id with function to get player's id
|
{"nick": b"Sunpy", "score": 64, "ping": 8, "id": 1} # replace id with function to get player's id
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_rules(): #TODO
|
def get_rules(): #TODO
|
||||||
return {"Rule name sample": "Rule value"}
|
return {b"Rule name sample": b"Rule value"}
|
||||||
|
|
||||||
def get_players_scores(): #TODO
|
def get_players_scores(): #TODO
|
||||||
return {"Sunpy": 64, "username": 123}
|
return {b"Sunpy": 64, b"username": 123}
|
||||||
|
|
||||||
RESPONSE = { #TODO: c, d & p (https://wiki.sa-mp.com/wiki/Query_Mechanism)
|
RESPONSE = { #TODO: c, d & p (https://wiki.sa-mp.com/wiki/Query_Mechanism)
|
||||||
b"i": query_i,
|
b"i": query_i,
|
||||||
|
|
Reference in New Issue
Block a user