Участник
Пользователь
- Сообщения
- 137
- Реакции
- 23
- Помог
- 2 раз(а)
-#define IsPlayer(%1) (1 <= %1 <= MAX_PLAYERS)
+#define IsPlayer(%1) (1 <= %1 <= MaxClients)
Thanks for suggestion, that's good idea, i will updateNot bad. Maybe using IniParser.
Thanks, i didn't notice, code was written 3 years ago few days ago refactored it.Код:-#define IsPlayer(%1) (1 <= %1 <= MAX_PLAYERS) +#define IsPlayer(%1) (1 <= %1 <= MaxClients)
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()
}
#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();
}
*** 0
*** 98
*** 98
Вообще достаночноCode_0xABC, Тогда уж в plugin_init кэш делай
const gl_iScreenFade = 98
#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();
}
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
*** 98
mIDnight : test
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Разница в чем?