Skip to content

Commit

Permalink
Merge branch 'release/v1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kgns committed Nov 20, 2019
2 parents 072cc40 + eab65ef commit 2d4cb44
Show file tree
Hide file tree
Showing 37 changed files with 10,628 additions and 1,043 deletions.
387 changes: 351 additions & 36 deletions addons/sourcemod/configs/weapons/weapons_brazilian.cfg

Large diffs are not rendered by default.

385 changes: 350 additions & 35 deletions addons/sourcemod/configs/weapons/weapons_bulgarian.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_czech.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_danish.cfg

Large diffs are not rendered by default.

357 changes: 336 additions & 21 deletions addons/sourcemod/configs/weapons/weapons_dutch.cfg

Large diffs are not rendered by default.

627 changes: 471 additions & 156 deletions addons/sourcemod/configs/weapons/weapons_english.cfg

Large diffs are not rendered by default.

359 changes: 337 additions & 22 deletions addons/sourcemod/configs/weapons/weapons_finnish.cfg

Large diffs are not rendered by default.

371 changes: 343 additions & 28 deletions addons/sourcemod/configs/weapons/weapons_french.cfg

Large diffs are not rendered by default.

373 changes: 344 additions & 29 deletions addons/sourcemod/configs/weapons/weapons_german.cfg

Large diffs are not rendered by default.

361 changes: 338 additions & 23 deletions addons/sourcemod/configs/weapons/weapons_greek.cfg

Large diffs are not rendered by default.

379 changes: 347 additions & 32 deletions addons/sourcemod/configs/weapons/weapons_hungarian.cfg

Large diffs are not rendered by default.

373 changes: 344 additions & 29 deletions addons/sourcemod/configs/weapons/weapons_italian.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_japanese.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_korean.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_koreana.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_latam.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_norwegian.cfg

Large diffs are not rendered by default.

371 changes: 343 additions & 28 deletions addons/sourcemod/configs/weapons/weapons_polish.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_portuguese.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_romanian.cfg

Large diffs are not rendered by default.

391 changes: 353 additions & 38 deletions addons/sourcemod/configs/weapons/weapons_russian.cfg

Large diffs are not rendered by default.

389 changes: 352 additions & 37 deletions addons/sourcemod/configs/weapons/weapons_schinese.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_schinese_pw.cfg

Large diffs are not rendered by default.

371 changes: 343 additions & 28 deletions addons/sourcemod/configs/weapons/weapons_spanish.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_swedish.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_tchinese.cfg

Large diffs are not rendered by default.

353 changes: 334 additions & 19 deletions addons/sourcemod/configs/weapons/weapons_thai.cfg

Large diffs are not rendered by default.

637 changes: 476 additions & 161 deletions addons/sourcemod/configs/weapons/weapons_turkish.cfg

Large diffs are not rendered by default.

387 changes: 351 additions & 36 deletions addons/sourcemod/configs/weapons/weapons_ukrainian.cfg

Large diffs are not rendered by default.

355 changes: 335 additions & 20 deletions addons/sourcemod/configs/weapons/weapons_vietnamese.cfg

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/weapons.sp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Plugin myinfo =
name = "Weapons & Knives",
author = "kgns | oyunhost.net",
description = "All in one weapon skin management",
version = "1.4.2",
version = "1.5.0",
url = "https://www.oyunhost.net"
};

