Raised This Month: $51 Target: $400
 12% 

Server Query


Post New Thread Reply   
 
Thread Tools Display Modes
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-28-2012 , 08:34   Re: Server Query
Reply With Quote #11

OK,can you tell me what happen with this code
code here:
Code:
#include <amxmodx> #include <server_query_complete> #define PLUGIN_NAME "My New Plug-in" #define PLUGIN_VERSION "0.1" #define PLUGIN_AUTHOR "K.K.Lv" new const SERVER_ADDRESS[] = "222.73.4.201:27011"; public plugin_init() {     register_plugin("", "", "");     register_srvcmd("test", "CmdTest"); } public CmdTest() {            if(ServerGetChallenge(SERVER_ADDRESS))     {         server_print("Get Challenge");         ServerRules(SERVER_ADDRESS, "cbRules");     }     else     {         server_print("Not Challenge");         ServerChallenge(SERVER_ADDRESS, "cbChallengeRules");     }     return PLUGIN_HANDLED; }   public cbChallengeRules(const szServer[], _A2A_TYPE, const Response[], len, success, latency) {     if(!success)         return;       //Get and cche challenge            new challenge_value = ServerResponseParseChallenge(Response);     ServerSetChallenge(szServer, challenge_value);       //Now can get Rules     ServerRules(SERVER_ADDRESS, "cbRules"); } public cbRules(const szServer[], _A2A_TYPE, const Response[], len, success, latency) {     if(!success)         return;       new iTemp;     new current = 0;     current += ServerResponseReadByte(Response[current], iTemp);     current += ServerResponseReadInt(Response[current], iTemp);     new szKey[64], szValue[64];     while(current < len)     {         current += ServerResponseReadString(Response[current], szKey, 63);         current += ServerResponseReadString(Response[current], szValue, 63);         server_print("szKey : %s^t^tszValue : %s", szKey, szValue);     } }

