Raised This Month: $433 Target: $400
 108% 

csgo: problems yranks.smx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KatowADRE
Member
Join Date: Feb 2020
Old 03-22-2020 , 09:59   csgo: problems yranks.smx
Reply With Quote #1

Hello,



I would ask for your help what should I do to eliminate errors

Search Results
Web search results nothing

LOGI SERWER:
Code:
L 03/21/2020 - 00:06:24: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:06:24: [SM] Call stack trace:
L 03/21/2020 - 00:06:24: [SM]   [1] Line 141, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:07:35: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:07:35: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:07:35: [SM] Call stack trace:
L 03/21/2020 - 00:07:35: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:10:10: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:10:10: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:10:10: [SM] Call stack trace:
L 03/21/2020 - 00:10:10: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:10:16: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:10:16: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:10:16: [SM] Call stack trace:
L 03/21/2020 - 00:10:16: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:10:18: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:10:18: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:10:18: [SM] Call stack trace:
L 03/21/2020 - 00:10:18: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:13:06: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:13:06: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:13:06: [SM] Call stack trace:
L 03/21/2020 - 00:13:06: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:13:51: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:13:51: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:13:51: [SM] Call stack trace:
L 03/21/2020 - 00:13:51: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:18:48: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:18:48: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:18:48: [SM] Call stack trace:
L 03/21/2020 - 00:18:48: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:19:54: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:19:54: [SM] Blaming: yRanks.smx
L 03/21/2020 - 00:19:54: [SM] Call stack trace:
L 03/21/2020 - 00:19:54: [SM]   [1] Line 155, D:\Workspace\FFA\yRanks.sp::UpdateStatus
L 03/21/2020 - 00:23:03: [SM] Exception reported: Array index out-of-bounds (index 19, limit 19)
L 03/21/2020 - 00:23:03: [SM] Blaming: yRanks.smx

PLIKS yranks.sp

Code:
/********************************************************

	1.0 - Pierwsze wydanie pluginu.
	1.1 - Dodanie możliwości zmiany wyglądu rang w tabeli.
	1.2 - Optymalizacja kodu, poprawienie komunikatów na chacie pod względem estetycznym, zmiana timera zapisującego dane na akcję w Event_RoundEnd
	1.3 - Dodanie opcji wyłączenia złotych naboi, zmiana kominkatów, ukrywanie opcji przy wyłączonych złotych nabojach.
	1.4 - Dodanie hudu
	
********************************************************/

/* [ Includes ] */
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <multicolors>
#include <clientprefs>
#include <yRanks>

/* [ Compiler Options ] */
#pragma newdecls required
#pragma semicolon 1

/* [ Defines ] */
#define PluginTag		"{lightred}★{darkred} Ranks {lightred}★{default}"
#define Table_Main		"yRanks_Main"
#define Table_Stats		"yRanks_Stats"

/* [ Modules ] */
#include "yRanks/yRanks_Globals.sp"
#include "yRanks/yRanks_Commands.sp"
#include "yRanks/yRanks_Database.sp"
#include "yRanks/yRanks_Events.sp"
#include "yRanks/yRanks_AdminPanel.sp"
#include "yRanks/yRanks_standardActions.sp"
#include "yRanks/yRanks_Helpers.sp"
#include "yRanks/yRanks_Natives.sp"
#include "yRanks/yRanks_Config.sp"

/* [ Plugin Author And Informations ] */
public Plugin myinfo =
{
	name = "[CS:GO] Yamakashi - [ yRanks ]",
	author = Plugin_Author,
	description = Plugin_Description,
	version = "1.4",
	url = Plugin_Url
};

