AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   can't get cs_get_armoury_type to work (https://forums.alliedmods.net/showthread.php?t=26129)

AndraX2000 03-27-2006 11:49

can't get cs_get_armoury_type to work
 
cs_get_armoury_type just doesn't seem to work for me. I am using version 1.70 on linux. No matter which entity it finds, it always thinks that it's type is "23".

Code:

public scour_map() {
        new entindex = -1
        while (entindex = find_ent_by_class(entindex,"armoury_entity")) {
                new weapType = cs_get_armoury_type(entindex)
                server_print("Found an ARMOURY[%d]: %d",entindex,weapType)
        }
        return PLUGIN_CONTINUE
}

shows the following: (btw I used fy_iceworld because there are lots of different armoury entities)
Code:

Found an ARMOURY[59]: 23
Found an ARMOURY[60]: 23
Found an ARMOURY[61]: 23
Found an ARMOURY[62]: 23
Found an ARMOURY[63]: 23
Found an ARMOURY[64]: 23
Found an ARMOURY[65]: 23
Found an ARMOURY[66]: 23
Found an ARMOURY[67]: 23
Found an ARMOURY[68]: 23
Found an ARMOURY[69]: 23
Found an ARMOURY[70]: 23
Found an ARMOURY[71]: 23
Found an ARMOURY[72]: 23
Found an ARMOURY[73]: 23
Found an ARMOURY[74]: 23
Found an ARMOURY[75]: 23
Found an ARMOURY[76]: 23
Found an ARMOURY[77]: 23
Found an ARMOURY[78]: 23
Found an ARMOURY[79]: 23
Found an ARMOURY[80]: 23
Found an ARMOURY[81]: 23
Found an ARMOURY[82]: 23

As you can see, it finds all of the armoury entites, it just thinks that each one is of type "23"
Is this just not working as of 1.70, or am I doing something wrong?

teame06 03-27-2006 13:39

Code:
public scour_map() {     new entindex = find_ent_by_class(entindex,"armoury_entity")     new weapType         while (entindex > 0)     {         weapType = cs_get_armoury_type(entindex)         server_print("Found an ARMOURY[%d]: %d",entindex,weapType)                 entindex = find_ent_by_class(entindex,"armoury_entity")             } }

v3x 03-27-2006 14:21

AFAIK there's no cs_get_armoury_type native. It sounds like something for NS :o

AndraX2000 03-27-2006 14:56

Thanks for the quick replies.

teame06:
The problem I'm having isn't really with the structure of the while loop, and the code you present is equivalent. I did try it out, just in case I missed something there, and the results are identical. The problem seems to be that cs_get_armoury_type just doesn't seem to be working.

v3x
cs_get_armoury_type is defined in cstrike.inc. It appears to have been added to cstrike.cpp on 7 Aug 2005 by jonnygothisgun
http://www.tcwonline.org/cgi-bin/vie...ke/cstrike.cpp
and if I vim cstrike_amxx_i386.so I can see that it is in there.

I guess it comes down to: if cs_get_armoury_type works, then I need scripting support because I am not using properly. If it doesn't work, then maybe this thread belongs in bugs.

v3x 03-27-2006 17:14

Ah, I see now. Thanks.

GHW_Chronic 03-27-2006 17:23

no, you just need to learn to script thats all.

Code:

Found an ARMOURY[52]: 18
Found an ARMOURY[53]: 18
Found an ARMOURY[54]: 22
Found an ARMOURY[57]: 22
Found an ARMOURY[58]: 28
Found an ARMOURY[59]: 22
Found an ARMOURY[60]: 28
Found an ARMOURY[61]: 22
Found an ARMOURY[62]: 28
Found an ARMOURY[63]: 22
Found an ARMOURY[64]: 28
Found an ARMOURY[65]: 22
Found an ARMOURY[66]: 28
Found an ARMOURY[67]: 22
Found an ARMOURY[68]: 28
Found an ARMOURY[69]: 28
Found an ARMOURY[70]: 22
Found an ARMOURY[71]: 28
Found an ARMOURY[86]: 28
Found an ARMOURY[87]: 22
Found an ARMOURY[88]: 28
Found an ARMOURY[89]: 28
Found an ARMOURY[90]: 22
Found an ARMOURY[91]: 28
Found an ARMOURY[92]: 22
Found an ARMOURY[93]: 28
Found an ARMOURY[94]: 22
Found an ARMOURY[95]: 28
Found an ARMOURY[96]: 22
Found an ARMOURY[97]: 28
Found an ARMOURY[98]: 22
Found an ARMOURY[99]: 28
Found an ARMOURY[100]: 22
Found an ARMOURY[103]: 22
Found an ARMOURY[104]: 18
Found an ARMOURY[105]: 18
Found an ARMOURY[122]: 18
Found an ARMOURY[123]: 18
Found an ARM

on aim_map using teame06's exact coding.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> public plugin_init() {     set_task(10.0,"scour_map") }  public scour_map() {     new entindex = find_ent_by_class(entindex,"armoury_entity")     new weapType         while (entindex > 0)     {         weapType = cs_get_armoury_type(entindex)         server_print("Found an ARMOURY[%d]: %d",entindex,weapType)                 entindex = find_ent_by_class(entindex,"armoury_entity")             } }

AndraX2000 03-27-2006 20:24

teame06's code and mine were equivalent. In fact, I had a sneaking suspicion that there was something deeper going on. So I installed AMX Mod X on my Windows machine and compiled my original script on it. It worked fine (as does team06's). The fault lay not in the script but in cstrike.h. The error caused cs_get_armoury_type to work on Windows, but not on Linux.

For anyone wanting to use cs_get_armoury_type or cs_set_armoury_type right now on Linux you will need to change line 106 in cstrike.h from
Code:

#define OFFSET_ARMOURY_TYPE                    34 + EXTRAOFFSET
to
Code:

#define OFFSET_ARMOURY_TYPE                    34 + EXTRAOFFSET_WEAPONS
and then recompile.

GHW_Chronic 03-27-2006 20:28

really, as on my CS 1.6 server win32 teame06's worked and yet yours did not. Tried them both on iceworld and his returned a bunch of numbers whilst yours only returned 23.

Hawk552 03-27-2006 20:39

Quote:

Originally Posted by GHW_Chronic
really, as on my CS 1.6 server win32 teame06's worked and yet yours did not. Tried them both on iceworld and his returned a bunch of numbers whilst yours only returned 23.

http://wiki.tcwonline.org/images/What.png

He said that his did work on win32 but not on linux...

GHW_Chronic 03-27-2006 20:41

and I am saying it DOESNT work on win32. As he stated that it was not his coding that made it return all 23s and yet it was his coding on my win32 that did indeed cause it to return all 23s/


All times are GMT -4. The time now is 16:40.

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