Raised This Month: $ Target: $400
 0% 

Ham_Spawn - bad; FM_Spawn - good; Why?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2009 , 23:39   Ham_Spawn - bad; FM_Spawn - good; Why?
Reply With Quote #1

Ham_Spawn:
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >
#include < hamsandwich >

public plugin_precache()
{
    new 
iEntity create_entity"player_weaponstrip" );
    
DispatchKeyValueiEntity"targetname""stripper" );
    
DispatchSpawniEntity );
    
    
iEntity create_entity"game_player_equip" );
    
DispatchKeyValueiEntity"weapon_knife""1" );
    
DispatchKeyValueiEntity"targetname""equipment" );
    
    
iEntity create_entity"multi_manager" );
    
DispatchKeyValueiEntity"stripper""0" );
    
DispatchKeyValueiEntity"equipment""0.5" );
    
DispatchKeyValueiEntity"targetname""game_playerspawn" );
    
DispatchKeyValueiEntity"spawnflags""1" );
    
DispatchSpawniEntity );
    
    
iEntity create_entity"info_map_parameters" );
    
DispatchKeyValueiEntity"buying""3" );
    
DispatchSpawniEntity );
    
    new const 
sRemoveEntities[][] =
    {
        
"func_bomb_target",
        
"info_bomb_target",
        
"hostage_entity",
        
"monster_scientist",
        
"func_hostage_rescue",
        
"info_hostage_rescue",
        
"info_vip_start",
        
"func_vip_safetyzone",
        
"func_escapezone",
        
"armoury_entity",
        
"info_map_parameters",
        
"player_weaponstrip",
        
"game_player_equip",
        
"func_buyzone"
    
};
    
    for( new 
0sizeofsRemoveEntities ); i++ )
    {
        
RegisterHamHam_SpawnsRemoveEntities], "FwdSpawn" );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
pfn_keyvalueiEntity )
{
    static 
szClassname32 ], szKey32 ], szValue32 ];
    
copy_keyvalueszClassname31szKey31szValue31 );
    
    if( 
equalszClassname"multi_manager" )
    && 
equalszKey"targetname" )
    && 
equalszValue"game_playerspawn" ) )
    {
        
remove_entityiEntity );
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdSpawniEntity )
{
    
remove_entityiEntity );
    
    return 
HAM_SUPERCEDE;

FM_Spawn:
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >
#include < fakemeta >

new Trie:g_tRemoveEntities;

public 
plugin_precache()
{
    new 
iEntity create_entity"player_weaponstrip" );
    
DispatchKeyValueiEntity"targetname""stripper" );
    
DispatchSpawniEntity );
    
    
iEntity create_entity"game_player_equip" );
    
DispatchKeyValueiEntity"weapon_knife""1" );
    
DispatchKeyValueiEntity"targetname""equipment" );
    
    
iEntity create_entity"multi_manager" );
    
DispatchKeyValueiEntity"stripper""0" );
    
DispatchKeyValueiEntity"equipment""0.5" );
    
DispatchKeyValueiEntity"targetname""game_playerspawn" );
    
DispatchKeyValueiEntity"spawnflags""1" );
    
DispatchSpawniEntity );
    
    
iEntity create_entity"info_map_parameters" );
    
DispatchKeyValueiEntity"buying""3" );
    
DispatchSpawniEntity );
    
    new const 
sRemoveEntities[][] =
    {
        
"func_bomb_target",
        
"info_bomb_target",
        
"hostage_entity",
        
"monster_scientist",
        
"func_hostage_rescue",
        
"info_hostage_rescue",
        
"info_vip_start",
        
"func_vip_safetyzone",
        
"func_escapezone",
        
"armoury_entity",
        
"info_map_parameters",
        
"player_weaponstrip",
        
"game_player_equip",
        
"func_buyzone"
    
};
    
    
g_tRemoveEntities TrieCreate( );
    
    for( new 
0sizeofsRemoveEntities ); i++ )
    {
        
TrieSetCellg_tRemoveEntitiessRemoveEntities], );
    }
    
    
register_forwardFM_Spawn"FwdSpawn" );
    
    return 
PLUGIN_CONTINUE;
}

public 
plugin_end()
{
    
TrieDestroyg_tRemoveEntities );
}

public 
pfn_keyvalueiEntity )
{
    static 
szClassname32 ], szKey32 ], szValue32 ];
    
copy_keyvalueszClassname31szKey31szValue31 );
    
    if( 
equalszClassname"multi_manager" )
    && 
equalszKey"targetname" )
    && 
equalszValue"game_playerspawn" ) )
    {
        
remove_entityiEntity );
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdSpawniEntity )
{
    static 
szClassname32 ];
    
entity_get_stringiEntityEV_SZ_classnameszClassname31 );
    
    if( 
TrieKeyExistsg_tRemoveEntitiesszClassname ) )
    {
        
remove_entityiEntity );
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;

The problem is that when I use Ham_Spawn version, it deletes the spawn points or something because there are none anymore and when you join the server, you can't choose a team because they are full, even though there are no players. Also, your camera when you join is somewhere in the wall or random in the map. But, when I use FM_Spawn, everything works perfectly.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-02-2009 , 00:32   Re: Ham_Spawn - bad; FM_Spawn - good; Why?
Reply With Quote #2

This happened with me for some other ents, heres my topic http://forums.alliedmods.net/showthread.php?t=93624
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-02-2009 , 04:25   Re: Ham_Spawn - bad; FM_Spawn - good; Why?
Reply With Quote #3

I don't know how Ham works exactly, but like func_door and func_water which have the same class CBaseDoor ;

CPointEntity : info_player_start, func_bomb_target, info_bomb_target, func_hostage_rescue, info_hostage_rescue
CBaseDMStart : info_player_deathmatch, info_vip_start, func_vip_safetyzone

It seems that Ham_Spawn spawns all entities of the same internal class. I think it's a bug because RegisterHamFromEntity is supposed to do that and not RegisterHam.
__________________
Arkshine 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 15:13.


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