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

"FindEntityByClassname" not supported by this mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
artist
Member
Join Date: Nov 2013
Old 03-14-2018 , 06:13   "FindEntityByClassname" not supported by this mod
Reply With Quote #1

Counter Strike: Source.
Metamod Build 961
Source Mod Build 6041

The console displays:

L 03/14/2018 - 14:11:27: [SM] Exception reported: "FindEntityByClassname" not supported by this mod
L 03/14/2018 - 14:11:27: [SM] Blaming: Untitled_Script.smx
L 03/14/2018 - 14:11:27: [SM] Call stack trace:
L 03/14/2018 - 14:11:27: [SM] [0] FindEntityByClassname
L 03/14/2018 - 14:11:27: [SM] [1] Line 48, E:\Games\Counter-Strike Source\cstrike\addons\sourcemod\scripting\Unt itled_Script.sp::Event_PlayerDeath

PHP Code:
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo 
{
    
name "Show Admins Info",
    
author "artist666",
    
description "<- Description ->",
    
version "1.0",
    
url "http://www.sourcemod.net/"
};

int resp_killed[64];
char szSpawn[][] = {"""""info_player_terrorist""info_player_counterterrorist"""};

public 
OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
}
public 
void Event_PlayerSpawn(Event hEvent, const char[] sEvNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));

    if(!
iClient) return;

    
resp_killed[iClient] = 0;
}
public 
void Event_PlayerDeath(Event hEvent, const char[] sEvNamebool bDontBroadcast)
{
    static 
int iVictimiVictim GetClientOfUserId(hEvent.GetInt("userid"));
    static 
int iAttackeriAttacker GetClientOfUserId(hEvent.GetInt("attacker"));

    
resp_killed[iVictim] = 0;

    if(!
IsClientInGame(iAttacker)) return;

    static 
String:szName[64]; GetClientName(iVictimszNamesizeof(szName) - 1);
    static 
Float:fOrigin[3]; GetClientAbsOrigin(iVictimfOrigin);
    
    static 
int iTeamiTeam GetClientTeam(iVictim);
    
    static 
entent = -1;
    static 
Float:fSpPoint[3];
    
    
PrintToChatAll("iTeam - %i poi - %s"iTeamszSpawn[iTeam]);
    
    while((
ent FindEntityByClassname(entszSpawn[iTeam])) > 0
    { 
        
GetEntPropVector(entProp_Send"m_vecOrigin"fSpPoint);
        
        
PrintToChatAll("%f"GetVectorDistance(fOriginfSpPoint));
        
        if(
GetVectorDistance(fOriginfSpPoint) < 300.0)
        {
            
PrintToChatAll("%s killed base"szName);
            return;
        }
    }

Who can say the replacement function?
artist is offline
artist
Member
Join Date: Nov 2013
Old 03-14-2018 , 07:01   Re: "FindEntityByClassname" not supported by this mod
Reply With Quote #2

Did so:
PHP Code:
float g_iSpawnOrigin[2][33][3];
int g_iNumSpawnTT 0g_iNumSpawnCT 0;

public 
OnMapStart() 
{
    
decl String:szClass[65];
    new 
ent MaxClients 1;
    new 
MaxEntities GetMaxEntities() + 1;
    new 
Float:iOrigin[3]
    
    while(++
ent MaxEntities)
    {
        if(!
IsValidEdict(ent) || !IsValidEntity(ent)) continue
        
        
GetEdictClassname(entszClasssizeof(szClass));
        
        if(
StrEqual(szClass"info_player_terrorist"))
        {
            
GetEntPropVector(entProp_Send"m_vecOrigin"iOrigin);
            
g_iSpawnOrigin[0][g_iNumSpawnTT][0] = iOrigin[0];
            
g_iSpawnOrigin[0][g_iNumSpawnTT][1] = iOrigin[1];
            
g_iSpawnOrigin[0][g_iNumSpawnTT][2] = iOrigin[2];
            
g_iNumSpawnTT++;
            
PrintToServer("info_player_terrorist = %f %f %f"iOrigin[0], iOrigin[1], iOrigin[2]);
        }
        else if(
StrEqual(szClass"info_player_counterterrorist"))
        {
            
GetEntPropVector(entProp_Send"m_vecOrigin"iOrigin);
            
g_iSpawnOrigin[1][g_iNumSpawnCT][0] = iOrigin[0];
            
g_iSpawnOrigin[1][g_iNumSpawnCT][1] = iOrigin[1];
            
g_iSpawnOrigin[1][g_iNumSpawnCT][2] = iOrigin[2];
            
g_iNumSpawnCT++;
            
PrintToServer("info_player_counterterrorist = %f %f %f"iOrigin[0], iOrigin[1], iOrigin[2]);
        }
    }

I check whether the player is at his base:
PHP Code:
static i= -1;
    
if(
iTeam == 2)
{
    while(++
g_iNumSpawnTT)
    {
        if(
GetVectorDistance(fOriging_iSpawnOrigin[0][i]) < 300.0)
        {
            
PrintToChatAll("%s killed base"szName);
            
g_iResp_killed[iAttacker]++;
            return;
        }
    }
}
else
{
    while(++
g_iNumSpawnCT)
    {
        if(
GetVectorDistance(fOriging_iSpawnOrigin[1][i]) < 300.0)
        {
            
PrintToChatAll("%s killed base"szName);
            
g_iResp_killed[iAttacker]++;
            return;
        }
    }

artist is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-14-2018 , 18:44   Re: "FindEntityByClassname" not supported by this mod
Reply With Quote #3

What is the output of "version" ?
__________________
asherkin is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 03-15-2018 , 00:08   Re: "FindEntityByClassname" not supported by this mod
Reply With Quote #4

non-steam cs:s isn't supported sorry bud
neither v34 is.. do you really expect AM to support a 7 years old version of a game that got many updates since then?
__________________
retired

Last edited by shavit; 03-15-2018 at 00:09.
shavit is offline
artist
Member
Join Date: Nov 2013
Old 03-15-2018 , 07:14   Re: "FindEntityByClassname" not supported by this mod
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
What is the output of "version" ?
Quote:
Protocol version 7
Exe version 1.0.0.34 (cstrike)
Exe build: 17:27:58 Dec 3 2009 (4044)
Quote:
Originally Posted by shavit View Post
non-steam cs:s isn't supported sorry bud
neither v34 is.. do you really expect AM to support a 7 years old version of a game that got many updates since then?
Thank you, understood.
I'm not a fan of updates, I installed a stable version and I do not need anything else.

In principle, this function was superfluous for my purposes.
Sorting out all the spawn of the player is not good.
It's better to check the distance.
The only thing, I would replace the array with a dynamic one, just do not know how it will be in the SourcePawn.
artist 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 22:44.


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