Raised This Month: $32 Target: $400
 8% 

show_menu() - Calling this method causes the selection of weapons by numbers on the k


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eduardolucioac
Member
Join Date: Jan 2016
Old 09-23-2020 , 19:14   show_menu() - Calling this method causes the selection of weapons by numbers on the k
Reply With Quote #1

The call to the show_menu() method causes the selection of weapons by numbers on the keyboard stop working. This situation occurs at the restart of the round.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>

#define PLUGIN "Damage Fire"
#define VERSION "1.0"
#define AUTHOR "NST"
#define MAX_KILLS 50
#define is_valid_player(%1) (1 <= %1 <= 32)

new max_show 16max_len 15
new kills[33][MAX_KILLS][4], list_victims[2000], num_victims[33], g_hudmsg2cvar_show_damage

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("Damage""on_damage""b""2!0""3=0""4!0")
    
register_logevent("logevent_round_end"2"1=Round_End")
    
    
// cvar
    
cvar_show_damage register_cvar("nst_show_damage_fire","0")
    
    
// msg
    
g_hudmsg2 CreateHudSyncObj()
}

// Log Event Round End
public logevent_round_end()
{
// OK
    
for (new id 1id 33id++)
    {
        if (!
is_user_connected(id)) {
            continue;
        }
        
show_victims(id)
    }
}

public 
on_damage(id)
{
// OK
    
static attackerattacker get_user_attacker(id)
    static 
damagedamage read_data(2)
    
    if (!
is_user_connected(id) || !is_user_connected(attacker) || attacker==id) return;
    

    new 
damage_fire
    
new health_old get_user_health(id)+damage
    
if (damage <= health_olddamage_fire damage
    
else damage_fire health_old

    
new 00check_e 0victim_id 1
    
while (MAX_KILLS && check_e != && victim_id 0)
    {
        
victim_id kills[attacker][i][0]
        if (
victim_id == id && kills[attacker][i][1] != 1) {
            
i
            check_e 
1
        
}

        
+= 1
    
}

    if (
== && check_e != 1) {
        
num_victims[attacker]
        
num_victims[attacker] += 1
    
}

    if (
MAX_KILLS)
    {
        
kills[attacker][e][0] = id
        kills
[attacker][e][1] = 0
        kills
[attacker][e][2] += damage_fire
    
}

    if (
get_pcvar_num(cvar_show_damage))
    {
        
set_hudmessage(25500, -1.00.5520.12.00.10.1, -1)
        
ShowSyncHudMsg(attackerg_hudmsg2"%i"damage)
    }

}
public 
client_death(killervictimwpnindexhitplaceTKid)
{
// OK
    
if (!is_user_connected(victim) || !is_user_connected(killer) || killer==victim) return;

    if (
wpnindex != CSW_C4)
    {
        
// UPDATE VICTIMS OF VICTIM
        
new headshot = (hitplace == HIT_HEAD) ? 0
        
new vic_wpnnum_vic num_victims[killer]
        if (
num_vic<=|| num_vic>=MAX_KILLS) return;
        
        if (
headshot && wpnindexvic_wpn 1
        
else if (wpnindex == CSW_KNIFEvic_wpn 2
        
else if (wpnindex == CSW_HEGRENADEvic_wpn 3
        
else vic_wpn 4
        kills
[killer][(num_vic-1)][3] = vic_wpn
        
        
for (new 033e++)
        {
            for (new 
ee 0ee num_victims[e]; ee++)
            {
                if (
kills[e][ee][0] == victimkills[e][ee][1] = 1
            
}
        }
        
        
// SHOW VICTIMS OF PLAYER
        
show_victims(victim)
    }
}

reset_victims(idpl)
{
// OK
    
for (new 0MAX_KILLSi++)
    {
        
kills[idpl][i][0] = 0
        kills
[idpl][i][1] = 0
        kills
[idpl][i][2] = 0
        kills
[idpl][i][3] = 0
    
}
    
num_victims[idpl] = 0
}

show_victims(idpl)
{
    new 
0victim_id 1num_die 0
    
while (MAX_KILLS && victim_id 0)
    {
        
victim_id kills[idpl][i][0]
        if (
victim_id 0)
        {
            if (
kills[idpl][i][3] > || kills[idpl][i][2] >= 100num_die += 1
            
            
if (max_show)
            {
                new 
victim_idwpn kills[idpl][i][3]
                new 
victim_wpn[10]
                if (
victim_idwpn == 1victim_wpn "[HS]"
                
else if (victim_idwpn == 2victim_wpn "[KF]"
                
else if (victim_idwpn == 3victim_wpn "[HE]"
                
else victim_wpn ""
        
                
new victim_name[33], victim_row[33], victim_name_fix[33]
                
get_user_name(kills[idpl][i][0],victim_name,33)
                new 
num_name strlen(victim_name)
                if (
num_name max_len) {
                    
copy(victim_name_fix,(max_len-3),victim_name)
                    
add (victim_name_fix,max_len,"...")
                }
                else 
victim_name_fix victim_name
            
                format 
(victim_row ,33"%s: %i %s^n"victim_name_fixkills[idpl][i][2], victim_wpn
                
add (list_victims,1999,victim_row)
            }
          }
        
+= 1
    
}
    new 
num_player num_victims[idpl]
    new 
add1[10]
    if (
num_player 0)
    {
        if (
num_player max_showadd1 "...."
        
format(list_victims2000"%i Player / %i Die^n%s %s"num_playernum_dielist_victimsadd1)

        
// TODO: For some reason, the execution of this code snippet causes the selection 
        // of weapons by numbers on the keyboard stop working. By Questor
            // >>>>>>>>>>>>>
        // https://forums.alliedmods.net/showthread.php?t=52044
        
show_menu(idpl5list_victims5"list_victims")
            
// <<<<<<<<<<<<<

    
}
    
    
reset_victims(idpl)
    
list_victims ""

}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/ 
eduardolucioac 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 00:33.


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