Raised This Month: $94 Target: $400
 23% 

How get a list of Possible entities of a game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UeberDaniel
AlliedModders Donor
Previously known as:
Dany666
Join Date: Dec 2009
Location: Germany
Old 01-14-2020 , 13:32   How get a list of Possible entities of a game
Reply With Quote #1

Hi!

Its About the game Contagion:

Im trying to get some Workaround for this function:

PHP Code:
stock removeWeapons(client) {
    new 
ent;
    for (new 
04i++) {
        
ent GetPlayerWeaponSlot(clienti);
        if (
IsValidEntity(ent)) {
            
RemovePlayerItem(clientent);
            
RemoveEdict(ent);
        }
    }

Im trying to fix an Plugin, which has this Code inside. Idk if its about a Sourcemod update or a Gameupdate but evey time the function is called, and that means only GetPlayerWeaponSlot() in this case, will crash the Server, tried and tested.

There are 4 Weaponslots + Mobilephone on Key B.

I saved the Netprops.txt from the Server and found tables with Weaponslots like this one:
Code:
Table: m_weaponslot1 (offset 1848) (type m_weaponslot1)
  Member: 000 (offset 0) (type integer) (bits 8) (Unsigned)
  Member: 001 (offset 4) (type integer) (bits 8) (Unsigned)
  Member: 002 (offset 8) (type integer) (bits 8) (Unsigned)
  Member: 003 (offset 12) (type integer) (bits 8) (Unsigned)
  Member: 004 (offset 16) (type integer) (bits 8) (Unsigned)
  Member: 005 (offset 20) (type integer) (bits 8) (Unsigned)
  Member: 006 (offset 24) (type integer) (bits 8) (Unsigned)
  Member: 007 (offset 28) (type integer) (bits 8) (Unsigned)
  Member: 008 (offset 32) (type integer) (bits 8) (Unsigned)
  Member: 009 (offset 36) (type integer) (bits 8) (Unsigned)
  Member: 010 (offset 40) (type integer) (bits 8) (Unsigned)
  Member: 011 (offset 44) (type integer) (bits 8) (Unsigned)
  Member: 012 (offset 48) (type integer) (bits 8) (Unsigned)
  Member: 013 (offset 52) (type integer) (bits 8) (Unsigned)
  Member: 014 (offset 56) (type integer) (bits 8) (Unsigned)
  Member: 015 (offset 60) (type integer) (bits 8) (Unsigned)
  Member: 016 (offset 64) (type integer) (bits 8) (Unsigned)
  Member: 017 (offset 68) (type integer) (bits 8) (Unsigned)
  Member: 018 (offset 72) (type integer) (bits 8) (Unsigned)
  Member: 019 (offset 76) (type integer) (bits 8) (Unsigned)
  Member: 020 (offset 80) (type integer) (bits 8) (Unsigned)
There are 4 of them: m_weaponslot1, m_weaponslot2, m_weaponslot3 and m_weaponslot4
- so i think im right here.

When I try to search for the Name with GetEntData or GetEntDataEnt2, i get an exception which tells me the there is no Entity with Name "m_weaponslot1".

So is there any other way to get f.e. the weaponslot1 Entity from a Player?

Maybe some list of all entities?

Greetings
__________________


Last edited by UeberDaniel; 01-14-2020 at 13:44.
UeberDaniel is offline
Send a message via MSN to UeberDaniel
Marttt
Senior Member
Join Date: Jan 2019
Old 01-14-2020 , 15:33   Re: How get a list of Possible entities of a game
Reply With Quote #2

Check the code in this plugin

https://forums.alliedmods.net/showthread.php?p=2279381

May give you some direction.
__________________
Marttt is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 01-14-2020 , 15:37   Re: How get a list of Possible entities of a game
Reply With Quote #3

Replace:
PHP Code:
RemoveEdict(ent); 
With:
PHP Code:
AcceptEntityInput(ent"Kill"); 
This is a safer method for deleting entities. The former is known to crash under certain conditions, and this might be one of those.


Edit: well if GetPlayerWeaponSlot is the cause of crash, might need gamedata update.
__________________

Last edited by Silvers; 01-14-2020 at 15:38.
Silvers is offline
UeberDaniel
AlliedModders Donor
Previously known as:
Dany666
Join Date: Dec 2009
Location: Germany
Old 01-14-2020 , 17:14   Re: How get a list of Possible entities of a game
Reply With Quote #4

Quote:
Originally Posted by Marttt View Post
Check the code in this plugin

https://forums.alliedmods.net/showthread.php?p=2279381

May give you some direction.
This Plugin uses also the GetPlayerWeaponSlot() function on its stripPlayers() function so its useless in this case.

Greetings
__________________

UeberDaniel is offline
Send a message via MSN to UeberDaniel
UeberDaniel
AlliedModders Donor
Previously known as:
Dany666
Join Date: Dec 2009
Location: Germany
Old 01-14-2020 , 17:16   Re: How get a list of Possible entities of a game
Reply With Quote #5

Quote:
Originally Posted by Silvers View Post
Replace:
PHP Code:
RemoveEdict(ent); 
With:
PHP Code:
AcceptEntityInput(ent"Kill"); 
This is a safer method for deleting entities. The former is known to crash under certain conditions, and this might be one of those.
Good to know
__________________

UeberDaniel is offline
Send a message via MSN to UeberDaniel
UeberDaniel
AlliedModders Donor
Previously known as:
Dany666
Join Date: Dec 2009
Location: Germany
Old 01-15-2020 , 12:46   Re: How get a list of Possible entities of a game
Reply With Quote #6

Quote:
Originally Posted by Silvers View Post
Edit: well if GetPlayerWeaponSlot is the cause of crash, might need gamedata update.
How can this be done?
__________________

UeberDaniel is offline
Send a message via MSN to UeberDaniel
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 01-15-2020 , 13:10   Re: How get a list of Possible entities of a game
Reply With Quote #7

try:

PHP Code:
void RemovePlayerWeapons(int client)
{   
    
int length GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
    for (
int i 0lengthi++) 
    {
        
int weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"i); 
        if (
weapon != -1)
        {
            
RemovePlayerItem(clientweapon);
            
AcceptEntityInput(weapon"Kill");
        }
    }
    
    
SetEntPropEnt(clientProp_Send"m_hActiveWeapon", -1);

__________________

Last edited by Ilusion9; 01-15-2020 at 13:10.
Ilusion9 is online now
UeberDaniel
AlliedModders Donor
Previously known as:
Dany666
Join Date: Dec 2009
Location: Germany
Old 01-15-2020 , 14:49   Re: How get a list of Possible entities of a game
Reply With Quote #8

Quote:
Originally Posted by Ilusion9 View Post
try:

PHP Code:
void RemovePlayerWeapons(int client)
{   
    
int length GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
    for (
int i 0lengthi++) 
    {
        
int weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"i); 
        if (
weapon != -1)
        {
            
RemovePlayerItem(clientweapon);
            
AcceptEntityInput(weapon"Kill");
        }
    }
    
    
SetEntPropEnt(clientProp_Send"m_hActiveWeapon", -1);

This is working. Thank You!
__________________

UeberDaniel is offline
Send a message via MSN to UeberDaniel
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 17:36.


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