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

GunGame SQL


Post New Thread Reply   
 
Thread Tools Display Modes
creeperdank
Senior Member
Join Date: Dec 2004
Location: IL
Old 05-15-2009 , 16:24   Re: GunGame SQL
Reply With Quote #41

But my game server is not on my computer. Its hosted by http://www.gameservers.com

Do i need that php script and if so where should i putt it.
__________________
creeperdank is offline
Send a message via MSN to creeperdank
moonboi03
Member
Join Date: Jul 2006
Old 05-17-2009 , 11:22   Re: GunGame SQL
Reply With Quote #42

i guess ima have to scratch this mod from my server...

thanx for ur help
__________________
moonboi03 is offline
Cyb3rH4Xter
Senior Member
Join Date: May 2009
Location: Sweden
Old 05-17-2009 , 15:53   Re: GunGame SQL
Reply With Quote #43

Quote:
Originally Posted by moonboi03 View Post
i guess ima have to scratch this mod from my server...

thanx for ur help
Yesah, but gungame still works, huh?
Cyb3rH4Xter is offline
Cyb3rH4Xter
Senior Member
Join Date: May 2009
Location: Sweden
Old 05-17-2009 , 15:59   Re: GunGame SQL
Reply With Quote #44

Quote:
Originally Posted by creeperdank View Post
But my game server is not on my computer. Its hosted by http://www.gameservers.com

Do i need that php script and if so where should i putt it.
Okey, let's collect what we've got untill know:

You have a working gungame server, right?

You host it at www.gameservers.com.

You have a webserver at webhostingbuzz.

You have a mysql database named amx at webhostingbuzz?

What you still need:

Add you game server ip to the cpanel to allow mysql connections from your gameserver.

Put the ggsql cvars into your gungame.cfg and edit the info so it fits with your connection info to your mysql database.

What you can wait with but still need to do later:

Upload the gungamesql_example.php to your webhost and configure it to work with your stats.



If you are unshure about anything, please ask me.
Cyb3rH4Xter is offline
Cyb3rH4Xter
Senior Member
Join Date: May 2009
Location: Sweden
Old 05-18-2009 , 14:03   Re: GunGame SQL
Reply With Quote #45

Btw, i always get this error:

Code:
L 05/18/2009 - 20:02:01: [gungame_sql.amxx] Could not execute query "INSERT INTO `gg_stats` ( `authid`, `wins`, `lastname`, `timestamp`, `points`, `serverip` ) VALUES ( '', '0', '', '0', '0', '192.168.1.5:27015' );" -- Error #1062: Duplicate entry '' for key 1
Cyb3rH4Xter is offline
phoenixlipo
New Member
Join Date: May 2009
Old 05-21-2009 , 02:55   Re: GunGame SQL
Reply With Quote #46

Perhaps the best part about the Gun Game, and the Gun Game server I play on is that not many people know about it. This means a lot less hackers and a more personal connection with the players you are playing Counter-Strike: Source with. If you have a great Gun Game server, post it here as I will do the same.
__________________

Last edited by phoenixlipo; 05-21-2009 at 02:57.
phoenixlipo is offline
viktor6
Junior Member
Join Date: Dec 2006
Old 02-15-2010 , 04:58   Re: GunGame SQL
Reply With Quote #47

Help
PHP Code:
<?php
echo "Updating GG Top 10 Statistics...<br>";


 
$amx_sql_host    "localhost";
 
$amx_sql_user    "root";
 
$amx_sql_pass    "123456";
 
$amx_sql_db    "gg_stats";
 
      
$db mysql_connect($amx_sql_host,$amx_sql_user,$amx_sql_pass);
     
mysql_select_db($amx_sql_db,$db);
 

$ch curl_init();
$timeout 5// set to zero for no timeout
curl_setopt ($chCURLOPT_URL'http://my site/gungame.stats');


