score reapi

Sanjay Singh

Пользователь
Регистрация
2 Июл 2017
Сообщения
6
Симпатии
0
Пол
Мужской
store score & restore score not working

Код:
 #include <amxmodx>
#include <reapi>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"

new float: F [33];
new D [33];

public plugin_init ()
{
    register_plugin (PLUGIN, VERSION, AUTHOR)
    register_clcmd ("say / s", "Store");
    register_clcmd ("say / r", "Restore");
}

public Store (id)
{
    new players [32], num, x
    get_players (players, num, "ch")

    for (new i = 0; i <num; i ++)
    {
        x = players [i]
        if (is_user_connected (x))
        {
            F [x] = get_entvar (x, var_frags);
            D [x] = get_entvar (x, m_iDeaths);
        }
        client_print_color (0, -1, "F:% f, D:% i", F [x], D [x]);
    }
}

public Restore (id)
{
    new players [32], num, x
    get_players (players, num, "ch")

    for (new i = 0; i <num; i ++)
    {
        x = players [i]
        if (is_user_connected (x))
        {
            set_entvar (x, var_frags, F [x]);
            set_entvar (x, m_iDeaths, D [x]);
        }
        client_print_color (0, -1, "F:% f, D:% i", F [x], D [x]);
    }
} [/ CODE]
 

Vaqtincha

aggressive
Разработчик
Скриптер
Регистрация
28 Янв 2018
Сообщения
963
Симпатии
685
Пол
Мужской
m_iDeaths это не entvar а member
Без отправки ScoreInfo не будет сразу менять.
 

Sanjay Singh

Пользователь
Регистрация
2 Июл 2017
Сообщения
6
Симпатии
0
Пол
Мужской
how can i send scoreinfo for update?
Is this correct way to update?

Код:
public Restore (id)
{
    new players [32], num, x
    get_players (players, num, "ch")

    for (new i = 0; i <num; i ++)
    {
        x = players [i]
        if (is_user_connected(x))
        {
            set_entvar(x, var_frags, F[x]);
            set_member(x, m_iDeaths, D[x]);

            message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
            write_byte(x) // id
            write_short(F[x]) // Frags
            write_short(D[x]) // Deaths
            write_short(0) // Class
            write_short(get_member(x, m_iTeam)) // Team
            message_end()
        }
        client_print_color (0, -1, "F:% f, D:% i", F [x], D [x]);
    }
}
 
Последнее редактирование:

Sanjay Singh

Пользователь
Регистрация
2 Июл 2017
Сообщения
6
Симпатии
0
Пол
Мужской
tried MSG_ALL
only deaths updated and frags still same whats wrong
Код:
public Restore(id)
{
    new players[32], num, x
    get_players(players, num,"ch")

    for(new i = 0; i < num; i++)
    {
        x = players[i]
        set_entvar(x, var_frags, F[x]);
        set_member(x, m_iDeaths, D[x]);
        client_print_color(0, -1, "F: %f , D: %i ", F[x], D[x]);

        message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
        write_byte(x) // id
        write_short(F[x]) // Frags
        write_short(D[x]) // Deaths
        write_short(0) // Class
        write_short(get_member(x, m_iTeam)) // Team
        message_end()
    }
}
 
Сверху Снизу