· 7 years ago · Sep 06, 2018, 08:34 PM
1// VARIABILI DEL SERVER
2new DB:Database;
3new WorldTime[3];
4
5// Textdraws
6new Text:StopAnim;
7new Text:BoxNotice;
8new Text:LoadingNotice;
9
10// Enumeration
11enum pInfo
12{
13 // VARIABILI ACCOUNT DATABASE
14 pID,
15 pUsername[MAX_PLAYER_NAME],
16 pAge,
17 pGender,
18 pRegistered,
19 pMember,
20 pRank,
21 pLeader,
22 pIP[16],
23 pBanned,
24 pBanReason[64],
25 pBanExpiry,
26 pJailTime,
27 pJailReason[64],
28 pNMute,
29 pRMute,
30 pAdminLevel,
31 pSecondaryTask,
32 pMoney,
33 Float:pPositionX,
34 Float:pPositionY,
35 Float:pPositionZ,
36 Float:pFacingAngle,
37 pInterior,
38 pVirtualWorld,
39 pSkin,
40 Float:pHealth,
41 Float:pArmour,
42 // VARIABILI AL DI FUORI DELL'ACCOUNT
43 pReport[128],
44 pTogNewbie,
45 pLastUpdate,
46 PlayerAnimLibsPreloaded,
47 gPlayerUsingLoopingAnim,
48 CurrentDialog,
49}
50new PlayerInfo[MAX_PLAYERS][pInfo];
51
52enum dInfo
53{
54 Float:dExteriorX,
55 Float:dExteriorY,
56 Float:dExteriorZ,
57 Float:dExteriorAngle,
58 dExteriorInt,
59 dExteriorVir,
60 Float:dInteriorX,
61 Float:dInteriorY,
62 Float:dInteriorZ,
63 Float:dInteriorAngle,
64 dInteriorInt,
65 dInteriorVir,
66 dName[64],
67 dPickup,
68 Text3D:dDynamicText
69}
70new DoorInfo[MAX_DOORS][dInfo];
71
72enum gInfo
73{
74 gName[32],
75 gType,
76 gRank0[32],
77 gRank1[32],
78 gRank2[32],
79 gRank3[32],
80 gRank4[32],
81 gRank5[32],
82 gRank6[32]
83
84};
85new GroupInfo[MAX_GROUPS][gInfo];
86
87//------------------------------------------------------------------------------
88// FORWARDS
89//------------------------------------------------------------------------------
90// NIL
91//------------------------------------------------------------------------------
92// FUNZIONI
93//------------------------------------------------------------------------------
94main()
95{
96 SendRconCommand("hostname "SERVER_NAME);
97 SendRconCommand("rcon_password "SERVER_RCON);
98 SendRconCommand("gamemodetext "SERVER_VERSION);
99 SendRconCommand("mapname "SERVER_MAP);
100 SendRconCommand("weburl "SERVER_WEBSITE);
101 SendRconCommand("password "SERVER_PASSWORD);
102 printf(""SERVER_NAME" ("SERVER_VERSION"), sono state caricate correttamente.");
103}
104//------------------------------------------------------------------------------
105// CALLBACKS
106//------------------------------------------------------------------------------
107public OnGameModeInit()
108{
109 AntiDeAMX();
110
111 Database = db_open("database.db");
112 new string[1024];
113 strcat(string, "CREATE TABLE IF NOT EXISTS Accounts(");
114 strcat(string, "UserID INTEGER PRIMARY KEY AUTOINCREMENT,");
115 strcat(string, "Username VARCHAR(24) COLLATE NOCASE,");
116 strcat(string, "Password VARCHAR(128),");
117 strcat(string, "IP VARCHAR(16),");
118 strcat(string, "Age INTEGER DEFAULT 0 NOT NULL,");
119 strcat(string, "Gender INTEGER DEFAULT 0 NOT NULL,");
120 strcat(string, "Registered INTEGER DEFAULT 0 NOT NULL,");
121 strcat(string, "Member INTEGER DEFAULT 0 NOT NULL,");
122 strcat(string, "Rank INTEGER DEFAULT 0 NOT NULL,");
123 strcat(string, "Leader INTEGER DEFAULT 0 NOT NULL,");
124 strcat(string, "Banned INTEGER DEFAULT 0 NOT NULL,");
125 strcat(string, "BanReason VARCHAR(64),");
126 strcat(string, "BanExpiry INTEGER DEFAULT 0 NOT NULL,");
127 strcat(string, "JailTime INTEGER DEFAULT 0 NOT NULL,");
128 strcat(string, "JailReason VARCHAR(64),");
129 strcat(string, "NMute INTEGER DEFAULT 0 NOT NULL,");
130 strcat(string, "RMute INTEGER DEFAULT 0 NOT NULL,");
131 strcat(string, "AdminLevel INTEGER DEFAULT 0 NOT NULL,");
132 strcat(string, "SecondaryTask INTEGER DEFAULT 0 NOT NULL,");
133 strcat(string, "Money INTEGER DEFAULT 0 NOT NULL,");
134 strcat(string, "PositionX FLOAT DEFAULT 0.0,");
135 strcat(string, "PositionY FLOAT DEFAULT 0.0,");
136 strcat(string, "PositionZ FLOAT DEFAULT 0.0,");
137 strcat(string, "FacingAngle FLOAT DEFAULT 0.0,");
138 strcat(string, "Interior INTEGER DEFAULT 0 NOT NULL,");
139 strcat(string, "VirtualWorld INTEGER DEFAULT 0 NOT NULL,");
140 strcat(string, "Health FLOAT DEFAULT 0.0,");
141 strcat(string, "Armour FLOAT DEFAULT 0.0,");
142 strcat(string, "Skin INTEGER DEFAULT 0 NOT NULL)");
143 db_query(Database, string);
144
145 format(string, sizeof(string), "");
146 strcat(string, "CREATE TABLE IF NOT EXISTS Doors(");
147 strcat(string, "TITLE VARCHAR(24),");
148 strcat(string, "EXTERIOR_POSX FLOAT DEFAULT 0.0,");
149 strcat(string, "EXTERIOR_POSY FLOAT DEFAULT 0.0,");
150 strcat(string, "EXTERIOR_POSZ FLOAT DEFAULT 0.0,");
151 strcat(string, "EXTERIOR_INT INTEGER DEFAULT 0 NOT NULL,");
152 strcat(string, "EXTERIOR_VW INTEGER DEFAULT 0 NOT NULL,");
153 strcat(string, "EXTERIOR_ANGLE FLOAT DEFAULT 0.0,");
154 strcat(string, "INTERIOR_POSX FLOAT DEFAULT 0.0,");
155 strcat(string, "INTERIOR_POSY FLOAT DEFAULT 0.0,");
156 strcat(string, "INTERIOR_POSZ FLOAT DEFAULT 0.0,");
157 strcat(string, "INTERIOR_INT INTEGER DEFAULT 0 NOT NULL,");
158 strcat(string, "INTERIOR_VW INTEGER DEFAULT 0 NOT NULL,");
159 strcat(string, "INTERIOR_ANGLE FLOAT DEFAULT 0.0)");
160 db_query(Database, string);
161
162 format(string, sizeof(string), "");
163 strcat(string, "CREATE TABLE IF NOT EXISTS Groups(");
164 strcat(string, "Name VARCHAR(24),");
165 strcat(string, "Type INTEGER DEFAULT 0 NOT NULL,");
166 strcat(string, "Rank0 INTEGER DEFAULT 0 NOT NULL,");
167 strcat(string, "Rank1 INTEGER DEFAULT 0 NOT NULL,");
168 strcat(string, "Rank2 INTEGER DEFAULT 0 NOT NULL,");
169 strcat(string, "Rank3 INTEGER DEFAULT 0 NOT NULL,");
170 strcat(string, "Rank4 INTEGER DEFAULT 0 NOT NULL,");
171 strcat(string, "Rank5 INTEGER DEFAULT 0 NOT NULL,");
172 strcat(string, "Rank6 INTEGER DEFAULT 0 NOT NULL)");
173 db_query(Database, string);
174
175 EnableStuntBonusForAll(0);
176 SetNameTagDrawDistance(15.0);
177 ShowPlayerMarkers(0);
178 DisableInteriorEnterExits();
179
180 LoadTextdraws();
181
182 gettime(WorldTime[0], WorldTime[1], WorldTime[2]);
183 SetWorldTime(WorldTime[0]);
184 return 1;
185}
186
187public OnGameModeExit()
188{
189 db_close(Database);
190 return 1;
191}