curl_setopt ($chCURLOPT_RETURNTRANSFER1);
curl_setopt ($chCURLOPT_CONNECTTIMEOUT$timeout);
$file_contents curl_exec($ch);
curl_close($ch);
$lines = array();
$lines explode("\n"$file_contents);

// display file line by line
$details = array();

foreach(
$lines as $line_num => $line) {
    
    
$details explode"\t"$line );
    
// 0 - authid
    // 1 - wins
    // 2 - lastname
    // 3 - timestamp
    // 4 - points
        
     
$details[2] = htmlspecialchars($details[2]);
     
     
$query "SELECT * FROM gg_stats WHERE authid='$details[0]'";
     
$result mysql_query$query$db );
     
$rows mysql_num_rows($result);
     
$myrow mysql_fetch_array$result );
     
     if( 
$rows &&  strlen$details[0] ) > ){
     
// There is already a record for this user, we need to update this record
     
     // Find out what is different
     
if( strcmp($myrow["wins"], $details[1]) != ){
         
printf("Wins Differ, new wins: <b>%s</b> | old wins: %s<br>"$details[1], $myrow["wins"] );
        
$query "UPDATE gg_stats SET wins='$details[1]' WHERE authid='$details[0]'";
        
mysql_query$query );        
        
    }if( 
strcmp($myrow["lastname"], $details[2]) != ){
         
printf("Lastname Differs, new name: %s<br>"$details[2] );
        
$query "UPDATE gg_stats SET lastname='$details[2]' WHERE authid='$details[0]'";
        
mysql_query$query );
        
    }if( 
strcmp($myrow["timestamp"], $details[3]) != ){
         
printf("Timestamp Differs, new timestamp: %s<br>"$details[3] );
        
$query "UPDATE gg_stats SET timestamp='$details[3]' WHERE authid='$details[0]'";
        
mysql_query$query );
    }
     
     
     }elseif( 
strlen$details[0] ) > ){
         
// New user, we need to add them
         
$query "INSERT INTO gg_stats ( authid, wins, lastname, timestamp, points  )
                        VALUES ( '
$details[0]', '$details[1]', '$details[2]', '$details[3]', '$details[4]' )";
          
mysql_query$query );
          
          
printf("New user <b>%s</b><br>"$details[0] );
     }
     
     
    
}


echo 
"<br>Done.";

?>
Quote:
Updating GG Top 10 Statistics...

Fatal error: Call to undefined function curl_init() in /home/www/test/test.php on line 14
viktor6 is offline
8088
Veteran Member
Join Date: Jan 2008
Old 02-15-2010 , 17:39   Re: GunGame SQL
Reply With Quote #48

http://php.net/manual/en/curl.setup.php
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
alexinno
Senior Member
Join Date: Mar 2007
Location: C:\
Old 03-06-2010 , 01:49   Re: GunGame SQL
Reply With Quote #49

thank you Krim // Relgam.com for the php script, maybe you'll update it for new gungame plugin
also i wanned to say that you can use this to update mysql table periodically with a cronjob on linux if you run a web server on the same machine where the gungame server is runing
Example: create a file , i named ggupdate.sh , i chmoded it to be executable (chmod +x ggupdate.sh) and write this lines in it
Code:
/bin/cp -rf /home/games/gungame/cstrike/gungame.txt /home/web/public_html/ 
chown web:apache /home/web/public_html/gungame.txt 
php -q /root/cronjobs/gungame_update.php
the gungame_update.php is the php script posted by Krim // Relgam.com
after this add the cronjob, edit crontab:
Code:
crontab -e
add a line to run this script , i'm runing it every 15 min
Code:
*/15 * * * * /root/cronjobs/ggupdate.sh >/dev/null 2>&1
i'm runing this cronjob as root , but you can run it as any user you want
__________________

[IMG]http://img188.**************/img188/5787/banner2rcw.png[/IMG]

Last edited by alexinno; 03-06-2010 at 01:57.
alexinno is offline
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 18:47.


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