Page 1 of 4

gg_winner_display

PostPosted: Sun Oct 26, 2008 4:41 am
by Warren
gg_winner_display

Description:
When someone wins the game, a MOTD window pops up containing information about the winner.

Image

Installation:

      Customize **NOT REQUIRED** (host on your own web server):
        If you wish to adjust the layout of the page, you can host it on your own website. Save this code as gg5_win.php and adjust it to your likings:
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>GunGame Winner</title>
        <style type="text/css">
        body {
            background:#CCCCCC;
            font-family:Verdana,Tahoma;
            color:#000000;
            vertical-align:middle;
        }
        </style>
        </head>
        <body>
        <table height="100%" topmargin="0" bottommargin="0" align="center"  cellpadding="0" cellspacing="0">
        <tr align="center" valign="middle">
        <td valign="middle">
        <table><tr><td>
        <img src="http://www.gungame5.com/images/gungame5_logo.png">&nbsp;&nbsp;</td><td>
        <b><?php print ($_GET["winnerName"]); ?></b> Won!<hr><br />
        <b><?php print ($_GET["winnerName"]); ?></b> won the game by killing <b><?php print ($_GET["loserName"]); ?></b><br /><br />
        <b>Stats:</b><br />
        Wins: <b><?php print ($_GET["wins"]); ?></b><br />
        Place: <b><?php print ($_GET["place"]); ?></b> of <b><?php print ($_GET["totalPlaces"]); ?></b></td></tr><tr><td colspan="2" align="center"><br><br>Powered by <a href="http://gungame5.com">http://www.gungame5.com</a></td></tr></table></td></tr></table>
        </body>
        </html>

        Also, you will need to edit gg_winner_display_page located in cfg/gungame5/custom_addon_configs/gg_winner_display.cfg

Servers running this addon:
http://www.game-monitor.com/search.php? ... e=variable

EventScripts Addon Manager
http://addons.eventscripts.com/addons/v ... er_display

Download

PostPosted: Sun Oct 26, 2008 4:46 am
by IPS TOONCES
cool i just put it on the server

Re: gg_winner_display

PostPosted: Sun Oct 26, 2008 5:54 am
by slipknot
Don just loaded it up and it is very nice. :!: :D

PostPosted: Sun Oct 26, 2008 6:03 am
by Don
This is SWEET!

PostPosted: Sun Oct 26, 2008 3:23 pm
by your-name-here
:O

Great job Sc0pE :p

PostPosted: Sun Oct 26, 2008 5:43 pm
by Warren
Updated: In version 1.0.1 there is a half second delay before sending the page so that it will be displayed on top of the end of game scores page.

PostPosted: Mon Oct 27, 2008 12:23 am
by Warren
Updated: Previous versions that use our web server will no longer function.
There were major issues with characters in player names breaking the page, and now, in version 1.0.2 this has been fixed.
The .py file was the only thing changed (if you were hosting on your own website, update the php page also).

PostPosted: Mon Oct 27, 2008 12:37 am
by IPS TOONCES
thanks. updated

**what lines do i edit to remove the white-text gg_win message in the CENTER of the screen so it doesn't cover up the winner display name? I like having the gg_win message at the top of the screen, but the middle one is getting in the way if this new addon is enabled

PostPosted: Mon Oct 27, 2008 1:29 pm
by mikaboshi
Hi i love this. Anyhow it just doesnt seem to work here :(. Can some one help me?

I updated the provided usermsg (did it with removing old usermsg, uploading new as usermsg.py & userms_271.py)
uploaded the custom addon
tried it with the gungame5.com/gg5_win.php & hosting one on our server, but when their is a winner, the gg5_win.php never comes out. Any help please?

edit: i did unload & reload gungame

Edit:
ok i'm not sure what i did, but suddenly it worked :s.

PostPosted: Mon Oct 27, 2008 3:05 pm
by Saul
You might want to use urllib.urlencode to automatically convert certain characters to the right code.
>>> urllib.urlencode({'winnerName': 'hello there & matrix'})
'winnerName=hello+there+%26+matrix'


Also, I've put the custom web page in a variable in the config (thats what they are there for!).

Heres my new code:
''' (c) 2008 by the GunGame Coding Team

    Title: gg_winner_display
    Version: 1.0.2
    Description: Custom addon.
    '''

# ==============================================================================
#   IMPORTS
# ==============================================================================
# Python imports
import urllib

# EventScripts imports
import es
import gamethread
import usermsg

# GunGame imports
import gungamelib

# ==============================================================================
#   ADDON REGISTRATION
# ==============================================================================
# Register this addon with EventScripts
info = es.AddonInfo()
info.name     = 'Winner Display Addon for GunGame: Python'
info.version  = '1.0.2'
info.url      = 'http://forums.gungame5.com/viewtopic.php?f=17&t=162'
info.basename = 'gungame/custom_addons/gg_winner_display'
info.author   = 'Sc0pE'

es.ServerVar('gg_winner_display_ver', info.version).makepublic()

# ==============================================================================
#   GAME EVENTS
# ==============================================================================
def gg_win(event_var):
    # Format variables
    attacker = event_var['attacker']
    attackername = es.getplayername(attacker)
    username = es.getplayername(event_var['userid'])
    steamid = es.getplayersteamid(attacker)
    wins = gungamelib.getWins(steamid)
    place = gungamelib.getWinnerRank(steamid) if steamid != 'BOT' else 'BOT'
    totalPlaces = gungamelib.getTotalWinners()
   
    # Send MOTD
    gamethread.delayed(0.5, sendDisplay, (attackername, username, wins, place, totalPlaces))

# ==============================================================================
#   HELPER FUNCTIONS
# ==============================================================================
def sendDisplay(attackername, username, wins, place, totalPlaces):
    # Encode the URL
    encoded = urllib.urlencode({
                               'winnerName': attackername,
                               'loser': username,
                               'wins': wins,
                               'place': place,
                               'totalPlaces': totalPlaces,
    })
   

    # Send MOTD
    usermsg.motd('#all', 2, 'GunGame Winner', '%s?%s' % (gungamelib.getVariableValue('gg_winner_display_page'), encoded))


New config:
// Enable / Disable gg_winner_display
// Enable = 1 / Disable = 0
gg_winner_display 1

// Custom web page
//  Leave this as default unless you want to have a customised winner page.
//
// Default = http://gungame5.com/gg5_win.php
gg_winner_display_page "http://gungame5.com/gg_win.php"


Hope you like it ;)