reply data here:
Code:
szKey : Ea              szValue : aaame_
szKey : 鍗楁柟璧涘尯 1#         szValue : aaam_
szKey : 姝讳骸绔炴妧            szValue : aaayer_
szKey : 0/21            szValue : aaore_
szKey : 鏈紑濮?       szValue : aape_
szKey : 鑷姪姣旇禌鏈? szValue : aap_
szKey : de_dust2                szValue : aassword_
szKey : 0               szValue : allow_spectators
szKey : 1               szValue : amxmodx_version
szKey : 1.8.1.3746              szValue : amx_client_languages
szKey :                 szValue : coop
szKey : 0               szValue : csdm_active
szKey : 1               szValue : csdm_version
szKey : 2.1.2           szValue : deathmatch
szKey : 1               szValue : decalfrequency
szKey : 60              szValue : edgefriction
szKey : 2               szValue : hostage_debug
szKey : 0               szValue : hostage_stop
szKey : 0               szValue : humans_join_team
szKey : any             szValue : max_queries_sec
szKey : 1               szValue : max_queries_sec_global
szKey : 1               szValue : max_queries_window
szKey : 1               szValue : metamod_version
szKey : 1.19p32         szValue : mp_allowmonsters
szKey : 0               szValue : mp_autokick
szKey : 0               szValue : mp_autoteambalance
szKey : 0               szValue : mp_buytime
szKey : 0.25            szValue : mp_c4timer
szKey : 35              szValue : mp_chattime
szKey : 5               szValue : mp_consistency
szKey : 1               szValue : mp_fadetoblack
szKey : 0               szValue : mp_flashlight
szKey : 1               szValue : mp_footsteps
szKey : 1               szValue : mp_forcecamera
szKey : 2               szValue : mp_forcechasecam
szKey : 2               szValue : mp_fragsleft
szKey : 0               szValue : mp_freeforall
szKey : 1               szValue : mp_freezetime
szKey : 10              szValue : mp_friendlyfire
szKey : 1               szValue : mp_ghostfrequency
szKey : 0.1             szValue : mp_hostagepenalty
szKey : 0               szValue : mp_kickpercent
szKey : 0.66            szValue : mp_limitteams
szKey : 0               szValue : mp_logdetail
szKey : 0               szValue : mp_logfile
szKey : 1               szValue : mp_logmessages
szKey : 0               szValue : mp_mapvoteratio
szKey : 0.66            szValue : mp_maxrounds
szKey : 0               szValue : mp_mirrordamage
szKey : 0               szValue : mp_playerid
szKey : 0               szValue : mp_roundtime
szKey : 1.75            szValue : mp_startmoney
szKey : 800             szValue : mp_timeleft
szKey : 0               szValue : mp_timelimit
szKey : 0               szValue : mp_tkpunish
szKey : 0               szValue : mp_windifference
szKey : 1               szValue : mp_winlimit
szKey : 0               szValue : pausable
szKey : 0               szValue : sv_accelerate
szKey : 5               szValue : sv_aim
szKey : 0               szValue : sv_airaccelerate
szKey : 10              szValue : sv_airmove
szKey : 1               szValue : sv_allowupload
szKey : 0               szValue : sv_alltalk
szKey : 0               szValue : sv_bounce
szKey : 1               szValue : sv_cheats
szKey : 0               szValue : sv_clienttrace
szKey : 1.0             szValue : sv_clipmode
szKey : 0               szValue : sv_contact
szKey : [email protected]               szValue : sv_friction
szKey : 4               szValue : sv_gravity
szKey : 800             szValue : sv_logblocks
szKey : 0               szValue : sv_maxrate
szKey : 20000           szValue : sv_maxspeed
szKey : 320             szValue : sv_minrate
szKey : 2500            szValue : sv_password
szKey : 0               szValue : sv_proxies
szKey : 1               szValue : sv_region
szKey : 4               szValue : sv_restart
szKey : 0               szValue : sv_restartround
szKey : 0               szValue : sv_stepsize
szKey : 18              szValue : sv_stopspeed
szKey : 75              szValue : sv_uploadmax
szKey : 0.5             szValue : sv_voi222.73.4.201:27011
szKey : ceenable                szValue : 1
szKey : sv_wateraccelerate              szValue : 10
szKey : sv_waterfriction                szValue : 1
szKey : z5el            szValue :
szKey : _tutor_bomb_viewable_check_interval             szValue : 0.5
szKey : _tutor_debug_level              szValue : 0
szKey : _tutor_examine_time             szValue : 0.5
szKey : _tutor_hint_interval_time               szValue : 10.0
szKey : _tutor_look_angle               szValue : 10
szKey : _tutor_look_distance            szValue : 200
szKey : _tutor_message_character_display_time_coefficient               szValue
: 0.07
szKey : _tutor_message_minimum_display_time             szValue : 1
szKey : _tutor_message_repeats          szValue : 5
szKey : _tutor_view_distance            szValue : 1000
szKey : 222.73.4.201:27011              szValue : ries_window
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-28-2012 , 13:36   Re: Server Query
Reply With Quote #12

Quote:
szKey : 0.5 szValue : sv_voi222.73.4.201:27011
szKey : ceenable szValue : 1
See? It's broken.

It should be like this:
Quote:
'sv_uploadmax' => string '0.5' (length=3)
'sv_voiceenable' => string '1' (length=1)
It breaks there because that's where it sends second split packet.
__________________

Last edited by xPaw; 05-28-2012 at 13:37.
xPaw is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-28-2012 , 21:30   Re: Server Query
Reply With Quote #13

and did you see the first data ?
Code:
szKey : Ea              szValue : aaame_
and yes, the second packet start at [9].
so we need to create a var when there is a second packet recv and copy it into the var.

edited:
so my conclusion is :
the first packet should be start at [16],
and the second packet should be start at [9](if there is a sconde packet).
__________________
QQ:116268742

