-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.pwn
58 lines (46 loc) · 1.18 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
#include <a_samp>
#include <gvar>
#include "zlang.inc"
enum e_LANG_INFO {
Lang:e_LANG_EN,
Lang:e_LANG_RU,
}
static
gLang[e_LANG_INFO];
main()
{
// load languages
gLang[e_LANG_RU] = Lang_Add("ru", "Russian");
gLang[e_LANG_EN] = Lang_Add("en", "English");
Lang_LoadFile(gLang[e_LANG_RU], "ru.ini");
Lang_LoadFile(gLang[e_LANG_EN], "en.ini");
Lang_printf("COMMANDS_LIST");
// set english as the default language
Lang_SetDefaultLang(gLang[e_LANG_EN]);
Lang_printf("COMMANDS_LIST");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/ru", true, 3) == 0) {
Lang_SetPlayerLang(playerid, gLang[e_LANG_RU]);
Lang_SendText(playerid, "LANGUAGE_CHANGED");
return 1;
}
if (strcmp(cmdtext, "/en", true, 3) == 0) {
Lang_SetPlayerLang(playerid, gLang[e_LANG_EN]);
Lang_SendText(playerid, "LANGUAGE_CHANGED");
return 1;
}
if (strcmp(cmdtext, "/help", true, 5) == 0) {
Lang_SendText(playerid, "{FF0000}HELLO_MSG");
Lang_SendText(playerid, "COMMANDS_LIST");
return 1;
}
if (strcmp(cmdtext, "/help330", true, 5) == 0) {
Lang_SendText(playerid, "Hello, World!");
Lang_SendText(playerid, "Commands: /help, /en, /ru");
return 1;
}
return 0;
}