Иконка ресурса

CSDM Menu 1.0.3

Нет прав для скачивания
Сообщения
2,751
Реакции
3,016
Помог
61 раз(а)
Код:
-#define IsPlayer(%1)                     (1 <= %1 <= MAX_PLAYERS)
+#define IsPlayer(%1)                     (1 <= %1 <= MaxClients)
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
mIDnight, I will add
Код:
stock FadeScreen(id) {
    static iScreenFade

    if(!iScreenFade)
        iScreenFade = get_user_msgid("ScreenFade")

    /*message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)*/
    message_begin(MSG_ONE_UNRELIABLE, iScreenFade, {0,0,0}, id)
    write_short(1<<10)
    write_short(1<<9)
    write_short(0x0000)
    write_byte(52)
    write_byte(g_iSettingColorRender[FadeColor][R])
    write_byte(g_iSettingColorRender[FadeColor][G])
    write_byte(g_iSettingColorRender[FadeColor][B])
    message_end()
}
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
Code_0xABC why?

I mean what is the difference if you store it inside stock, its gonna be called every time when ScreenFade is called. Also it's not gonna be changed during runtime so its okey to be hardcoded. But if you really like to store it don't do it as static variable , better store it as normal global new variable inside
plugin_init()
 
Последнее редактирование:
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
mIDnight, таким образом вы один раз воспльзуетесь get_user_msgid("ScreenFade") и закешируете id, в следующий раз уже будет старое значение
 
Последнее редактирование:
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Georg, зачем, если будет практически одно и тоже
3 Дек 2023
Код:
#include <amxmodx>

public plugin_init() {
    register_plugin("a", "b", "c");

    register_clcmd("say test", "test");
}

public test(id) {
    static iScreenFade;

    server_print("*** %i", iScreenFade);

    if(!iScreenFade)
        iScreenFade = get_user_msgid("ScreenFade");

    message_begin(MSG_ONE_UNRELIABLE, iScreenFade, {0,0,0}, id);
    write_short(1<<10);
    write_short(1<<9);
    write_short(0x0000);
    write_byte(52);
    write_byte(255);
    write_byte(100);
    write_byte(120);
    message_end();
}
3 Дек 2023
Code_0xABC, Тогда уж в plugin_init кэш делай
Вообще достаночно const gl_iScreenFade = 98
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
Code_0xABC


C++:
#include <amxmodx>

new iScreenFade;

public plugin_init() {
    register_plugin("a", "b", "c");

    register_clcmd("say test", "test");

    iScreenFade = get_user_msgid("ScreenFade");
}

public test(id) {
//    static iScreenFade;

    server_print("*** %i", iScreenFade);

/*    if(!iScreenFade)
        iScreenFade = get_user_msgid("ScreenFade"); */

    message_begin(MSG_ONE_UNRELIABLE, iScreenFade, {0,0,0}, id);
    write_short(1<<10);
    write_short(1<<9);
    write_short(0x0000);
    write_byte(52);
    write_byte(255);
    write_byte(100);
    write_byte(120);
    message_end();
}

Result:

C++:
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Разница в чем? При первом вызове стока, закешируется id сообщения
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
Based on the test results, using a global variable initialized in plugin_init() is a more reliable and consistent approach. It ensures that the get_user_msgid
is initialized before any function calls that might rely on it.
Using a static variable might introduce timing-related issues, especially if the initialization code depends on certain conditions being met, and those conditions are not guaranteed when the function is first called.
 
Сообщения
2
Реакции
0
interesting, when you see after more than 9 years that someone stole your idea and modified your entire original plugin
plugin was created on order for 2 cs portals
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
bakradabra More than 3-4 years ago, I saw a similar plugin on a server and liked the idea, so I decided to create one for myself as well. I don't see any problem with this, and it doesn't mean I stole your plugin code or anything like that. There's nothing particularly special about it, it's just a simple plugin.
 
Сообщения
2
Реакции
0
bakradabra More than 3-4 years ago, I saw a similar plugin on a server and liked the idea, so I decided to create one for myself as well. I don't see any problem with this, and it doesn't mean I stole your plugin code or anything like that. There's nothing particularly special about it, it's just a simple plugin.
of course ez plugin, but not for you, because users helped you with the editing:
"Code_0xABC"
"SergeyShorokhov"

I see that you are lying here in the topic too, otherwise you would have given "credit" to users:
"Code_0xABC"
"SergeyShorokhov"

enjoy your moment of fame
 
Сообщения
140
Реакции
24
Помог
2 раз(а)
bakradabra Post your source code along with the release date so we can see what you're referring to. It seems like nobody helped you because you don’t understand how to search for help or accept suggestions from others. Check the update page, and you’ll see mentions of contributors. Stop making baseless claims—there are tons of plugins with similar features. What are you talking about? Who stole anything from you? This plugin is written by me and you can't blame me because i saw similar plugin on some server and decided to make my own...
 

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

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