Last edited by K.K.Lv; 05-28-2012 at 21:39.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-29-2012 , 02:03   Re: Server Query
Reply With Quote #14

Quote:
Originally Posted by K.K.Lv View Post
and did you see the first data ?
Code:
szKey : Ea              szValue : aaame_
Yes, i saw that, and these are chinese characters.

Quote:
'aaame_' => string '南方赛区 1#' (length=15)
'aaam_' => string '死亡竞技' (length=12)
'aaayer_' => string '0/21' (length=4)
'aaore_' => string '未开始' (length=9)
'aape_' => string '自助比赛服' (length=15)
'aap_' => string 'de_dust2' (length=
'aassword_' => string '0' (length=1)
Quote:
Originally Posted by K.K.Lv View Post
and yes, the second packet start at [9].
so we need to create a var when there is a second packet recv and copy it into the var.

edited:
so my conclusion is :
the first packet should be start at [16],
and the second packet should be start at [9](if there is a sconde packet).
Still wrong.
__________________

Last edited by xPaw; 05-29-2012 at 02:04.
xPaw is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-29-2012 , 02:25   Re: Server Query
Reply With Quote #15

I said this
Code:
szKey : Ea
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-29-2012 , 02:27   Re: Server Query
Reply With Quote #16

Quote:
Originally Posted by K.K.Lv View Post
I said this
Code:
szKey : Ea
And I said that these are chinese characters, thus are not correctly displayed in the console.
__________________

Last edited by xPaw; 05-29-2012 at 02:27.
xPaw is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-29-2012 , 02:37   Re: Server Query
Reply With Quote #17

these are not chinese characters man
Ok I will show you the packet what I have catch

here:
First packet
Code:
FE FF FF FF F3 4F 02 00 02 FF FF FF FF 45 61 00 61 61 61 6D 65 5F 00 E5 8D 97 E6 96 B9 E8 B5 9B E5 8C BA 20 31 23 00 61 61 61 6D 5F 00 E6 AD BB E4 BA A1 E7 AB 9E E6 8A 80 00 61 61 61 79 65 72 5F 00 30 2F 32 31 00 61 61 6F 72 65 5F 00 E6 9C AA E5 BC 80 E5 A7 8B 00 61 61 70 65 5F 00 E8 87 AA E5 8A A9 E6 AF 94 E8 B5 9B E6 9C 8D 00 61 61 70 5F 00 64 65 5F 64 75 73 74 32 00 61 61 73 73 77 6F 72 64 5F 00 30 00 61 6C 6C 6F 77 5F 73 70 65 63 74 61 74 6F 72 73 00 31 00 61 6D 78 6D 6F 64 78 5F 76 65 72 73 69 6F 6E 00 31 2E 38 2E 31 2E 33 37 34 36 00 61 6D 78 5F 63 6C 69 65 6E 74 5F 6C 61 6E 67 75 61 67 65 73 00 00 63 6F 6F 70 00 30 00 63 73 64 6D 5F 61 63 74 69 76 65 00 31 00 63 73 64 6D 5F 76 65 72 73 69 6F 6E 00 32 2E 31 2E 32 00 64 65 61 74 68 6D 61 74 63 68 00 31 00 64 65 63 61 6C 66 72 65 71 75 65 6E 63 79 00 36 30 00 65 64 67 65 66 72 69 63 74 69 6F 6E 00 32 00 68 6F 73 74 61 67 65 5F 64 65 62 75 67 00 30 00 68 6F 73 74 61 67 65 5F 73 74 6F 70 00 30 00 68 75 6D 61 6E 73 5F 6A 6F 69 6E 5F 74 65 61 6D 00 61 6E 79 00 6D 61 78 5F 71 75 65 72 69 65 73 5F 73 65 63 00 31 00 6D 61 78 5F 71 75 65 72 69 65 73 5F 73 65 63 5F 67 6C 6F 62 61 6C 00 31 00 6D 61 78 5F 71 75 65 72 69 65 73 5F 77 69 6E 64 6F 77 00 31 00 6D 65 74 61 6D 6F 64 5F 76 65 72 73 69 6F 6E 00 31 2E 31 39 70 33 32 00 6D 70 5F 61 6C 6C 6F 77 6D 6F 6E 73 74 65 72 73 00 30 00 6D 70 5F 61 75 74 6F 6B 69 63 6B 00 30 00 6D 70 5F 61 75 74 6F 74 65 61 6D 62 61 6C 61 6E 63 65 00 30 00 6D 70 5F 62 75 79 74 69 6D 65 00 30 2E 32 35 00 6D 70 5F 63 34 74 69 6D 65 72 00 33 35 00 6D 70 5F 63 68 61 74 74 69 6D 65 00 35 00 6D 70 5F 63 6F 6E 73 69 73 74 65 6E 63 79 00 31 00 6D 70 5F 66 61 64 65 74 6F 62 6C 61 63 6B 00 30 00 6D 70 5F 66 6C 61 73 68 6C 69 67 68 74 00 31 00 6D 70 5F 66 6F 6F 74 73 74 65 70 73 00 31 00 6D 70 5F 66 6F 72 63 65 63 61 6D 65 72 61 00 32 00 6D 70 5F 66 6F 72 63 65 63 68 61 73 65 63 61 6D 00 32 00 6D 70 5F 66 72 61 67 73 6C 65 66 74 00 30 00 6D 70 5F 66 72 65 65 66 6F 72 61 6C 6C 00 31 00 6D 70 5F 66 72 65 65 7A 65 74 69 6D 65 00 31 30 00 6D 70 5F 66 72 69 65 6E 64 6C 79 66 69 72 65 00 31 00 6D 70 5F 67 68 6F 73 74 66 72 65 71 75 65 6E 63 79 00 30 2E 31 00 6D 70 5F 68 6F 73 74 61 67 65 70 65 6E 61 6C 74 79 00 30 00 6D 70 5F 6B 69 63 6B 70 65 72 63 65 6E 74 00 30 2E 36 36 00 6D 70 5F 6C 69 6D 69 74 74 65 61 6D 73 00 30 00 6D 70 5F 6C 6F 67 64 65 74 61 69 6C 00 30 00 6D 70 5F 6C 6F 67 66 69 6C 65 00 31 00 6D 70 5F 6C 6F 67 6D 65 73 73 61 67 65 73 00 30 00 6D 70 5F 6D 61 70 76 6F 74 65 72 61 74 69 6F 00 30 2E 36 36 00 6D 70 5F 6D 61 78 72 6F 75 6E 64 73 00 30 00 6D 70 5F 6D 69 72 72 6F 72 64 61 6D 61 67 65 00 30 00 6D 70 5F 70 6C 61 79 65 72 69 64 00 30 00 6D 70 5F 72 6F 75 6E 64 74 69 6D 65 00 31 2E 37 35 00 6D 70 5F 73 74 61 72 74 6D 6F 6E 65 79 00 38 30 30 00 6D 70 5F 74 69 6D 65 6C 65 66 74 00 30 00 6D 70 5F 74 69 6D 65 6C 69 6D 69 74 00 30 00 6D 70 5F 74 6B 70 75 6E 69 73 68 00 30 00 6D 70 5F 77 69 6E 64 69 66 66 65 72 65 6E 63 65 00 31 00 6D 70 5F 77 69 6E 6C 69 6D 69 74 00 30 00 70 61 75 73 61 62 6C 65 00 30 00 73 76 5F 61 63 63 65 6C 65 72 61 74 65 00 35 00 73 76 5F 61 69 6D 00 30 00 73 76 5F 61 69 72 61 63 63 65 6C 65 72 61 74 65 00 31 30 00 73 76 5F 61 69 72 6D 6F 76 65 00 31 00 73 76 5F 61 6C 6C 6F 77 75 70 6C 6F 61 64 00 30 00 73 76 5F 61 6C 6C 74 61 6C 6B 00 30 00 73 76 5F 62 6F 75 6E 63 65 00 31 00 73 76 5F 63 68 65 61 74 73 00 30 00 73 76 5F 63 6C 69 65 6E 74 74 72 61 63 65 00 31 2E 30 00 73 76 5F 63 6C 69 70 6D 6F 64 65 00 30 00 73 76 5F 63 6F 6E 74 61 63 74 00 73 65 72 76 65 72 40 6F 33 6F 34 6F 35 2E 63 6F 6D 00 73 76 5F 66 72 69 63 74 69 6F 6E 00 34 00 73 76 5F 67 72 61 76 69 74 79 00 38 30 30 00 73 76 5F 6C 6F 67 62 6C 6F 63 6B 73 00 30 00 73 76 5F 6D 61 78 72 61 74 65 00 32 30 30 30 30 00 73 76 5F 6D 61 78 73 70 65 65 64 00 33 32 30 00 73 76 5F 6D 69 6E 72 61 74 65 00 32 35 30 30 00 73 76 5F 70 61 73 73 77 6F 72 64 00 30 00 73 76 5F 70 72 6F 78 69 65 73 00 31 00 73 76 5F 72 65 67 69 6F 6E 00 34 00 73 76 5F 72 65 73 74 61 72 74 00 30 00 73 76 5F 72 65 73 74 61 72 74 72 6F 75 6E 64 00 30 00 73 76 5F 73 74 65 70 73 69 7A 65 00 31 38 00 73 76 5F 73 74 6F 70 73 70 65 65 64 00 37 35 00 73 76 5F 75 70 6C 6F 61 64 6D 61 78 00 30 2E 35 00 73 76 5F 76 6F 69
and the second packet:
Code:
FE FF FF FF F3 4F 02 00 12 63 65 65 6E 61 62 6C 65 00 31 00 73 76 5F 77 61 74 65 72 61 63 63 65 6C 65 72 61 74 65 00 31 30 00 73 76 5F 77 61 74 65 72 66 72 69 63 74 69 6F 6E 00 31 00 7A 35 65 6C 00 00 5F 74 75 74 6F 72 5F 62 6F 6D 62 5F 76 69 65 77 61 62 6C 65 5F 63 68 65 63 6B 5F 69 6E 74 65 72 76 61 6C 00 30 2E 35 00 5F 74 75 74 6F 72 5F 64 65 62 75 67 5F 6C 65 76 65 6C 00 30 00 5F 74 75 74 6F 72 5F 65 78 61 6D 69 6E 65 5F 74 69 6D 65 00 30 2E 35 00 5F 74 75 74 6F 72 5F 68 69 6E 74 5F 69 6E 74 65 72 76 61 6C 5F 74 69 6D 65 00 31 30 2E 30 00 5F 74 75 74 6F 72 5F 6C 6F 6F 6B 5F 61 6E 67 6C 65 00 31 30 00 5F 74 75 74 6F 72 5F 6C 6F 6F 6B 5F 64 69 73 74 61 6E 63 65 00 32 30 30 00 5F 74 75 74 6F 72 5F 6D 65 73 73 61 67 65 5F 63 68 61 72 61 63 74 65 72 5F 64 69 73 70 6C 61 79 5F 74 69 6D 65 5F 63 6F 65 66 66 69 63 69 65 6E 74 00 30 2E 30 37 00 5F 74 75 74 6F 72 5F 6D 65 73 73 61 67 65 5F 6D 69 6E 69 6D 75 6D 5F 64 69 73 70 6C 61 79 5F 74 69 6D 65 00 31 00 5F 74 75 74 6F 72 5F 6D 65 73 73 61 67 65 5F 72 65 70 65 61 74 73 00 35 00 5F 74 75 74 6F 72 5F 76 69 65 77 5F 64 69 73 74 61 6E 63 65 00 31 30 30 30 00
and the First packet data:
Code:
.....O.......Ea.aaame_............. 1#.aaam_..............aaayer_.0/21.aaore_...........aape_.................aap_.de_dust2.aassword_.0.allow_spectators.1.amxmodx_version.1.8.1.3746.amx_client_languages..coop.0.csdm_active.1.csdm_version.2.1.2.deathmatch.1.decalfrequency.60.edgefriction.2.hostage_debug.0.hostage_stop.0.humans_join_team.any.max_queries_sec.1.max_queries_sec_global.1.max_queries_window.1.metamod_version.1.19p32.mp_allowmonsters.0.mp_autokick.0.mp_autoteambalance.0.mp_buytime.0.25.mp_c4timer.35.mp_chattime.5.mp_consistency.1.mp_fadetoblack.0.mp_flashlight.1.mp_footsteps.1.mp_forcecamera.2.mp_forcechasecam.2.mp_fragsleft.0.mp_freeforall.1.mp_freezetime.10.mp_friendlyfire.1.mp_ghostfrequency.0.1.mp_hostagepenalty.0.mp_kickpercent.0.66.mp_limitteams.0.mp_logdetail.0.mp_logfile.1.mp_logmessages.0.mp_mapvoteratio.0.66.mp_maxrounds.0.mp_mirrordamage.0.mp_playerid.0.mp_roundtime.1.75.mp_startmoney.800.mp_timeleft.0.mp_timelimit.0.mp_tkpunish.0.mp_windifference.1.mp_winlimit.0.pausable.0.sv_accelerate.5.sv_aim.0.sv_airaccelerate.10.sv_airmove.1.sv_allowupload.0.sv_alltalk.0.sv_bounce.1.sv_cheats.0.sv_clienttrace.1.0.sv_clipmode.0.sv_contact.server@o3o4o5.com.sv_friction.4.sv_gravity.800.sv_logblocks.0.sv_maxrate.20000.sv_maxspeed.320.sv_minrate.2500.sv_password.0.sv_proxies.1.sv_region.4.sv_restart.0.sv_restartround.0.sv_stepsize.18.sv_stopspeed.75.sv_uploadmax.0.5.sv_voi
second data:
Code:
.....O...ceenable.1.sv_wateraccelerate.10.sv_waterfriction.1.z5el.._tutor_bomb_viewable_check_interval.0.5._tutor_debug_level.0._tutor_examine_time.0.5._tutor_hint_interval_time.10.0._tutor_look_angle.10._tutor_look_distance.200._tutor_message_character_display_time_coefficient.0.07._tutor_message_minimum_display_time.1._tutor_message_repeats.5._tutor_view_distance.1000.
__________________
QQ:116268742

Last edited by K.K.Lv; 05-29-2012 at 02:37.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-29-2012 , 02:49   Re: Server Query
Reply With Quote #18

did you test my code ?
you can test my code with the other ip
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-29-2012 , 05:37   Re: Server Query
Reply With Quote #19

Quote:
Originally Posted by K.K.Lv View Post
did you test my code ?
you can test my code with the other ip
No, i did not test your code. I used my class, which is written in PHP. It was enough to confirm that your code is bugged.

Quote:
Originally Posted by K.K.Lv View Post
and did you see the first data ?
Code:
szKey : Ea              szValue : aaame_
Yes sorry, the first one is not chinese characters in your dump. And that's because split packets are not read properly. As I said before, all you have to do is read and parse split packets properly.

If you understand PHP, take a look at this function.
__________________

Last edited by xPaw; 05-29-2012 at 05:43.
xPaw is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-29-2012 , 08:52   Re: Server Query
Reply With Quote #20

I'm lazy to remake a inc file. because I have done a dll.
as far as i know, when query the server rules, need to check whether or not there are more than packet recv. you know, the max packet size is 1400
second I have said that first packet should start at [16], if there is a second packet recv, need to copy the buffer at [9]
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode