forked from 0xcds4r/build69-gtasa2.0
-
Notifications
You must be signed in to change notification settings - Fork 3
/
settings.cpp
59 lines (51 loc) · 2.18 KB
/
settings.cpp
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
#include "main.h"
#include "settings.h"
#include "vendor/inih/cpp/INIReader.h"
//
// Powered by tapy.me/weikton
//
CSettings::CSettings()
{
FLog("Loading settings..");
char buff[0x7F];
sprintf(buff, "%sSAMP/settings.ini", (const char*)(g_GTASAAdr+0x6D687C));
INIReader reader(buff);
if(reader.ParseError() < 0)
{
FLog("Error: can't load %s", buff);
// std::terminate();
return;
}
// Client
size_t length = 0;
sprintf(buff, "__android_%d%d", rand() % 1000, rand() % 1000);
length = reader.Get("client", "name", buff).copy(m_Settings.szNickName, MAX_PLAYER_NAME);
m_Settings.szNickName[length] = '\0';
length = reader.Get("client", "host", "127.0.0.1").copy(m_Settings.szHost, MAX_SETTINGS_STRING);
m_Settings.szHost[length] = '\0';
length = reader.Get("client", "password", "").copy(m_Settings.szPassword, MAX_SETTINGS_STRING);
m_Settings.szPassword[length] = '\0';
m_Settings.iPort = reader.GetInteger("client", "port", 1485);
// Debug
m_Settings.bDebug = reader.GetBoolean("debug", "debug", true);
m_Settings.bOnline = reader.GetBoolean("debug", "online", false);
// gui
length = reader.Get("gui", "Font", "Arial.ttf").copy(m_Settings.szFont, 35);
m_Settings.szFont[length] = '\0';
m_Settings.fFontSize = reader.GetReal("gui", "FontSize", 37.0f);
m_Settings.iFontOutline = reader.GetInteger("gui", "FontOutline", 1);
// chat
m_Settings.fChatPosX = reader.GetReal("gui", "ChatPosX", 325.0f);
m_Settings.fChatPosY = reader.GetReal("gui", "ChatPosY", 25.0f);
m_Settings.fChatSizeX = reader.GetReal("gui", "ChatSizeX", 1150.0f);
m_Settings.fChatSizeY = reader.GetReal("gui", "ChatSizeY", 220.0f);
m_Settings.iChatMaxMessages = reader.GetInteger("gui", "ChatMaxMessages", 6);
// spawnscreen
m_Settings.fSpawnScreenPosX = reader.GetReal("gui", "SpawnScreenPosX", 660.0f);
m_Settings.fSpawnScreenPosY = reader.GetReal("gui", "SpawnScreenPosY", 950.0f);
m_Settings.fSpawnScreenSizeX = reader.GetReal("gui", "SpawnScreenSizeX", 600.0f);
m_Settings.fSpawnScreenSizeY = reader.GetReal("gui", "SpawnScreenSizeY", 100.0f);
// nametags
m_Settings.fHealthBarWidth = reader.GetReal("gui", "HealthBarWidth", 100.0f);
m_Settings.fHealthBarHeight = reader.GetReal("gui", "HealthBarHeight", 10.0f);
}