Skip to content

Commit

Permalink
set versions
Browse files Browse the repository at this point in the history
  • Loading branch information
B3none committed Jun 7, 2019
1 parent 1d84588 commit b78af42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
43 changes: 15 additions & 28 deletions scripting/league_matches.sp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ Handle db;
public Plugin myinfo = {
name = "[League] Matches",
author = "B3none",
description = "Save the scoreboard.",
version = "1.0.1",
description = "League scoreboard saving system.",
version = "1.0.0",
url = "https://github.com/b3none/csgo-league-game"
};

public void OnPluginStart()
{
public void OnPluginStart() {
char buffer[1024];

if ((db = SQL_Connect("league", true, buffer, sizeof(buffer))) == null)
{
if ((db = SQL_Connect("league", true, buffer, sizeof(buffer))) == null) {
SetFailState(buffer);
}

Expand All @@ -40,8 +38,7 @@ public void OnPluginStart()
Format(buffer, sizeof(buffer), "%s PRIMARY KEY (match_id),", buffer);
Format(buffer, sizeof(buffer), "%s UNIQUE KEY match_id (match_id));", buffer);

if (!SQL_FastQuery(db, buffer))
{
if (!SQL_FastQuery(db, buffer)) {
SQL_GetError(db, buffer, sizeof(buffer));
SetFailState(buffer);
}
Expand All @@ -60,22 +57,19 @@ public void OnPluginStart()
Format(buffer, sizeof(buffer), "%s mvps int(11) NOT NULL,", buffer);
Format(buffer, sizeof(buffer), "%s score int(11) NOT NULL);", buffer);

if (!SQL_FastQuery(db, buffer))
{
if (!SQL_FastQuery(db, buffer)) {
SQL_GetError(db, buffer, sizeof(buffer));
SetFailState(buffer);
}

HookEventEx("cs_win_panel_match", cs_win_panel_match);
}

public void cs_win_panel_match(Handle event, const char[] eventname, bool dontBroadcast)
{
public void cs_win_panel_match(Handle event, const char[] eventname, bool dontBroadcast) {
CreateTimer(0.1, delay, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action delay(Handle timer)
{
public Action delay(Handle timer) {
Transaction txn = SQL_CreateTransaction();

char mapname[128];
Expand All @@ -94,8 +88,7 @@ public Action delay(Handle timer)

int ent = MaxClients + 1;

while ((ent = FindEntityByClassname(ent, "cs_team_manager")) != -1)
{
while ((ent = FindEntityByClassname(ent, "cs_team_manager")) != -1) {
Format(buffer, sizeof(buffer), "UPDATE sql_matches_scoretotal SET team_%i = %i WHERE match_id = LAST_INSERT_ID();", GetEntProp(ent, Prop_Send, "m_iTeamNum"), GetEntProp(ent, Prop_Send, "m_scoreTotal"));
SQL_AddQuery(txn, buffer);
}
Expand All @@ -113,12 +106,9 @@ public Action delay(Handle timer)
int m_iMVPs;
int m_iScore;

if ((ent = FindEntityByClassname(-1, "cs_player_manager")) != -1)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i))
{
if ((ent = FindEntityByClassname(-1, "cs_player_manager")) != -1) {
for (int i = 1; i <= MaxClients; i++) {
if (!IsClientInGame(i)) {
continue;
}

Expand All @@ -135,8 +125,7 @@ public Action delay(Handle timer)
Format(name, MAX_NAME_LENGTH, "%N", i);
SQL_EscapeString(db, name, name, sizeof(name));

if (!GetClientAuthId(i, AuthId_SteamID64, steamid64, sizeof(steamid64)))
{
if (!GetClientAuthId(i, AuthId_SteamID64, steamid64, sizeof(steamid64))) {
steamid64[0] = '\0';
}

Expand All @@ -150,12 +139,10 @@ public Action delay(Handle timer)
SQL_ExecuteTransaction(db, txn);
}

public void onSuccess(Database database, any data, int numQueries, Handle[] results, any[] bufferData)
{
public void onSuccess(Database database, any data, int numQueries, Handle[] results, any[] bufferData) {
PrintToServer("onSuccess");
}

public void onError(Database database, any data, int numQueries, const char[] error, int failIndex, any[] queryData)
{
public void onError(Database database, any data, int numQueries, const char[] error, int failIndex, any[] queryData) {
PrintToServer("onError");
}
5 changes: 3 additions & 2 deletions scripting/league_ranking.sp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

#define SENDER_WORLD 0
#define MAX_LENGTH_MENU 470
#define PLUGIN_VERSION "1.0.2"

#define PLUGIN_VERSION "1.0.0"

public Plugin myinfo = {
name = "[League] Ranking",
author = "B3none, Kento",
description = "CSGO ranking and statistics",
description = "League ranking plugin.",
version = PLUGIN_VERSION,
url = "https://github.com/csgo-league"
};
Expand Down

0 comments on commit b78af42

Please sign in to comment.