Raised This Month: $51 Target: $400
 12% 

Solved engfunc(EngFunc_AllocString, "str") not return index


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 06-25-2021 , 12:14   engfunc(EngFunc_AllocString, "str") not return index
Reply With Quote #1

I'm doing rework on Dias's plugin that will follow this

But it has a weird situation.
Code:
new g_iszWeaponKey 
public plugin_precache() {
	// ...
	g_iszWeaponKey = engfunc(EngFunc_AllocString, WEAPON_NAME);
	server_print("..., Key: %d %s", g_iszWeaponKey, g_iszWeaponKey);
	// ...
}
this print to the server (from 2 plugins) has same %d and empty string %s
Code:
//WEAPON_NAME weapon_dargoncannon
Key: -74022417                    <= empty string
//WEAPON_NAME weapon_papin
Key: -74020417                    <= empty string
Besides that, no error nor warning shows.

Another part that uses EngFunc_AllocString works normally
Code:
Weapon_Create(const Float: vecOrigin[3] = {0.0, 0.0, 0.0}, const Float: vecAngles[3] = {0.0, 0.0, 0.0}) {
	new iWeapon;
	static iszAllocStringCached;
	if (iszAllocStringCached || (iszAllocStringCached = engfunc(EngFunc_AllocString, WEAPON_REFERANCE))) {
		iWeapon = engfunc(EngFunc_CreateNamedEntity, iszAllocStringCached);
		server_print("Key: %d %s", iszAllocStringCached, iszAllocStringCached)
	}
        // ...
}
Printed different per string, %d and %s
Code:
// WEAPON_REFERANCE weapon_ump45
Key: -74012316 dweapon_ump45
// WEAPON_REFERANCE weapon_knife
Key: -74012329 9weapon_knife
Anyone here knows about this situation?
(I'm using ReHLDS, ReAPI and AmxModX ver 1.9.0.5)

Last edited by VINAGHOST; 06-26-2021 at 05:22. Reason: update info
VINAGHOST is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2021 , 00:04   Re: engfunc(EngFunc_AllocString, "str") not return index
Reply With Quote #2

What is AMX Mod X 1.9.0.5? Though not likely to fix it, you should consider using the latest 1.9 version available which happens to be 1.9.0-git5273.
__________________
fysiks is offline
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 06-26-2021 , 00:09   Re: engfunc(EngFunc_AllocString, "str") not return index
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
What is AMX Mod X 1.9.0.5? Though not likely to fix it, you should consider using the latest 1.9 version available which happens to be 1.9.0-git5273.
Sorry, it is 1.9.0-git5271
meta list command give me that ver
Code:
meta list
Currently loaded plugins:
      description      stat pend  file              vers      src   load  unlod
 [ 1] AMX Mod X        RUN   -    amxmodx_mm_i386.  v1.9.0.5  ini   Start ANY
 [ 2] YaPB             RUN   -    yapb.so           v4.2.598  ini   Chlvl ANY
 [ 3] FakeMeta         RUN   -    fakemeta_amxx_i3  v1.9.0.5  pl1   ANY   ANY
 [ 4] Engine           RUN   -    engine_amxx_i386  v1.9.0.5  pl1   ANY   ANY
 [ 5] MySQL            RUN   -    mysql_amxx_i386.  v1.9.0.5  pl1   ANY   ANY
 [ 6] CStrike          RUN   -    cstrike_amxx_i38  v1.9.0.5  pl1   ANY   ANY
 [ 7] Fun              RUN   -    fun_amxx_i386.so  v1.9.0.5  pl1   ANY   ANY
 [ 8] Ham Sandwich     RUN   -    hamsandwich_amxx  v1.9.0.5  pl1   ANY   ANY
 [ 9] ReAPI            RUN   -    reapi_amxx_i386.  v5.19.0.  pl1   ANY   Never
9 plugins, 9 running

Last edited by VINAGHOST; 06-26-2021 at 00:15.
VINAGHOST is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2021 , 02:46   Re: engfunc(EngFunc_AllocString, "str") not return index
Reply With Quote #4

Oh, yeah, that's because it's a fixed width column in that output and it doesn't show the other numbers. If you do "amxx version" you'll see the full version.
__________________
fysiks is offline
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 06-26-2021 , 05:22   Re: engfunc(EngFunc_AllocString, "str") not return index
Reply With Quote #5

I change to use another method to define the key for weapon so this is not my case anymore.
But I will leave this here if someone have the answer for this situation
VINAGHOST 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 06:46.


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