Fixing some values by making a temporary mess
This commit is contained in:
@@ -45,8 +45,8 @@ def query_r():
|
||||
|
||||
flat_packet_data = dataHelper.flatten(packet_data)
|
||||
|
||||
packet = struct.pack(b"<H" + b"c%dsc%ds" * flat_packet_data[0] # using len_rules
|
||||
% [len(y) for x in rules.items() for y in x], # array of only rules entries
|
||||
packet = struct.pack(b"<H" + b"B%dsB%ds" * flat_packet_data[0] # using len_rules
|
||||
% tuple(len(y) for x in rules.items() for y in x), # tuple of only rules entries
|
||||
*flat_packet_data)
|
||||
|
||||
return packet
|
||||
@@ -65,8 +65,8 @@ def query_c():
|
||||
|
||||
flat_packet_data = dataHelper.flatten(packet_data)
|
||||
|
||||
packet = struct.pack(b"<H" + b"c%dscI" * flat_packet_data[0]
|
||||
% [len(x) for x in players_scores.keys()],
|
||||
packet = struct.pack(b"<H" + b"B%dsI" * flat_packet_data[0]
|
||||
% tuple(len(x) for x in players_scores.keys()),
|
||||
*flat_packet_data)
|
||||
|
||||
return packet
|
||||
@@ -95,14 +95,14 @@ def query_d():
|
||||
|
||||
def get_online_players(): #TODO: Get data from server's client objects
|
||||
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
|
||||
return {"Rule name sample": "Rule value"}
|
||||
return {b"Rule name sample": b"Rule value"}
|
||||
|
||||
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)
|
||||
b"i": query_i,
|
||||
|
||||
Reference in New Issue
Block a user