←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Dodatkowe hp za kille

  • +
  • -
devil11 - zdjęcie devil11 11.06.2016

Witam
Z nudów tworze własnego vipa pod cs go, którego z czasem będę chciał udostępnić w sieci i mam mały problem z dodawaniem hp za killa oraz hs na mapach aim/awp/fy. Dodatkowe wartości są ustalane za pomocą cvarów
 
g_hCvar[3] = CreateConVar("vip_give_money_kill", "0", "Ile ma dodawac pieniedzy za zabicie: 0:brak");
    g_hCvar[4] = CreateConVar("vip_give_health_kill", "5", "Ile ma dodawac zycia za zabicie: 0:brak");
    g_hCvar[5] = CreateConVar("vip_give_health_money_kill_hs", "2", "Ile razy wiecej pieniedzy i zycia za zabicie headshotem: 0:brak");
 
g_iCvar[3] = GetConVarInt(g_hCvar[3]);
    g_iCvar[4] = GetConVarInt(g_hCvar[4]);
    g_iCvar[5] = GetConVarInt(g_hCvar[5]);
 
if(g_iCvar[3] || g_iCvar[5]) HookEvent("player_death",  OnPlayerDeath);
 
 
public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) {
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    if(!isValid(attacker) || attacker == GetClientOfUserId(GetEventInt(event, "userid"))) return;
 
    new iMoney = GetEventBool(event, "headshot") ? (g_iCvar[3] * g_iCvar[5]) : g_iCvar[3];
    new iHealthAdd = GetEventBool(event, "headshot") ? (g_iCvar[4] * g_iCvar[5]) : g_iCvar[4];
 
    PrintHintText(attacker, "+%iHP i +$%i", iHealthAdd, iMoney);
    SetEntProp(attacker, Prop_Send, "m_iAccount", GetEntProp(attacker, Prop_Send, "m_iAccount") + iMoney);
 
    
}
 
Odpowiedz