mick88 / samp-client

GTA SA-MP API client library for Python
MIT License
28 stars 2 forks source link

Problem with ports other than 7777 #20

Closed yaroslav-lev-dev closed 3 years ago

yaroslav-lev-dev commented 3 years ago

The crux of the problem is that if I connect to the server with port 7777, then everything works fine. But if I connect with a port other than 7777, then an error is displayed: Traceback (most recent call last): File "c:\Users\Ярослав\Desktop\namalsk launch\test.py", line 4, in <module> print(client.get_server_info()) File "C:\Python\Python39\lib\site-packages\samp_client\client.py", line 73, in get_server_info hostname = decode_string(response, 5, 4) File "C:\Python\Python39\lib\site-packages\samp_client\utils.py", line 65, in decode_string length = decode_int(string[len_pos:len_end]) TypeError: 'NoneType' object is not subscriptable

How to solve this problem?

mick88 commented 3 years ago

Cannot replicate on version 3.0 Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32

from samp_client.client import SampClient
with SampClient('91.134.166.76', port=8085) as client:
    print(client.get_server_info())
ServerInfo(password=False, players=4, max_players=75, hostname='..::!! Stunt Earth !!::.. [0.3.7] (v3)', gamemode='Stunt-Race-Drift-Dm-FreeRoam', language='English/Español (EN/ES/BR/RU)')