gg_leader and gg_knife_level

Discussion about Included Addons

gg_leader and gg_knife_level

Postby Mickroz » Mon Oct 11, 2010 9:33 am

i would love to see the tracking of:
gg_leader - (Became Leader)
gg_knife_level - (Reached Knife Level)

as GunGame:SM does, are these triggered with gungame5 or could these be implemented easy?
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am

Postby satoon101 » Mon Oct 11, 2010 4:20 pm

Here are the events that are currently tracked:
//
//=========== (C) Copyright 2008 GunGame 5 All rights reserved. ===========
//
// Events triggered by GunGame mod version 1.0.432
//
// No spaces in event names, max length 32
// All strings are case sensitive
// total game event byte length must be < 1024
//
// valid data key types are:
//   none   : value is not networked
//   string : a zero terminated string
//   bool   : unsigned int, 1 bit
//   byte   : unsigned int, 8 bit
//   short  : signed int, 16 bit
//   long   : signed int, 32 bit
//   float  : float, 32 bit

"gungame_events"
{
    "gg_levelup"
    {
        "attacker"  "short"     // The userid of the player that leveled up
        "leveler"   "short"     // The userid of the player that is leveling
        "userid"    "short"     // The userid of victim
        "old_level" "byte"      // The old level of the player that leveled up
        "new_level" "byte"      // The new level of the player that leveled up
        "reason"    "string"    // The reason for the level up
    }
    "gg_leveldown"
    {
        "userid"    "short"     // The userid of player that is leveling down
        "leveler"   "short"     // The userid of the player that is leveling
        "attacker"  "short"     // The userid of the attacker
        "old_level" "byte"      // The old level of the player that leveled down
        "new_level" "byte"      // The new level of the player that leveled down
        "reason"    "string"    // The reason for the level down
    }
    "gg_knife_steal"
    {
        "attacker"          "short" // The userid of the player that stole the level
        "attacker_level"    "byte"  // The new level of the player that stole the level
        "userid"            "short" // The userid of victim
        "userid_level"      "byte"  // The new level of the victim
    }
    "gg_multi_level"
    {
        "userid"    "short" // The userid of the leader that lost a level
        "leveler"   "short" // The userid of the player that is leveling
    }
    "gg_new_leader"
    {
        "userid"        "short"     // The userid of the player that became the new leader
        "leveler"       "short"     // The userid of the player that leveled up to become the new leader
        "leaders"       "string"    // String of current leaders' userids separated by "," e.g. "2,7,9"
        "old_leaders"   "string"    // String of old userids separated by "," e.g. "2,7,9"
        "leader_level"  "short"     // The current leader's level
    }
    "gg_tied_leader"
    {
        "userid"        "short"     // The userid of the player that tied the leader(s)
        "leveler"       "short"     // The userid of the player that leveled up to tie then leaders
        "leaders"       "string"    // String of current leaders' userids separated by "," e.g. "2,7,9"
        "old_leaders"   "string"    // String of old leaders' userids separated by "," e.g. "2,7,9"
        "leader_level"  "short"     // The current leader's level
    }
    "gg_leader_lostlevel"
    {
        "userid"        "short"     // The userid of the leader that lost a level
        "leveler"       "short"     // The userid of the player that is leveling
        "leaders"       "string"    // String of current leaders' userids separated by "," e.g. "2,7,9"
        "old_leaders"   "string"    // String of old leaders' userids separated by "," e.g. "2,7,9"
        "leader_level"  "short"     // The current leader's level
    }
    "gg_start"
    {
        // Fires at the end of the warmup round
        // Fires on es_map_start if there is no warmup round
    }
    "gg_vote"
    {
        // Fires when a vote starts
    }
    "gg_win"
    {
        "attacker"  "short"     // The userid of the player that won
        "winner"    "short"     // The userid of the player that won
        "userid"    "short"     // The userid of the victim that "gave up" the win
        "loser"     "short"     // The userid of the victim that "gave up" the win
        "round"     "bool"      // 1 if the winner of the round, 0 if the winner of the map
    }
    "gg_map_end"
    {
        // Fires at the end of a map when there is no winner
    }
    "gg_load"
    {
        // Fires when gungame is successfully loaded
    }
    "gg_unload"
    {
        // Fires when gungame is successfully unloaded
    }
    "gg_addon_loaded"
    {
        "addon"     "string"    // The name of the addon that was loaded
        "type"      "string"    // The type of addon that was loaded (included or custom)
    }
    "gg_addon_unloaded"
    {
        "addon"     "string"    // The name of the addon that was unloaded
        "type"      "string"    // The type of addon that was unloaded (included or custom)
    }
}
While there is no exact equivalent of gg_knife_level, you can always use gg_levelup with checking to see if the level weapon is knife to achieve the same thing.

