Page 1 of 1

Cvaru kurimas

Posted: 2017 Jan 03 14:50
by luxuks
Sveiki, cia per plugina viena bandau pasidaryt kad vipai gautu dvigubai daugiau xp. Cia po apacia yra kodas kaip as pasidares esu kad vipai gautu 2x xp pagal cvara. Viska compilina be errroru bet serveryje neveikia cvarai su galune _vip, jie yra sukurti viska bet cia turbut eilutej sitame kode netaip kazka suvedu kad pluginas vistiek veikia tik pagal senaji cvara. Zodziu jeigu nesupratot ko noriu tai as noriu kad sitame koduke vipai su b flagu (reservation) gautu xp pagal kita cvara siuo atveju pagal tus 3 cvarus su _vip galunem. Buciau labai dekingas uz pagalba.

Code: Select all

public EventDeathMsg(){    new killer = read_data(1);    new victim = read_data(2);        if( (g_first_client <= killer <= g_max_clients) && victim != killer )    {        if( IsUserAuthorized(killer) )        {            // regular kill            new xp = get_pcvar_num(cvar_xp_kill);                        if(get_user_flags(read_data(1) & ADMIN_RESERVATION))            {            get_pcvar_num(cvar_xp_kill_vip);            }                        if( read_data(3) )            {                // headshot kill                xp += get_pcvar_num(cvar_xp_headshot);                                if(get_user_flags(read_data(3) & ADMIN_RESERVATION))                {                xp += get_pcvar_num(cvar_xp_headshot_vip);                }            }            else            {                static weapon[20];                read_data(4, weapon, sizeof(weapon) - 1);                                if( contain(weapon, "grenade") >= 0 )                {                    // grenade kill (or frostnade)                    xp += get_pcvar_num(cvar_xp_grenade);                                        if(get_user_flags(read_data(4) & ADMIN_RESERVATION))                    {                    xp += get_pcvar_num(cvar_xp_grenade_vip);                    }                    }            }                        g_xp[killer] += xp;                        Print(killer, "Gavai %i XP!", xp);                        Save(killer);        }    }    else if( IsUserAuthorized(victim) )    {        // victim died of map causes or killed self        new xp = get_pcvar_num(cvar_xp_suicide);                g_xp[victim] -= xp;                Print(victim, "Praradai %i XP!", xp);                Save(victim);    }}
-- 2017 Sau 03 15:51 --

Kur cia problema kad neduoda vipam to kito cvaro?

Re: Cvaru kurimas

Posted: 2017 Jan 03 15:35
by GoogleBot
ten kur pakomentuota //regular kill tikriausiai turejai rasyt

if(get_user_flags(read_data(1) & ADMIN_RESERVATION))
{
xp = get_pcvar_num(cvar_xp_kill_vip);
}


vietoj
if(get_user_flags(read_data(1) & ADMIN_RESERVATION))
{
get_pcvar_num(cvar_xp_kill_vip);
}

Re: Cvaru kurimas

Posted: 2017 Jan 03 17:36
by luxuks
Neduoda dvigubai daugiau xp vistiek nors cvare nurodyta kad vietoj 1xp duotu 2xp. Cia turbut reikia kazkaip kitaip tas eilutes rasyt sitoj vietoj

Re: Cvaru kurimas

Posted: 2017 Jan 03 18:45
by ArtHa123
Na kaip matau turbūt nelabai pagavai read_data esmę, jeigu --> if(get_user_flags(read_data(4) & ADMIN_RESERVATION)) :asian:

Code: Select all

public EventDeathMsg(){    new killer = read_data(1);    new victim = read_data(2);     if( (g_first_client <= killer <= g_max_clients) && victim != killer )    {        if( IsUserAuthorized(killer) )        {            // regular kill            new xp = get_pcvar_num(cvar_xp_kill);             if(get_user_flags(killer & ADMIN_RESERVATION))            {                xp = get_pcvar_num(cvar_xp_kill_vip);            }             if( read_data(3) )            {                // headshot kill                xp += get_pcvar_num(cvar_xp_headshot);                 if(get_user_flags(killer & ADMIN_RESERVATION))                {                    xp += get_pcvar_num(cvar_xp_headshot_vip);                }            }            else            {                static weapon[20];                read_data(4, weapon, sizeof(weapon) - 1);                 if( contain(weapon, "grenade") >= 0 )                {                    // grenade kill (or frostnade)                    xp += get_pcvar_num(cvar_xp_grenade);                                        if(get_user_flags(killer & ADMIN_RESERVATION))                    {                        xp += get_pcvar_num(cvar_xp_grenade_vip);                    }                }            }             g_xp[killer] += xp;            Print(killer, "Gavai %i XP!", xp);             Save(killer);        }    }    else if( IsUserAuthorized(victim) )    {    // victim died of map causes or killed self    new xp = get_pcvar_num(cvar_xp_suicide);     g_xp[victim] -= xp;     Print(victim, "Praradai %i XP!", xp);     Save(victim);    }}
Bandyk.

P.s. kiek aš žinau

Code: Select all

read_data(1) - "index_of_killer"read_data(2) - "index_of_victim"read_data(3) - "headshot"read_data(4) - "weapon_name"