Knife bonus - fast switch bug

Сообщения
10
Реакции
0
Код:
public client_death(killer, victim, wpnindex, hitplace, TK) {
    new rd_maxplayers = get_cvar_num("amx_bonus_maxplayers")
    new restrict_bonus_knife = get_cvar_num("amx_restrict_bonus_knife")
    new selfkill = (victim == killer) ? true : false
    if ((!selfkill) && is_user_connected(killer) && restrict_bonus_knife) {
        if (wpnindex == CSW_KNIFE) {
            if (get_playersnum() >= rd_maxplayers) {
                static nume[32], nume2[32]
                get_user_name(killer, nume, 31)
                get_user_name(victim, nume2, 31)
                server_cmd("amx_givepoints ^" % s ^ " 500", nume)
            }
        }
    }
}
I have a problem with this code,
If I pull with awp and make a fast switch, it appears that I have killed with a knife, how can i prevent this? Thanks
 
Последнее редактирование модератором:

Ayk

Сообщения
763
Реакции
478
Помог
19 раз(а)
Hook DeathMsg event and use read_data(4). It will give the right name of the gun.
 
Сообщения
278
Реакции
137
lulu3192,
Maybe better to use RG_CBasePlayer_Killed

And use authid instead of name. It won't work everytime.
PHP:
-static nume[32], nume2[32]
-get_user_name(killer, nume, 31)
-get_user_name(victim, nume2, 31)
-server_cmd("amx_givepoints ^"%s^" 500", nume)

+new authid[32];
+get_user_authid(killer, authid, charsmax(authid));
+server_cmd("amx_givepoints ^"%s^" 500", authid);
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу