AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED][HAMSANDWICH] Failed to retrieve classtype... (https://forums.alliedmods.net/showthread.php?t=83477)

Dr.G 01-10-2009 09:56

[SOLVED][HAMSANDWICH] Failed to retrieve classtype...
 
I wanted to make a plugin that made it harder to camp at/on the church in dod_avalanche (yes i play DoD ;)). First i created a zone where u cant prone, but i get and error while detecting the classname of the new ent name with Ham...

PHP Code:

[HAMSANDWICHFailed to retrieve classtype for "no_prone"hook for "FwdTouch" not active

So it doesnt detect the entity.. Any idea how to solve this?


PHP Code:

#include <amxmisc>
#include <amxmodx>
#include <dodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "No Church Campers"
#define VERSION "1.0 by Dr.G - www.clan-go.net"
#define AUTHOR "Dr.G"
new p_enable
public plugin_init()
{
 new 
check_map[32]
 
get_mapname(check_map,31)
 if(
equali(check_map,"dod_avalanche"))
 {
  
Zone1()
  
//Zone2()
 
 
}
 
register_plugin("no_church_campers",VERSIONAUTHOR)
 
register_cvar("no_church_campers"VERSIONFCVAR_SERVER|FCVAR_SPONLY)
 
//For testing
 //RegisterHam(Ham_Touch, "dod_capture_area", "FwdTouch",0) this IS tested and it worked perfect!
 
RegisterHam(Ham_Touch"no_prone""FwdTouch",0)
 
p_enable register_cvar("no_church_campers","1"// Plugin On | Off
 
}
public 
FwdTouch(entityclient)
{
 if(
get_pcvar_num(p_enable) && is_user_connected(client) && is_user_alive(client))
 
 
dod_set_pronestate(client0);
 
//For testing
 //client_print(client,print_chat,"You Can't Prone Here! You Damn Camper!")
 
 
return HAM_IGNORED
}
// stock for dod_noprone by Tatsu, thanks!
stock dod_set_pronestate(clientflag
{
 
set_pev(clientpev_iuser3flag );
}
public 
Zone1() // enter to church
{
 
 new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
 
//STOP if we cant create the ent... safety
 
if(!ent)
  return 
PLUGIN_HANDLED 
 
 set_pev
(entpev_targetname"no_prone"
 
dllfunc(DLLFunc_Spawnent)
 
 new 
Float:origin[3] = { -547.0, -260.0, -188.0 //center box?
 
set_pev(entpev_originorigin)
 
 
set_pev(entpev_movetypeMOVETYPE_STEP////stay on the ground? 
 
set_pev(entpev_solidSOLID_NOT// TRIGGER?
 
 //new Float:g_fMaxs[3] = { -471.0 , -287.0 , -156.0 }
 //new Float:g_fMins[3] = { 0.0 , 0.0 , 100.0 }
 
new Float:g_fMaxs[3] = { -687.0, -303.0, -187.0 }
 new 
Float:g_fMins[3] = { -261.0 , -207.0 13.0 }
 
 
engfunc(EngFunc_SetSizeentg_fMaxsg_fMins)
 
 return 
PLUGIN_HANDLED
}
/*
public Zone2() // top of church
{
 //mortar field
 new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
 //STOP if we cant create the ent... safety
 if(!ent)
  return PLUGIN_HANDLED 
 
 set_pev(ent, pev_targetname, "no_prone") 
 dllfunc(DLLFunc_Spawn, ent)
 
 new Float:origin[3] = { -425.0, -17.5, 356.0 } //center box?
 set_pev(ent, pev_origin, origin)
 
 set_pev(ent, pev_movetype, MOVETYPE_FLY)
 set_pev(ent, pev_solid, SOLID_NOT) // TRIGGER?
 
 new Float:g_fMaxs[3] = { -495.0 , 191.0 , 311.0 } // oy oy
 new Float:g_fMins[3] = { -328.0 , -159.0 , 215.0 }
 
 engfunc(EngFunc_SetSize, ent, g_fMaxs, g_fMins)
 
 return PLUGIN_HANDLED
}
*/ 


ConnorMcLeod 01-10-2009 10:00

Re: [HAMSANDWICH] Failed to retrieve classtype...
 
You can only register ham forwards with default game entities classnames.
Either you let your entity as info_target and you set something that let you recognize it as pev_message : no_prone, either you use fakemeta instead.

danielkza 01-10-2009 10:45

Re: [HAMSANDWICH] Failed to retrieve classtype...
 
Quote:

Originally Posted by ConnorMcLeod (Post 741610)
You can only register ham forwards with default game entities classnames.
Either you let your entity as info_target and you set something that let you recognize it as pev_message : no_prone, either you use fakemeta instead.

Also, you can use RegisterHamFromEntity, but be careful, if will register the hook for ALL ENTS with the same class as yours, so don't forget to filter it.

Dr.G 01-10-2009 11:25

Re: [HAMSANDWICH] Failed to retrieve classtype...
 
Thanks, no error with FM, but i still have a problem hooking to the entity i created.. Ive made another entity with another plugin and that works, but i cant catch the touch on that either... Ideas?

ConnorMcLeod 01-10-2009 11:27

Re: [HAMSANDWICH] Failed to retrieve classtype...
 
SOLID_NOT doesn't work, use SOLID_TRIGGER instead

Quote:

Originally Posted by hlsdk_const.inc
// pev(entity, pev_solid) values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // No interaction with other objects
#define SOLID_TRIGGER 1 // Touch on edge, but not blocking
#define SOLID_BBOX 2 // Touch on edge, block
#define SOLID_SLIDEBOX 3 // Touch on edge, but not an onground
#define SOLID_BSP 4 // BSP clip, touch on edge, block


Dr.G 01-11-2009 19:18

Re: [HAMSANDWICH] Failed to retrieve classtype...
 
It works! Thank you!


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

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