/* [ Plugin Startup ] */
public void OnPluginStart()
{
	/* [ Admin Commands ] */
	RegAdminCmd("sm_ap", AdminPanel_Command, ADMFLAG_ROOT, "Panel Administracyjny");
	RegAdminCmd("sm_adminpanel", AdminPanel_Command, ADMFLAG_ROOT, "Panel Administracyjny");
	RegAdminCmd("sm_reloadcfg", ReloadConfigs_Command, ADMFLAG_ROOT, "Przeładowanie configów");
	
	/* [ Commands ] */
	RegConsoleCmd("sm_ranks", Ranks_Command, "Główne menu rang.");
	RegConsoleCmd("sm_ranga", Ranks_Command, "Główne menu rang.");
	RegConsoleCmd("sm_rangi", Ranks_Command, "Główne menu rang.");
	RegConsoleCmd("sm_rank", Ranks_Command, "Główne menu rang.");
	RegConsoleCmd("sm_sklep", Shop_Command, "Sklep z punktami.");
	RegConsoleCmd("sm_shop", Shop_Command, "Sklep z punktami.");
	RegConsoleCmd("sm_hud", Hud_Command, "Wybór hudu");
	RegConsoleCmd("say", Say_Command);
	RegConsoleCmd("say_team", Say_Command);
	
	/* [ Hooks ] */
	HookEvent("round_end", Event_RoundEnd);
	HookEvent("round_mvp", Event_RoundMvp);
	HookEvent("bomb_defused", Event_BombDefused);
	HookEvent("bomb_planted", Event_BombPlanted);
	HookEvent("player_death", Event_PlayerDeath);
	HookEvent("hostage_rescued", Event_HostageRescued);
	
	/* [ Timers ] */
	CreateTimer(360.0, AuthorInfo, _, TIMER_FLAG_NO_MAPCHANGE);
	
	/* [ Cookies ] */
	g_hCookie1 = RegClientCookie("first_connection", "Pierwsze połaczenie", CookieAccess_Private);
	g_hCookie2 = RegClientCookie("type_of_hud", "Rodzaj hudu", CookieAccess_Private);
	
	/* [ Database Connect ] */
	DatabaseConnect();
	
	/* [ Hud ] */
	g_hHud = CreateHudSynchronizer();
	
	/* [ Check Player ] */
	LoopClients(i)
	{
		OnClientCookiesCached(i);
		OnClientPutInServer(i);
	}
	
	/* [ LogFile ] */
	char sDate[16];
	FormatTime(sDate, sizeof(sDate), "%Y-%m-%d", GetTime());
	BuildPath(Path_SM, g_sLogFile, sizeof(g_sLogFile), "logs/yRanks/%s.log", sDate);
	
	/* [ ConfigFile ] */
	BuildPath(Path_SM, g_sConfigPathMain, sizeof(g_sConfigPathMain), "configs/yRanks/yRanks_Main.cfg");
	BuildPath(Path_SM, g_sConfigPathShop, sizeof(g_sConfigPathShop), "configs/yRanks/yRanks_Shop.cfg");
	BuildPath(Path_SM, g_sConfigPathRanks, sizeof(g_sConfigPathRanks), "configs/yRanks/yRanks_Ranks.cfg");
}

/* [ Timers ] */
public Action UpdateEverythingTimer(Handle timer, any client)
{
	if(IsValidClient(client))
	{
		UpdateEverything(client);
		CreateTimer(30.0, UpdateEverythingTimer, client, TIMER_FLAG_NO_MAPCHANGE);
	}
}