PostPosted: Tue Oct 28, 2008 12:17 am
by mikaboshi
When someone wins for the first time u get an odd message:
http://users.telenet.be/Looney/kevin/gg5_win_error.JPG

PostPosted: Tue Oct 28, 2008 12:36 am
by Warren
Updated: 1.0.3 adds a config option (thanks saul)

Re:

PostPosted: Tue Oct 28, 2008 12:37 am
by Warren
mikaboshi wrote:When someone wins for the first time u get an odd message:
http://users.telenet.be/Looney/kevin/gg5_win_error.JPG

Are you hosting the .php file on your own web server?

I don't think that I can reproduce this error. Please re-install and reboot and tell me if the problem persists.

Re: Re:

PostPosted: Tue Oct 28, 2008 4:32 am
by mikaboshi
Sc0pE wrote:
mikaboshi wrote:When someone wins for the first time u get an odd message:
http://users.telenet.be/Looney/kevin/gg5_win_error.JPG

Are you hosting the .php file on your own web server?

I don't think that I can reproduce this error. Please re-install and reboot and tell me if the problem persists.


yes, now it uses the one on my webserver. I was trying out things to get it to work & tried that to. Didnt putted it back on the gungame5.com file.

PostPosted: Wed Oct 29, 2008 5:58 pm
by Bogie
Does this work with GG4? Or should I wait 'till gg5 is released to load it?

PostPosted: Wed Oct 29, 2008 6:02 pm
by Warren
This only works with GunGame5. GunGame4 has something similar built into it.

PostPosted: Mon Nov 03, 2008 6:27 pm
by Bogie
rgr, thank you for the info sc0pe. Looks great on the server.

PostPosted: Thu Nov 13, 2008 12:01 am
by Lob
Excellent addon Scope. ;)

Re: gg_winner_display

PostPosted: Sat Nov 15, 2008 8:31 pm
by Tomelyr
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gewinner</title>
<style type="text/css">
body {
    background:#CCCCCC;
    font-family:Verdana,Tahoma;
    color:#000000;
    vertical-align:middle;
}
</style>
</head>
<body>
<table height="100%" topmargin="0" bottommargin="0" align="center"  cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td valign="middle">
<table><tr><td>
<img src="http://www.gungame5.com/images/gungame5_logo.png">&nbsp;&nbsp;</td><td>
<b><? echo ($_GET["winnerName"]); ?></b> hat gewonnen!<hr><br />
<b><? echo ($_GET["winnerName"]); ?></b> hat gewonnen weil er <b><? echo ($_GET["loserName"]); ?></b> getötet hat<br /><br />
<b>Statistik:</b><br />
Wins: <b><? echo ($_GET["wins"]); ?></b><br />
Place: <b><? echo ($_GET["place"]); ?></b> of <b><? echo ($_GET["totalPlaces"]); ?></b></td></tr><tr><td colspan="2" align="center"><br><br>Gesponsert von <a href="http://gungame5.com">http://www.gungame5.com</a></td></tr></table></td></tr></table>
</body>
</html>


If you want a German gg_winner_display use this as gg5_win.php

Re: gg_winner_display

PostPosted: Sun Nov 30, 2008 5:56 pm
by PPG_Paula
my server doesnt load this custom addon can anyone help me as quick as you can?