From ef11026195dcc497237f6c530f456e310bec68c2 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Mon, 19 Jul 2004 14:33:17 +0000 Subject: [PATCH] removed WON support fixed some bugs --- plugins/admin.sma | 41 +++---- plugins/admincmd.sma | 28 +---- plugins/adminslots.sma | 17 +-- plugins/antiflood.sma | 2 +- plugins/csstats.sma | 2 +- plugins/miscstats.sma | 2 +- plugins/restmenu.sma | 242 +++++++++++++++-------------------------- 7 files changed, 105 insertions(+), 229 deletions(-) diff --git a/plugins/admin.sma b/plugins/admin.sma index 559d60d4..32af122c 100755 --- a/plugins/admin.sma +++ b/plugins/admin.sma @@ -47,9 +47,7 @@ new g_aName[MAX_ADMINS][32] new g_aFlags[MAX_ADMINS] new g_aAccess[MAX_ADMINS] new g_aNum = 0 -#if !defined NO_STEAM new g_cmdLoopback[16] -#endif public plugin_init() { @@ -84,12 +82,10 @@ public plugin_init() register_concmd("amx_reloadadmins","cmdReload",ADMIN_ADMIN) -#if !defined NO_STEAM format( g_cmdLoopback, 15, "amxauth%c%c%c%c" , random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') ) register_clcmd( g_cmdLoopback, "ackSignal" ) -#endif remove_user_flags(0,read_flags("z")) // Remove 'user' flag from server rights @@ -149,32 +145,32 @@ public adminSql() { get_cvar_string("amx_sql_pass",pass,31) get_cvar_string("amx_sql_db",db,31) - new sql = dbi_connect(host,user,pass,db,error,127) - if(sql < 1){ + new Sql:sql = dbi_connect(host,user,pass,db,error,127) + if (sql <= SQL_FAILED) { server_print("[AMXX] SQL error: can't connect: '%s'",error) return PLUGIN_HANDLED } dbi_query(sql,"CREATE TABLE IF NOT EXISTS admins ( auth varchar(32) NOT NULL default '', password varchar(32) NOT NULL default '', access varchar(32) NOT NULL default '', flags varchar(32) NOT NULL default '' )") - new Result = dbi_query(sql,"SELECT auth,password,access,flags FROM admins") + new Result:Res = dbi_query(sql,"SELECT auth,password,access,flags FROM admins") - if(Result < 0) { + if (rescode(Res) < 0) { dbi_error(sql,error,127) server_print("[AMXX] SQL error: can't load admins: '%s'",error) return PLUGIN_HANDLED - } else if (Result == 0) { - server_print("[AMXX] No admins found.") + } else if (rescode(Res) == 0) { + server_print("[AMXX] No admins found.") } new szFlags[32],szAccess[32] g_aNum = 0 - while( dbi_nextrow(sql) > 0 ) + while( dbi_nextrow(Res) > 0 ) { - dbi_result(Result, "auth", g_aName[ g_aNum ] ,31) - dbi_result(Result, "password", g_aPassword[ g_aNum ] ,31) - dbi_result(Result, "access", szAccess,31) - dbi_result(Result, "flags", szFlags,31) + dbi_result(Res, "auth", g_aName[ g_aNum ] ,31) + dbi_result(Res, "password", g_aPassword[ g_aNum ] ,31) + dbi_result(Res, "access", szAccess,31) + dbi_result(Res, "flags", szFlags,31) if ( (containi(szAccess,"z")==-1) && (containi(szAccess,"y")==-1) ) szAccess[strlen(szAccess)] = 'y' @@ -188,7 +184,7 @@ public adminSql() { } server_print("[AMXX] Loaded %d admin%s from database",g_aNum, (g_aNum == 1) ? "" : "s" ) - dbi_free_result(Result) + dbi_free_result(Res) dbi_close(sql) return PLUGIN_HANDLED } @@ -307,13 +303,7 @@ accessUser( id, name[] = "" ) new result = getAccess(id,username,userauthid,userip,password) if (result & 1) client_cmd(id,"echo ^"* Invalid Password!^"") if (result & 2) { - -#if !defined NO_STEAM - client_cmd(id,g_cmdLoopback) -#else - client_cmd(id,"echo ^"* You have no entry to the server...^";disconnect") -#endif - + client_cmd(id,g_cmdLoopback) return PLUGIN_HANDLED } if (result & 4) client_cmd(id,"echo ^"* Password accepted^"") @@ -336,13 +326,8 @@ public client_infochanged(id) return PLUGIN_CONTINUE } -#if !defined NO_STEAM - public ackSignal(id) server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id) ) public client_authorized(id) -#else -public client_connect(id) -#endif return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 7a3b2272..b3fa5e0d 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -100,17 +100,10 @@ public cmdKick(id,level,cid){ server_cmd("kick #%d",userid2) else { -#if !defined NO_STEAM if (reason[0]) server_cmd("kick #%d ^"%s^"",userid2,reason) else server_cmd("kick #%d",userid2) -#else - if (reason[0]) - client_cmd(player,"echo ^"Kicked: Reason: %s^";disconnect",reason) - else - client_cmd(player,"echo ^"Kicked^";disconnect",reason) -#endif } console_print(id,"[AMXX] Client ^"%s^" kicked",name2) return PLUGIN_HANDLED @@ -203,33 +196,18 @@ public cmdBan(id,level,cid){ if ( equal(mode,"ip") ){ new address[32] get_user_ip(player,address,31,1) -#if !defined NO_STEAM + if (reason[0]) server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address) else server_cmd("kick #%d ^"banned %s^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,temp,minutes,address) -#else - if (reason[0]) - client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp) - else - client_cmd(player,"echo ^"banned %s^";disconnect",temp) - server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,address) -#endif } else { -#if !defined NO_STEAM if (reason[0]) server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2) else server_cmd("kick #%d ^"banned %s^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,temp,minutes,authid2) -#else - if (reason[0]) - client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp) - else - client_cmd(player,"echo ^"banned %s^";disconnect",temp) - server_cmd("banid ^"%s^" ^"%s^";wait;writeip",minutes,authid2) -#endif } new activity = get_cvar_num("amx_show_activity") @@ -606,11 +584,7 @@ public cmdLeave(id,level,cid){ server_cmd("kick #%d",get_user_userid(b)) else { -#if !defined NO_STEAM server_cmd("kick #%d ^"You have been dropped because admin has left only specified group of clients^"",get_user_userid(b)) -#else - client_cmd(b,"echo * You have been dropped because admin has left only specified group of clients;disconnect") -#endif } count++ } diff --git a/plugins/adminslots.sma b/plugins/adminslots.sma index 6d9b649e..ce1208bf 100755 --- a/plugins/adminslots.sma +++ b/plugins/adminslots.sma @@ -38,31 +38,23 @@ // Comment if you don't want to hide not used reserved slots #define HIDE_RESERVED_SLOTS -#if !defined NO_STEAM new g_cmdLoopback[16] -#endif public plugin_init() { register_plugin("Slots Reservation","0.20","AMXX Dev Team") register_cvar("amx_reservation","1") -#if !defined NO_STEAM format( g_cmdLoopback, 15, "amxres%c%c%c%c" , random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') ) register_clcmd( g_cmdLoopback, "ackSignal" ) -#endif } -#if !defined NO_STEAM public ackSignal(id) server_cmd("kick #%d ^"Dropped due to slot reservation^"", get_user_userid(id) ) public client_authorized(id) -#else -public client_connect(id) -#endif { new maxplayers = get_maxplayers() new players = get_playersnum( 1 ) @@ -76,14 +68,7 @@ public client_connect(id) return PLUGIN_CONTINUE } -#if !defined NO_STEAM client_cmd(id,g_cmdLoopback) -#else - if ( is_user_bot(id) ) - server_cmd("kick #%d", get_user_userid(id) ) - else - client_cmd(id,"echo ^"Dropped due to slot reservation^";disconnect") -#endif return PLUGIN_HANDLED } @@ -105,7 +90,7 @@ setVisibleSlots( players , maxplayers , limit ) num = maxplayers else if ( players < limit ) num = limit - + set_cvar_num( "sv_visiblemaxplayers" , num ) } #endif \ No newline at end of file diff --git a/plugins/antiflood.sma b/plugins/antiflood.sma index f16030c9..6ae4f263 100755 --- a/plugins/antiflood.sma +++ b/plugins/antiflood.sma @@ -34,7 +34,7 @@ #include -new Float:g_Flooding[33] = {0, ...} +new Float:g_Flooding[33] = {0.0, ...} new g_Flood[33] = {0, ...} public plugin_init() diff --git a/plugins/csstats.sma b/plugins/csstats.sma index c90c156e..82f3aecf 100755 --- a/plugins/csstats.sma +++ b/plugins/csstats.sma @@ -32,7 +32,7 @@ * version. */ -/* File location: $moddir/addons/amxx/plugins/csstats.amx */ +/* File location: $moddir/addons/amxx/data/csstats.amx */ #include diff --git a/plugins/miscstats.sma b/plugins/miscstats.sma index ac645140..8580a1f9 100755 --- a/plugins/miscstats.sma +++ b/plugins/miscstats.sma @@ -127,7 +127,7 @@ new g_HeMessages[4][] = { new g_SHeMessages[4][] = { "%s detonated himself with a grenade", "%s trys the effect of an HE Grenade", - "%s swallows grenades whole!, + "%s swallows grenades whole!", "%s explodes!" } new g_HeadShots[7][] = { diff --git a/plugins/restmenu.sma b/plugins/restmenu.sma index d117206b..95897204 100755 --- a/plugins/restmenu.sma +++ b/plugins/restmenu.sma @@ -38,11 +38,7 @@ #include #include -#if !defined NO_STEAM #define MAXMENUPOS 34 -#else -#define MAXMENUPOS 31 -#endif new g_Position[33] new g_Modified @@ -50,41 +46,35 @@ new g_blockPos[112] new g_saveFile[64] new g_Restricted[] = "* This item is restricted *" new g_menusNames[7][] = { -"pistol", -"shotgun", -"sub", -"rifle", -"machine", -"equip", -"ammo" + "pistol", + "shotgun", + "sub", + "rifle", + "machine", + "equip", + "ammo" } new g_MenuTitle[7][] = { -"Handguns", -"Shotguns", -"Sub-Machine Guns", -"Assault & Sniper Rifles", -"Machine Guns", -"Equipment", -"Ammunition" + "Handguns", + "Shotguns", + "Sub-Machine Guns", + "Assault & Sniper Rifles", + "Machine Guns", + "Equipment", + "Ammunition" } new g_menusSets[7][2] = { -#if !defined NO_STEAM -{0,6},{6,8},{8,13},{13,23},{23,24},{24,32},{32,34} -#else -{0,6},{6,8},{8,13},{13,21},{21,22},{22,29},{29,31} -#endif + {0,6},{6,8},{8,13},{13,23},{23,24},{24,32},{32,34} } -#if !defined NO_STEAM + new g_AliasBlockNum new g_AliasBlock[MAXMENUPOS] -#endif // First position is a position of menu (0 for ammo, 1 for pistols, 6 for equipment etc.) // Second is a key for TERRORIST (all is key are minus one, 1 is 0, 2 is 1 etc.) // Third is a key for CT // Position with -1 doesn't exist new g_Keys[MAXMENUPOS][3] = { -#if !defined NO_STEAM {1,1,1}, // H&K USP .45 Tactical {1,0,0}, // Glock18 Select Fire {1,3,3}, // Desert Eagle .50AE @@ -119,39 +109,6 @@ new g_Keys[MAXMENUPOS][3] = { {6,-1,7}, // Tactical Shield {0,5,5}, // Primary weapon ammo {0,6,6} // Secondary weapon ammo -#else - {1,0,0}, // H&K USP .45 Tactical - {1,1,1}, // Glock18 Select Fire - {1,2,2}, // Desert Eagle .50AE - {1,3,3}, // SIG P228 - {1,4,-1}, // Dual Beretta 96G Elite - {1,-1,5}, // FN Five-Seven - {2,0,0}, // Benelli M3 Super90 - {2,1,1}, // Benelli XM1014 - {3,0,0}, // H&K MP5-Navy - {3,-1,1}, // Steyr Tactical Machine Pistol - {3,2,2}, // FN P90 - {3,3,-1}, // Ingram MAC-10 - {3,4,4}, // H&K UMP45 - {4,0,-1}, // AK-47 - {4,1,-1}, // Sig SG-552 Commando - {4,-1,2}, // Colt M4A1 Carbine - {4,-1,3}, // Steyr Aug - {4,4,4}, // Steyr Scout - {4,5,5}, // AI Arctic Warfare/Magnum - {4,6,-1}, // H&K G3/SG-1 Sniper Rifle - {4,-1,7}, // Sig SG-550 Sniper - {5,0,0}, // FN M249 Para - {6,0,0}, // Kevlar Vest - {6,1,1}, // Kevlar Vest & Helmet - {6,2,2}, // Flashbang - {6,3,3}, // HE Grenade - {6,4,4}, // Smoke Grenade - {6,-1,5}, // Defuse Kit - {6,6,6}, // NightVision Goggles - {0,5,5}, // Primary weapon ammo - {0,6,6} // Secondary weapon ammo -#endif } new g_WeaponNames[MAXMENUPOS][] = { @@ -169,10 +126,8 @@ new g_WeaponNames[MAXMENUPOS][] = { "Ingram MAC-10", "H&K UMP45", "AK-47", -#if !defined NO_STEAM "Gali", "Famas", -#endif "Sig SG-552 Commando", "Colt M4A1 Carbine", "Steyr Aug", @@ -188,9 +143,7 @@ new g_WeaponNames[MAXMENUPOS][] = { "Smoke Grenade", "Defuse Kit", "NightVision Goggles", -#if !defined NO_STEAM "Tactical Shield", -#endif "Primary weapon ammo", "Secondary weapon ammo" } @@ -213,10 +166,8 @@ new g_MenuItem[MAXMENUPOS][] = { "%d. %s\y\R%s^n\w^n", "\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w", -#if !defined NO_STEAM "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w", -#endif "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w^n", @@ -234,111 +185,101 @@ new g_MenuItem[MAXMENUPOS][] = { "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w", -#if !defined NO_STEAM "%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w^n", -#else - "%d. %s\y\R%s^n\w^n", -#endif "\yAmmunition^n\w^n%d. %s\y\R%s^n\w", "%d. %s\y\R%s^n\w" } new g_Aliases[MAXMENUPOS][] = { -"usp",//Pistols -"glock", -"deagle", -"p228", -"elites", -"fn57", + "usp", //Pistols + "glock", + "deagle", + "p228", + "elites", + "fn57", -"m3",//Shotguns -"xm1014", + "m3", //Shotguns + "xm1014", -"mp5",//SMG -"tmp", -"p90", -"mac10", -"ump45", + "mp5", //SMG + "tmp", + "p90", + "mac10", + "ump45", -"ak47",//Rifles -#if !defined NO_STEAM -"galil", -"famas", -#endif -"sg552", -"m4a1", -"aug", -"scout", -"awp", -"g3sg1", -"sg550", + "ak47", //Rifles + "galil", + "famas", + "sg552", + "m4a1", + "aug", + "scout", + "awp", + "g3sg1", + "sg550", -"m249", //Machine Gun + "m249", //Machine Gun -"vest",//Equipment -"vesthelm", -"flash", -"hegren", -"sgren", -"defuser", -"nvgs", -#if !defined NO_STEAM -"shield", -#endif -"primammo",//Ammo -"secammo" + "vest", //Equipment + "vesthelm", + "flash", + "hegren", + "sgren", + "defuser", + "nvgs", + "shield", + + "primammo", //Ammo + "secammo" } -#if !defined NO_STEAM new g_Aliases2[MAXMENUPOS][] = { -"km45",//Pistols -"9x19mm", -"nighthawk", -"228compact", -"elites", -"fiveseven", + "km45", //Pistols + "9x19mm", + "nighthawk", + "228compact", + "elites", + "fiveseven", -"12gauge",//Shotguns -"autoshotgun", + "12gauge", //Shotguns + "autoshotgun", -"smg",//SMG -"mp", -"c90", -"mac10", -"ump45", + "smg", //SMG + "mp", + "c90", + "mac10", + "ump45", -"cv47",//Rifles -"defender", -"clarion", -"krieg552", -"m4a1", -"bullpup", -"scout", -"magnum", -"d3au1", -"krieg550", + "cv47", //Rifles + "defender", + "clarion", + "krieg552", + "m4a1", + "bullpup", + "scout", + "magnum", + "d3au1", + "krieg550", -"m249", //Machine Gun + "m249", //Machine Gun -"vest",//Equipment -"vesthelm", -"flash", -"hegren", -"sgren", -"defuser", -"nvgs", -"shield", -"primammo",//Ammo -"secammo" + "vest", //Equipment + "vesthelm", + "flash", + "hegren", + "sgren", + "defuser", + "nvgs", + "shield", + "primammo", //Ammo + "secammo" } -#endif -#if !defined NO_STEAM + #define AUTOBUYLENGTH 511 new g_Autobuy[33][AUTOBUYLENGTH + 1] //new g_Rebuy[33][AUTOBUYLENGTH + 1] -#endif setWeapon( a , action ){ new b, m = g_Keys[a][0] * 8 @@ -356,7 +297,7 @@ setWeapon( a , action ){ else g_blockPos[ b ] = action } -#if !defined NO_STEAM + for(new i = 0; i < g_AliasBlockNum; ++i) if ( g_AliasBlock[ i ] == a ){ if ( !action || action == 2 ) { @@ -368,7 +309,6 @@ setWeapon( a , action ){ } if ( action && g_AliasBlockNum < MAXMENUPOS ) g_AliasBlock[ g_AliasBlockNum++ ] = a -#endif } findMenuId( name[] ){ @@ -532,7 +472,6 @@ public actionMenu(id,key){ return PLUGIN_HANDLED } -#if !defined NO_STEAM public client_command( id ){ if ( g_AliasBlockNum ) { new arg[13] @@ -569,14 +508,11 @@ stock WeaponIsBlocked(weapon[]) { return false // not blocked } -#endif -#if !defined NO_STEAM public blockcommand(id) { client_print(id,print_center, g_Restricted ) return PLUGIN_HANDLED } -#endif public cmdMenu(id,level,cid){ if (cmd_access(id,level,cid,1)) @@ -632,7 +568,6 @@ loadSettings(filename[]){ return 1 } -#if !defined NO_STEAM // JGHG public fn_setautobuy(id) { // Don't do anything if no items are blocked. @@ -751,18 +686,15 @@ public fn_setrebuy(id) { public fn_rebuy(id) { } */ -#endif // !NO_STEAM public plugin_init() { register_plugin("Restrict Weapons","0.20","AMXX Dev Team") register_clcmd("buyammo1","ammoRest1") register_clcmd("buyammo2","ammoRest2") -#if !defined NO_STEAM register_clcmd("cl_setautobuy", "fn_setautobuy") register_clcmd("cl_autobuy", "fn_autobuy") //register_clcmd("cl_setrebuy", "fn_setrebuy") //register_clcmd("cl_rebuy", "fn_rebuy") -#endif register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu") register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy") register_menucmd(register_menuid("\yRestrict Weapons"),1023,"actionMenu")