-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.pwn
107 lines (84 loc) · 4.09 KB
/
test.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma dynamic 64000
// #pragma option -E
#define VOID_TAGS
#define STRONG_TAGS
// #define LANGPLUS_REPLACE_NATIVES
#include <open.mp>
#include "LangPlus.inc"
main() {}
new Language:g_LangEnglish;
new Language:g_LangUkrainian;
public OnGameModeInit() {
Logger_ToggleDebug("langplus", true);
LangPlus_SetStringReplacement("{CE_WHITE}", "{FFFFFF}");
g_LangEnglish = LangPlus_LoadLanguage("English");
g_LangUkrainian = LangPlus_LoadLanguage("Ukrainian");
new langList[MAX_LANGUAGES][MAX_LANGUAGES * MAX_LANGUAGE_NAME];
new langCount = LangPlus_GetLanguageList(langList);
printf("Available languages: %d", langCount);
for (new i = 0; i < langCount; i++) {
printf("%s", langList[i]);
}
print("#########################################");
print("## TEST: Replacements ##");
print("#########################################");
printf(LangPlus_ReturnLanguageString(g_LangEnglish, "TEST_REPLACEMENT"));
print("#########################################");
print("## TEST: Escape sequences ##");
print("#########################################");
new escapedString[MAX_LANGUAGE_ENTRY_LENGTH + 1];
LangPlus_GetLanguageString(g_LangEnglish, "DIALOGMENU", escapedString);
print("Option 1\nOption 2\nOption 3");
print(escapedString);
print("#########################################");
print("## TEST: LangPlus_ReturnLanguageString ##");
print("#########################################");
print("[TEST] English language set");
print(LangPlus_ReturnLanguageString(g_LangEnglish, "TEST_LANG"));
printf(LangPlus_ReturnLanguageString(g_LangEnglish, "TEST_SCM"), 2137);
print("[TEST] Ukrainian language set");
print(LangPlus_ReturnLanguageString(g_LangUkrainian, "TEST_LANG"));
printf(LangPlus_ReturnLanguageString(g_LangUkrainian, "TEST_SCM"), 2137);
printf(LangPlus_ReturnLanguageString(g_LangUkrainian, "KEYONLYENGLISH"));
print("########################################");
print("## TEST: LangPlus_GetLanguageString ##");
print("########################################");
new referenceTest[MAX_LANGUAGE_ENTRY_LENGTH + 1];
LangPlus_GetLanguageString(g_LangEnglish, "TEST_LANG", referenceTest);
print(referenceTest);
return 1;
}
public OnPlayerConnect(playerid) {
SendClientMessage(playerid, -1, "[TEST] No language set");
LangPlus_SendClientMessage(playerid, -1, "TEST_SCM", 2137);
SendClientMessage(playerid, -1, "[TEST] Ukrainian language set");
LangPlus_SetPlayerLanguage(playerid, g_LangUkrainian);
LangPlus_SendClientMessage(playerid, -1, "TEST_SCM", 2137);
LangPlus_SetPlayerLanguage(playerid, g_LangEnglish);
LangPlus_SendClientMessage(playerid, -1, "TEST_SCM", 2137);
LangPlus_SetPlayerLanguageByName(playerid, "Ukrainian");
LangPlus_SendClientMessage(playerid, -1, "TEST_SCM", 2137);
LangPlus_SendClientMessageToAll(-1, "TEST_SCM", 2137);
// Hooked natives
#if defined LANGPLUS_REPLACE_NATIVES
LangPlus_SetPlayerLanguage(playerid, g_LangEnglish);
SendClientMessage(playerid, -1, "[TEST] Hooked natives in English - SendClientMessage");
SendClientMessage(playerid, -1, "regular message");
SendClientMessage(playerid, -1, "TEST_SCM", 2137);
SendClientMessage(playerid, -1, "TEST_SCM", 2137);
SendClientMessage(playerid, -1, "[TEST] Hooked natives in English - SendClientMessageToAll");
SendClientMessageToAll(-1, "regular message", 2137);
SendClientMessageToAll(-1, "TEST_SCM", 2137);
SendClientMessageToAll(-1, "TEST_SCM", 2137);
LangPlus_SetPlayerLanguage(playerid, g_LangUkrainian);
SendClientMessage(playerid, -1, "[TEST] Hooked natives in Ukrainian - SendClientMessage");
SendClientMessage(playerid, -1, "regular message");
SendClientMessage(playerid, -1, "TEST_SCM", 2137);
SendClientMessage(playerid, -1, "TEST_SCM", 2137);
SendClientMessage(playerid, -1, "[TEST] Hooked natives in Ukrainian - SendClientMessageToAll");
SendClientMessageToAll(-1, "regular message", 2137);
SendClientMessageToAll(-1, "TEST_SCM", 2137);
SendClientMessageToAll(-1, "TEST_SCM", 2137);
#endif
return 1;
}