Austinb / GameQ

A PHP Gameserver Status Query Library
https://austinb.github.io/GameQ/
GNU Lesser General Public License v3.0
403 stars 135 forks source link

About game type (source protocol) #96

Closed ghost closed 11 years ago

ghost commented 11 years ago

Hi! First i want to thank you for this awesome library. And i want to ask you to make a little change in the your project. First i explain why: i began to write a monitoring engine for only Counter-Strike 1.6. And all looks nice, but i need to control which game types users add to my database. Sometimes noobs adds Counter-Strike Source servers, and i must to delete it from database manually. I can't to write script, which check which game type user want to add.

I can't ask users 'which game type you wanna to add to my monitoring?', 'cause users so stupid. I must to control all, because i make monitoring only for one game.

So with your library i requesting server, but in returned array i can't find something like 'game_engine' or 'engine_type'. I corrected it:

protocols/source.php line 160

// Update the engine type for other calls and other methods, if necessary if(bin2hex($type) == '6d') { $this->source_engine = self::GOLDSOURCE_ENGINE; $result->add('game_engine', 'goldsrc_engine'); } else { $result->add('game_engine', 'source_engine'); }

So maybe somebody needs it too. And i hope, you make it. Thank you.

Kandru commented 11 years ago

Hey Alex,

i hope i understand your problem right (sorry, my english is bad, too) - ive got the same problem (because your right, users are stupid and want to add servers from other games) - the best idea i had for this problem is to query this server once after the user submit your "server add form" - if the server response "normally" like the server you except, all should be right and you could add this one to your database - if not, post an error message like "Your Server does not response or isnt a Counterstrike 1.6 Server, please correct your informations and try again!"

This is my way to be sure that nobody could add another server and works ;) But your way isnt bad at all.

ghost commented 11 years ago

Look how i did it: with my fix in returned array i have [game_engine] = 'source_engine' or 'goldsrc_engine'

in controller:

if($results['game_engine'] != 'goldsrc_engine') //if this isn't cs 1.6 { echo 'Only cs 1.6 servers'; } // working with server....

and i don't need 'other' code in my controller. it's like i understood you.

Austinb commented 11 years ago

I assume you have resolved this issue. Since it is not directly related to GameQ I am going to close it. If you have a specific feature request or issue please open a new issue.