As for gg_leader, notice there is not only gg_new_leader, but gg_tied_leader as well.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_leader and gg_knife_level

Postby Mickroz » Mon Oct 11, 2010 4:37 pm

tnx satoon, i can work with this i think, i was wondering about this since it triggers a sound when reaching certain levels and i want to track those with hlstatsx.
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am

Re: gg_leader and gg_knife_level

Postby Mickroz » Tue Oct 12, 2010 8:34 am

hmm how could i check to see if a player reaches knive level?
i looked through some addons and custom addons, but this python thing is way above my head :P
i'll request it in the requested forum, this shouldn't be too hard to create for those plugin guys.
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am

Postby satoon101 » Tue Oct 12, 2010 5:55 pm

import es
from gungame51.core.players.shortcuts import Player

def gg_levelup(event_var):
    ggPlayer = Player(event_var['userid'])
    weapon = ggPlayer.weapon
    if weapon == 'knife':
        es.msg('Player %s on Knife Level'%event_var['es_username'])
I don't know anything about HLStatsX, so I can't really be any help there. Hopefully this is all you really need.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_leader and gg_knife_level

Postby Mickroz » Tue Oct 12, 2010 8:35 pm

hlstatsx monitors events in the logs, so if you level up, its says in the log player triggered event gg_levelup and it will give points to the player.
So if you can make it to let it trigger event gg_knife_level that would be great.
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am

Postby satoon101 » Tue Oct 12, 2010 8:57 pm

Try this:
# save as ../addons/eventscripts/gg_knife_level/gg_knife_level.py

import es
from gungame51.core.players.shortcuts import Player

def load():
    loadEvent()

def es_map_start(event_var):
    loadEvent()

def loadEvent():
    es.loadevents('declare', 'addons/eventscripts/gg_knife_level/gg_knife_level.res')

def gg_levelup(event_var):
    if Player(event_var['leveler']).weapon != 'knife':
        return
    es.event('initialize', 'gg_knife_level')
    es.event('setint', 'gg_knife_level', 'userid', event_var['leveler'])
    es.event('fire', 'gg_knife_level')
// save as ..addons/eventscripts/gg_knife_level/gg_knife_level.res

"gg_knife_level"
{
    "gg_knife_level"
    {
        "userid"    "short"  // userid of the player that leveled to knife level
    }
}
Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_leader and gg_knife_level

Postby Mickroz » Wed Oct 13, 2010 9:36 am

tnx satoon, i just uploaded the files, will give it a go.
ahh i could just es_load this right? or does it loads automatic?
es_load works, but it's not tracking.
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am

Re: gg_leader and gg_knife_level

Postby Mickroz » Wed Oct 13, 2010 10:34 am

forgot to track it within gungame51 lol, it works Satoon, Big thanks! now i can adjust this for nade aswell :D
Mickroz

Private
Private
 
Posts: 21
Joined: Fri Jul 16, 2010 8:29 am



Return to Included Addons

Who is online

Users browsing this forum: No registered users and 5 guests

cron