Expand Down
143 changes: 110 additions & 33 deletions addons/sourcemod/scripting/weapons/database.sp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,32 @@ void CreateMainTable(bool mysql, bool recreate = false)
knife_css_trak int(1) NOT NULL DEFAULT '0', \
knife_css_trak_count int(10) NOT NULL DEFAULT '0', \
knife_css_tag varchar(256) NOT NULL DEFAULT '', \
knife_css_seed int(10) NOT NULL DEFAULT '-1')");
knife_css_seed int(10) NOT NULL DEFAULT '-1', \
knife_cord int(4) NOT NULL DEFAULT '0', \
knife_cord_float decimal(3,2) NOT NULL DEFAULT '0.0', \
knife_cord_trak int(1) NOT NULL DEFAULT '0', \
knife_cord_trak_count int(10) NOT NULL DEFAULT '0', \
knife_cord_tag varchar(256) NOT NULL DEFAULT '', ");
index += FormatEx(createQuery[index], sizeof(createQuery) - index, " \
knife_cord_seed int(10) NOT NULL DEFAULT '-1', \
knife_canis int(4) NOT NULL DEFAULT '0', \
knife_canis_float decimal(3,2) NOT NULL DEFAULT '0.0', \
knife_canis_trak int(1) NOT NULL DEFAULT '0', \
knife_canis_trak_count int(10) NOT NULL DEFAULT '0', \
knife_canis_tag varchar(256) NOT NULL DEFAULT '', \
knife_canis_seed int(10) NOT NULL DEFAULT '-1', \
knife_outdoor int(4) NOT NULL DEFAULT '0', \
knife_outdoor_float decimal(3,2) NOT NULL DEFAULT '0.0', \
knife_outdoor_trak int(1) NOT NULL DEFAULT '0', \
knife_outdoor_trak_count int(10) NOT NULL DEFAULT '0', \
knife_outdoor_tag varchar(256) NOT NULL DEFAULT '', \
knife_outdoor_seed int(10) NOT NULL DEFAULT '-1', \
knife_skeleton int(4) NOT NULL DEFAULT '0', \
knife_skeleton_float decimal(3,2) NOT NULL DEFAULT '0.0', \
knife_skeleton_trak int(1) NOT NULL DEFAULT '0', \
knife_skeleton_trak_count int(10) NOT NULL DEFAULT '0', \
knife_skeleton_tag varchar(256) NOT NULL DEFAULT '', \
knife_skeleton_seed int(10) NOT NULL DEFAULT '-1')");

if (mysql)
{
Expand Down Expand Up @@ -570,6 +595,18 @@ public void T_DropOldTableCallback(Database database, DBResultSet results, const
else
{
LogMessage("%s Old table has been dropped successfully", (mysql ? "MySQL" : "SQLite"));
if(++g_iDatabaseState > 1)
{
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && IsClientAuthorized(i))
{
OnClientPostAdminCheck(i);
}
}
DeleteInactivePlayerData();
}
}
}

Expand All @@ -581,14 +618,8 @@ public void T_CreateMainTableCallback(Database database, DBResultSet results, co
}
else
{
AddWeaponColumns("knife_ursus", false);
AddWeaponColumns("knife_gypsy_jackknife", false);
AddWeaponColumns("knife_stiletto", false);
AddWeaponColumns("knife_widowmaker", false);
AddWeaponColumns("mp5sd", false);
AddWeaponColumns("knife_css");

addSeedColumns(mysql);
g_iMigrationStep = 0;
AddWeaponColumns(mysql, "knife_ursus", false);

char createQuery[512];
Format(createQuery, sizeof(createQuery), " \
Expand Down Expand Up @@ -686,6 +717,21 @@ public void T_SeedColumnCallback(Database database, DBResultSet results, const c
db.Query(T_RenameCallback, renameQuery, mysql, DBPrio_High);
}
}
else
{
if(++g_iDatabaseState > 1)
{
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && IsClientAuthorized(i))
{
OnClientPostAdminCheck(i);
}
}
DeleteInactivePlayerData();
}
}
}

public void T_RenameCallback(Database database, DBResultSet results, const char[] error, bool mysql)
Expand All @@ -709,51 +755,83 @@ public void T_SeedConfirmationCallback(Database database, DBResultSet results, c
else
{
LogMessage("Successfully created seed columns");
if(++g_iDatabaseState > 1)
{
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && IsClientAuthorized(i))
{
OnClientPostAdminCheck(i);
}
}
DeleteInactivePlayerData();
}
}
}

void AddWeaponColumns(const char[] weapon, bool seedColumn = true)
void AddWeaponColumns(bool mysql, const char[] weapon, bool seedColumn = true)
{
Transaction txn = new Transaction();
char query[512];

SQL_LockDatabase(db);

Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s int(4) NOT NULL DEFAULT '0'", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s_float decimal(3,2) NOT NULL DEFAULT '0.0'", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s_trak int(1) NOT NULL DEFAULT '0'", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s_trak_count int(10) NOT NULL DEFAULT '0'", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s_tag varchar(256) NOT NULL DEFAULT ''", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
if (seedColumn)
{
Format(query, sizeof(query), "ALTER TABLE %sweapons ADD %s_seed int(10) NOT NULL DEFAULT '-1'", g_TablePrefix, weapon);
SQL_FastQuery(db, query);
txn.AddQuery(query);
}
db.Execute(txn, Txn_OnSucess, Txn_OnFail, mysql);
}

