Raised This Month: $32 Target: $400
 8% 

Solved Space on the stack with 'pragma dynamic'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kriax
Senior Member
Join Date: Apr 2012
Old 07-31-2017 , 11:24   Space on the stack with 'pragma dynamic'
Reply With Quote #1

Hello
I call to the people present on Alliedmodders for a problem.

I have this in my logs:
[SM] Exception reported: Not enough space on the stack

So I did some research and i found this thread:
https://forums.alliedmods.net/showthread.php?t=65592

So I followed the explanations, but when i do this, my server crash ...
The problem is created only when I use GivePlayerItem, and when i use Client_GiveWeapon with SMLIB I don't have this error ..

I try alternative solutions, but nothing works.
I do not want a miracle solution, just understand the problem.

Last edited by Kriax; 07-31-2017 at 15:13.
Kriax is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 07-31-2017 , 11:28   Re: Space on the stack with 'pragma dynamic'
Reply With Quote #2

You'll need to paste your code that is giving you trouble if you're wanting help with the code...
Mitchell is offline
Kriax
Senior Member
Join Date: Apr 2012
Old 07-31-2017 , 11:39   Re: Space on the stack with 'pragma dynamic'
Reply With Quote #3

Code:
public Action Bis_OnClientUseWeapon(int client, int weapon, const char[] szWeapon)
{
	if(StrEqual(szWeapon, "weapon_deagle"))
	{
		if(Bis_GetClientClass(client) == view_as<int>(Class_Throw) || Bis_GetClientClass(client) == view_as<int>(Class_Helper))
			return Plugin_Handled;
		
		if(GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY) != -1)
			return Plugin_Handled;
			
		if(Bis_GetClientPenalityTime(client) > 0)
			return Plugin_Handled;

		char szClassName[CLASS_NAME_MAXLENGHT];
		Bis_GetClassName(view_as<int>(Class_Helper), Bis_GetClientSexe(client), szClassName, CLASS_NAME_MAXLENGHT);
		
		Bis_SetClientClass(client, view_as<int>(Class_Helper));
		CPrintToChat(client, "{red}%s {pink}Vous êtes devenus %s", PREFIX, szClassName);

		return Plugin_Continue;
	}

	return Plugin_Continue;
}
In this code,
Code:
char szClassName[CLASS_NAME_MAXLENGHT];
Create my error ..

But, only it happens on all char ..
I've never seen anything like this ...

All code work with api create by bis-core and this error broke all api, just for size of the stack ..

Sry for my bad language .. i'm french
Kriax is offline
Kriax
Senior Member
Join Date: Apr 2012
Old 07-31-2017 , 11:43   Re: Space on the stack with 'pragma dynamic'
Reply With Quote #4

Maybe this cause the problem ? :
Code:
enum enumClient
{
	Class,
	Sexe,
	Handle:PenalityTimer,
	PenalityTime,
	bool:Respawn,
	bool:TeleportRespawn,
	bool:CanUseCapacity,
	bool:CanTouchSecretGift,
	bool:CanGetThrow,
	String:Name[NAME_MAXLENGHT],
	String:Model[MODEL_MAXLENGHT],
	Point,
	bool:WeaponCanUseTick,
	Handle:HudTimer,
	bool:UnlockTime,
}

enum enumForward
{
	Handle:OnConfigExecuted,
	Handle:OnGameStart,
	Handle:OnGameEnd,
	
	Handle:OnTimerGameplayCreated,
	Handle:OnTimerGameplayLoop,
	Handle:OnTimerGameplayEnd,
	
	Handle:OnThrowTouched,
	Handle:OnGetThrow,
	
	Handle:OnClientInitializedDB,
	Handle:OnClientChangeClass,
	Handle:OnClientUseWeapon,
	Handle:OnClientTakeDamage,
	
	Handle:OnClientPenality,
	Handle:OnClientPenalityEnd,
	
	Handle:OnClientUseCapacity,
	
	Handle:OnSecretGiftCreated,
	Handle:OnSecretGiftDeleted,
	Handle:OnSecretGiftTouched,
}

enum enumTimerGameplay
{
	Handle:Timer,
	Time,
}

enum enumContentClass
{
	String:MaleName[CLASS_NAME_MAXLENGHT],
	String:FemaleName[CLASS_NAME_MAXLENGHT],
	Player,
	bool:Vip,
	bool:Random,
	Class,
	bool:Load
}

enum enumWeapon
{
	String:Name[32],
	String:Class[32]
}

int g_enumClass[MAX_CLASS][enumContentClass];
int g_enumGameplay[MAX_GAMEPLAY][enumTimerGameplay];
int g_enumWeapon[MAX_WEAPON][enumWeapon];
int g_enumForward[enumForward];
int g_enumClient[MAXPLAYERS + 1][enumClient];
Native and Forward return this variable.

Last edited by Kriax; 07-31-2017 at 11:46.
Kriax is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 07-31-2017 , 11:48   Re: Space on the stack with 'pragma dynamic'
Reply With Quote #5

You can't use enums like that in the new syntax, and what is "CLASS_NAME_MAXLENGHT" defined to?
Mitchell is offline
Kriax
Senior Member
Join Date: Apr 2012
Old 07-31-2017 , 11:53   Re: Space on the stack with 'pragma dynamic'
Reply With Quote #6

That's fine work
I do not like Methodmap ..

Code:
#define CLASS_NAME_MAXLENGHT 64   
#define NAME_MAXLENGHT 		 64
EDIT : Problem's created by plugin loop .. solved ...

Last edited by Kriax; 07-31-2017 at 15:13. Reason: Solved
Kriax is offline
Reply



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 09:31.


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