| Exolent[jNr] |
09-01-2009 23:39 |
Ham_Spawn - bad; FM_Spawn - good; Why?
Ham_Spawn:
PHP Code:
#include < amxmodx > #include < amxmisc > #include < engine > #include < hamsandwich >
public plugin_precache() { new iEntity = create_entity( "player_weaponstrip" ); DispatchKeyValue( iEntity, "targetname", "stripper" ); DispatchSpawn( iEntity ); iEntity = create_entity( "game_player_equip" ); DispatchKeyValue( iEntity, "weapon_knife", "1" ); DispatchKeyValue( iEntity, "targetname", "equipment" ); iEntity = create_entity( "multi_manager" ); DispatchKeyValue( iEntity, "stripper", "0" ); DispatchKeyValue( iEntity, "equipment", "0.5" ); DispatchKeyValue( iEntity, "targetname", "game_playerspawn" ); DispatchKeyValue( iEntity, "spawnflags", "1" ); DispatchSpawn( iEntity ); iEntity = create_entity( "info_map_parameters" ); DispatchKeyValue( iEntity, "buying", "3" ); DispatchSpawn( iEntity ); 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 i = 0; i < sizeof( sRemoveEntities ); i++ ) { RegisterHam( Ham_Spawn, sRemoveEntities[ i ], "FwdSpawn" ); } return PLUGIN_CONTINUE; }
public pfn_keyvalue( iEntity ) { static szClassname[ 32 ], szKey[ 32 ], szValue[ 32 ]; copy_keyvalue( szClassname, 31, szKey, 31, szValue, 31 ); if( equal( szClassname, "multi_manager" ) && equal( szKey, "targetname" ) && equal( szValue, "game_playerspawn" ) ) { remove_entity( iEntity ); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public FwdSpawn( iEntity ) { remove_entity( iEntity ); 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" ); DispatchKeyValue( iEntity, "targetname", "stripper" ); DispatchSpawn( iEntity ); iEntity = create_entity( "game_player_equip" ); DispatchKeyValue( iEntity, "weapon_knife", "1" ); DispatchKeyValue( iEntity, "targetname", "equipment" ); iEntity = create_entity( "multi_manager" ); DispatchKeyValue( iEntity, "stripper", "0" ); DispatchKeyValue( iEntity, "equipment", "0.5" ); DispatchKeyValue( iEntity, "targetname", "game_playerspawn" ); DispatchKeyValue( iEntity, "spawnflags", "1" ); DispatchSpawn( iEntity ); iEntity = create_entity( "info_map_parameters" ); DispatchKeyValue( iEntity, "buying", "3" ); DispatchSpawn( iEntity ); 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 i = 0; i < sizeof( sRemoveEntities ); i++ ) { TrieSetCell( g_tRemoveEntities, sRemoveEntities[ i ], i ); } register_forward( FM_Spawn, "FwdSpawn" ); return PLUGIN_CONTINUE; }
public plugin_end() { TrieDestroy( g_tRemoveEntities ); }
public pfn_keyvalue( iEntity ) { static szClassname[ 32 ], szKey[ 32 ], szValue[ 32 ]; copy_keyvalue( szClassname, 31, szKey, 31, szValue, 31 ); if( equal( szClassname, "multi_manager" ) && equal( szKey, "targetname" ) && equal( szValue, "game_playerspawn" ) ) { remove_entity( iEntity ); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public FwdSpawn( iEntity ) { static szClassname[ 32 ]; entity_get_string( iEntity, EV_SZ_classname, szClassname, 31 ); if( TrieKeyExists( g_tRemoveEntities, szClassname ) ) { remove_entity( iEntity ); 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.
|