public void Txn_OnSucess(Database database, bool mysql, int numQueries, DBResultSet[] results, any[] queryData)
{
if(++g_iMigrationStep >= sizeof(g_MigrationWeapons))
{
addSeedColumns(mysql);
}
else
{
AddWeaponColumns(mysql, g_MigrationWeapons[g_iMigrationStep], g_iMigrationStep > 4);
}
}

public void Txn_OnFail(Database database, bool mysql, int numQueries, const char[] error, int failIndex, any[] queryData)
{
if(++g_iMigrationStep >= sizeof(g_MigrationWeapons))
{
addSeedColumns(mysql);
}
else
{
AddWeaponColumns(mysql, g_MigrationWeapons[g_iMigrationStep], g_iMigrationStep > 4);
}

SQL_UnlockDatabase(db);
}

public void T_CreateTimestampTableCallback(Database database, DBResultSet results, const char[] error, bool mysql)
{
if (results == null)
{
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
if(++g_iDatabaseState > 1)
{
if(IsClientInGame(i))
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
{
OnClientPutInServer(i);
if(IsClientAuthorized(i))
if(IsClientInGame(i) && IsClientAuthorized(i))
{
OnClientPostAdminCheck(i);
}
}
DeleteInactivePlayerData();
}
DeleteInactivePlayerData();
}
else
{
Expand All @@ -774,19 +852,18 @@ public void T_InsertTimestampsCallback(Database database, DBResultSet results, c
}
else
{
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
if(++g_iDatabaseState > 1)
{
if(IsClientInGame(i))
LogMessage("%s DB connection successful", (mysql ? "MySQL" : "SQLite"));
for(int i = 1; i <= MaxClients; i++)
{
OnClientPutInServer(i);
if(IsClientAuthorized(i))
if(IsClientInGame(i) && IsClientAuthorized(i))
{
OnClientPostAdminCheck(i);
}
}
DeleteInactivePlayerData();
}
DeleteInactivePlayerData();
}
}

Expand Down
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/weapons/forwards.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void OnConfigsExecuted()

if(db == null)
{
g_iDatabaseState = 0;
Database.Connect(SQLConnectCallback, g_DBConnection);
}
else
Expand Down Expand Up @@ -78,7 +79,7 @@ public void OnClientPutInServer(int client)

public void OnClientPostAdminCheck(int client)
{
if(IsValidClient(client))
if(g_iDatabaseState > 1 && IsValidClient(client))
{
char steam32[20];
char temp[20];
Expand Down
21 changes: 19 additions & 2 deletions addons/sourcemod/scripting/weapons/globals.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ char g_WeaponClasses[][] = {
/*18*/ "weapon_m249", /*19*/ "weapon_negev", /*20*/ "weapon_mp9", /*21*/ "weapon_mac10", /*22*/ "weapon_mp7", /*23*/ "weapon_ump45", /*24*/ "weapon_p90", /*25*/ "weapon_bizon", /*26*/ "weapon_famas", /*27*/ "weapon_galilar",
/*28*/ "weapon_ssg08", /*29*/ "weapon_aug", /*30*/ "weapon_sg556", /*31*/ "weapon_scar20", /*32*/ "weapon_g3sg1", /*33*/ "weapon_knife_karambit", /*34*/ "weapon_knife_m9_bayonet", /*35*/ "weapon_bayonet",
/*36*/ "weapon_knife_survival_bowie", /*37*/ "weapon_knife_butterfly", /*38*/ "weapon_knife_flip", /*39*/ "weapon_knife_push", /*40*/ "weapon_knife_tactical", /*41*/ "weapon_knife_falchion", /*42*/ "weapon_knife_gut",
/*43*/ "weapon_knife_ursus", /*44*/ "weapon_knife_gypsy_jackknife", /*45*/ "weapon_knife_stiletto", /*46*/ "weapon_knife_widowmaker", /*47*/ "weapon_mp5sd", /*48*/ "weapon_knife_css"
/*43*/ "weapon_knife_ursus", /*44*/ "weapon_knife_gypsy_jackknife", /*45*/ "weapon_knife_stiletto", /*46*/ "weapon_knife_widowmaker", /*47*/ "weapon_mp5sd", /*48*/ "weapon_knife_css", /*49*/ "weapon_knife_cord",
/*50*/ "weapon_knife_canis", /*51*/ "weapon_knife_outdoor", /*52*/ "weapon_knife_skeleton"
};

int g_iWeaponDefIndex[] = {
Expand All @@ -30,7 +31,8 @@ int g_iWeaponDefIndex[] = {
/*18*/ 14, /*19*/ 28, /*20*/ 34, /*21*/ 17, /*22*/ 33, /*23*/ 24, /*24*/ 19, /*25*/ 26, /*26*/ 10, /*27*/ 13,
/*28*/ 40, /*29*/ 8, /*30*/ 39, /*31*/ 38, /*32*/ 11, /*33*/ 507, /*34*/ 508, /*35*/ 500,
/*36*/ 514, /*37*/ 515, /*38*/ 505, /*39*/ 516, /*40*/ 509, /*41*/ 512, /*42*/ 506,
/*43*/ 519, /*44*/ 520, /*45*/ 522, /*46*/ 523, /*47*/ 23, /*48*/ 503
/*43*/ 519, /*44*/ 520, /*45*/ 522, /*46*/ 523, /*47*/ 23, /*48*/ 503, /*49*/ 517,
/*50*/ 518, /*51*/ 521, /*52*/ 525
};

const int MAX_LANG = 40;
Expand Down Expand Up @@ -96,6 +98,21 @@ int g_iKnife[MAXPLAYERS+1] = { 0, ... };

int g_iRoundStartTime = 0;

int g_iDatabaseState = 0;
int g_iMigrationStep = 0;
char g_MigrationWeapons[][] = {
"knife_ursus",
"knife_gypsy_jackknife",
"knife_stiletto",
"knife_widowmaker",
"mp5sd",
"knife_css",
"knife_cord",
"knife_canis",
"knife_outdoor",
"knife_skeleton"
};

char g_Language[MAX_LANG][32];
int g_iClientLanguage[MAXPLAYERS+1];
Menu menuWeapons[MAX_LANG][sizeof(g_WeaponClasses)];
Expand Down
8 changes: 8 additions & 0 deletions addons/sourcemod/scripting/weapons/menus.sp
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,14 @@ Menu CreateKnifeMenu(int client)
char buffer[60];
Format(buffer, sizeof(buffer), "%T", "OwnKnife", client);
menu.AddItem("0", buffer, g_iKnife[client] != 0 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_cord", client);
menu.AddItem("49", buffer, g_iKnife[client] != 49 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_canis", client);
menu.AddItem("50", buffer, g_iKnife[client] != 50 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_outdoor", client);
menu.AddItem("51", buffer, g_iKnife[client] != 51 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_skeleton", client);
menu.AddItem("52", buffer, g_iKnife[client] != 52 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_css", client);
menu.AddItem("48", buffer, g_iKnife[client] != 48 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
Format(buffer, sizeof(buffer), "%T", "weapon_knife_ursus", client);
Expand Down
16 changes: 16 additions & 0 deletions addons/sourcemod/translations/tr/weapons.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,22 @@
{
"tr" "★ Klasik Bıçak"
}
"weapon_knife_cord"
{
"tr" "★ Paraşüt Kordonu Saplı Bıçak"
}
"weapon_knife_canis"
{
"tr" "★ Hayatta Kalma Bıçağı"
}
"weapon_knife_outdoor"
{
"tr" "★ Göçebe Bıçağı"
}
"weapon_knife_skeleton"
{
"tr" "★ İskelet Bıçak"
}
"weapon_knife_t"
{
"tr" "Bıçak"
Expand Down
16 changes: 16 additions & 0 deletions addons/sourcemod/translations/weapons.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,22 @@
{
"en" "★ Classic Knife"
}
"weapon_knife_cord"
{
"en" "★ Paracord Knife"
}
"weapon_knife_canis"
{
"en" "★ Survival Knife"
}
"weapon_knife_outdoor"
{
"en" "★ Nomad Knife"
}
"weapon_knife_skeleton"
{
"en" "★ Skeleton Knife"
}
"weapon_knife_t"
{
"en" "Knife"
Expand Down

0 comments on commit 2d4cb44

Please sign in to comment.