public Action AuthorInfo(Handle timer)
{
	LoopClients(i)
	{
		CPrintToChat(i, "%s {darkred}=========> {lightred}Informacja{darkred} <=========", PluginTag);
		CPrintToChat(i, "%s Plugin został napisany przez {lime}Yamakashiego{default}.", PluginTag);
		CPrintToChat(i, "%s {darkred}=========> {lightred}Informacja{darkred} <=========", PluginTag);
	}
	CreateTimer(360.0, AuthorInfo, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action UpdateStatus(Handle timer, int client)
{
	char sBuffer[1024];
	if(IsValidClient(client))
	{
		if(g_iHud[client] == 1)
		{
			if(IsPlayerAlive(client))
			{
				Format(sBuffer, sizeof(sBuffer), "<font color='#FF0033'>Ranga:</font> %s", g_sRanksNames[g_iRank[client]]);
				if(g_iRank[client] > 18)
					Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Punkty:</font> %d", sBuffer, g_iScore[client]);
				else
					Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Punkty:</font> %d/%d", sBuffer, g_iScore[client], g_iRequirements[g_iRank[client] + 1]);
			}
			else
			{
				int spect = GetEntProp(client, Prop_Send, "m_iObserverMode");
				if(spect == 4 || spect == 5) 
				{
					int target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
					if(target != -1 && IsValidClient(target))
					{
						Format(sBuffer, sizeof(sBuffer), "<font color='#FF0033'>Odznaka:</font> %s", g_sRanksNames[g_iRank[target]]);
						if(g_iRank[target] > 18)
							Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Zabójstwa:</font> %d", sBuffer, g_iScore[target]);
						else
							Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Zabójstwa:</font> %d/%d", sBuffer, g_iScore[target], g_iRequirements[g_iRank[target] + 1]);
					}
				}
			}
			PrintHintText(client, sBuffer);
		}	
		else if(g_iHud[client] == 2)
		{
			if(IsPlayerAlive(client))
			{
				Format(sBuffer, sizeof(sBuffer), "# Ranga: %s", g_sRanksNames[g_iRank[client]]);
				if(g_iRank[client] > 18)
					Format(sBuffer, sizeof(sBuffer), "%s\n# Punkty: %d", sBuffer, g_iScore[client]);
				else
					Format(sBuffer, sizeof(sBuffer), "%s\n# Punkty: %d/%d", sBuffer, g_iScore[client], g_iRequirements[g_iRank[client] + 1]);
				SetHudTextParams(0.03, -0.33, 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
				ShowSyncHudText(client, g_hHud, sBuffer);
			}
			else
			{
				int spect = GetEntProp(client, Prop_Send, "m_iObserverMode");
				if(spect == 4 || spect == 5) 
				{
					int target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
					if(target != -1 && IsValidClient(target))
					{
						Format(sBuffer, sizeof(sBuffer), "# Ranga: %s", g_sRanksNames[g_iRank[target]]);
						if(g_iRank[target] > 18)
							Format(sBuffer, sizeof(sBuffer), "%s\n# Punkty: %d", sBuffer, g_iScore[target]);
						else
							Format(sBuffer, sizeof(sBuffer), "%s\n# Punkty: %d/%d", sBuffer, g_iScore[target], g_iRequirements[g_iRank[target] + 1]);
						SetHudTextParams(0.03, -0.33, 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
						ShowSyncHudText(client, g_hHud, sBuffer);
					}
				}
			}
		}
	}
	CreateTimer(0.1, UpdateStatus, client, TIMER_FLAG_NO_MAPCHANGE);
}
KatowADRE is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 03-23-2020 , 07:12   Re: csgo: problems yranks.smx
Reply With Quote #2

This source code is not enough.

Attach in archive all dependency source files:

Quote:
#include "yRanks/yRanks_Globals.sp"
#include "yRanks/yRanks_Commands.sp"
#include "yRanks/yRanks_Database.sp"
#include "yRanks/yRanks_Events.sp"
#include "yRanks/yRanks_AdminPanel.sp"
#include "yRanks/yRanks_standardActions.sp"
#include "yRanks/yRanks_Helpers.sp"
#include "yRanks/yRanks_Natives.sp"
#include "yRanks/yRanks_Config.sp"
Perhaps, buffer for some arrays declared too low, I assume one of these:

PHP Code:
int g_iScore[MAXPLAYERS+1];
int g_iRank[MAXPLAYERS+1]; 
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D1 fun (Bloody Witch)
[My plugins] [My tools] [GitHub] [Articles]
Dragokas is offline
KatowADRE
Member
Join Date: Feb 2020
Old 03-27-2020 , 14:27   Re: csgo: problems yranks.smx
Reply With Quote #3

I would like to ask for help, because var jumps and every now and then I have errors in the console

link yranks all sp.: https://megawrzuta.pl/download/f44e3...142b530ca.html

Last edited by KatowADRE; 03-27-2020 at 14:27.
KatowADRE is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 03-27-2020 , 14:43   Re: csgo: problems yranks.smx
Reply With Quote #4

Dunno, It's better to ask the author.

There is a strange logic all over the code:
Quote:
Line 8: while(g_iRank[client] < 18 && g_iScore[client] >= g_iRequirements[g_iRank[client] + 1])
Line 8: while(g_iRank[client] < 18 && g_iScore[client] >= g_iRequirements[g_iRank[client] + 1])

Line 16: while (g_iRank[client] > 0 && g_iScore[client] < g_iRequirements[g_iRank[client] - 1])
Line 16: while (g_iRank[client] > 0 && g_iScore[client] < g_iRequirements[g_iRank[client] - 1])
To fix errors from your post you should correct code in one of these ways (I unsure which one is correct):

1)
Line 138:

Code:
				if(g_iRank[client] > 18)
					Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Punkty:</font> %d", sBuffer, g_iScore[client]);
				else
					Format(sBuffer, sizeof(sBuffer), "%s\n<font color='#FF0033'>Punkty:</font> %d/%d", sBuffer, g_iScore[client], g_iRequirements[g_iRank[client] + 1]);
Replace 18 by 17.

2) Remove "+ 1"

And the same with line 152-155.

About var jumping - it's probably high CPU loading and low optimization of your plugins including this one.
Just quick look:

Code:
CreateTimer(0.1, UpdateStatus, client, TIMER_FLAG_NO_MAPCHANGE);
it is repeatable, is such low delay is really necessary...
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D1 fun (Bloody Witch)
[My plugins] [My tools] [GitHub] [Articles]

Last edited by Dragokas; 03-27-2020 at 14:45.
Dragokas is offline
KatowADRE
Member
Join Date: Feb 2020
Old 03-27-2020 , 16:35   Re: csgo: problems yranks.smx
Reply With Quote #5

Could I ask you to do this and send me the files ready in a zip package?

Because I'm afraid and I'm learning to fix and write plugins.


Can you do it and send me ready?
KatowADRE is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 03-27-2020 , 17:17   Re: csgo: problems yranks.smx
Reply With Quote #6

No.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D1 fun (Bloody Witch)
[My plugins] [My tools] [GitHub] [Articles]
Dragokas is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:23.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode