AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved engfunc(EngFunc_AllocString, "str") not return index (https://forums.alliedmods.net/showthread.php?t=333215)

VINAGHOST 06-25-2021 12:14

engfunc(EngFunc_AllocString, "str") not return index
 
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)

fysiks 06-26-2021 00:04

Re: engfunc(EngFunc_AllocString, "str") not return index
 
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.

VINAGHOST 06-26-2021 00:09

Re: engfunc(EngFunc_AllocString, "str") not return index
 
Quote:

Originally Posted by fysiks (Post 2751161)
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 :cry:
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


fysiks 06-26-2021 02:46

Re: engfunc(EngFunc_AllocString, "str") not return index
 
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.

VINAGHOST 06-26-2021 05:22

Re: engfunc(EngFunc_AllocString, "str") not return index
 
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


All times are GMT -4. The time now is 09:05.

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