Raised This Month: $12 Target: $400
 3% 

Swap team spawns


Post New Thread Reply   
 
Thread Tools Display Modes
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-12-2009 , 09:31   Re: Reverse Player Spawns
Reply With Quote #11

Quote:
Originally Posted by Hunter-Digital View Post
Well it seems I can't create spawn points O.o I searched for all codes I could search, nothing worked, they all spawn me at 0 0 0 even tough the entity's position is where it should be...
Spawn points can be created...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-12-2009 , 10:51   Re: Reverse Player Spawns
Reply With Quote #12

Works fine. feel free to use.
PHP Code:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

public plugin_precache( ) {
    
register_plugin"Swap Spawns""1.0""xPaw" );
    
    
RegisterHamHam_Spawn"info_player_start""FwdHamSpawn_CT");
    
RegisterHamHam_Spawn"info_player_deathmatch""FwdHamSpawn_T");
    
RegisterHamHam_Spawn"func_buyzone""FwdHamSpawn_BuyZone");
}

public 
FwdHamSpawn_BuyZoneiEntity ) {
    switch( 
entity_get_intiEntityEV_INT_team ) ) {
        case 
1entity_set_intiEntityEV_INT_team);
        case 
2entity_set_intiEntityEV_INT_team);
    }
}

public 
FwdHamSpawn_CTiEntity ) {
    new 
szClass32 ];
    
entity_get_stringiEntityEV_SZ_classnameszClass16 );
    
    if( 
szClass] != 'p' || szClass12 ] != 's' )
        return 
HAM_IGNORED;
    
    if( 
entity_get_intiEntityEV_INT_iuser4 ) == 9999 )
        return 
HAM_IGNORED;
    
    
CreateSpawniEntity);
    
    return 
HAM_IGNORED;
}

public 
FwdHamSpawn_TiEntity ) {
    new 
szClass32 ];
    
entity_get_stringiEntityEV_SZ_classnameszClass16 );
    
    if( 
szClass] != 'p' || szClass12 ] != 'd' )
        return 
HAM_IGNORED;
    
    if( 
entity_get_intiEntityEV_INT_iuser4 ) == 9999 )
        return 
HAM_IGNORED;
    
    
CreateSpawniEntity);
    
    return 
HAM_IGNORED;
}

CreateSpawniEntityiNewTeam ) {
    new 
Float:vAngles], Float:vOrigin];
    
entity_get_vectoriEntityEV_VEC_originvOrigin );
    
entity_get_vectoriEntityEV_VEC_anglesvAngles );
    
    
entity_set_intiEntityEV_INT_flagsFL_KILLME );
    
call_thinkiEntity );
    
    switch( 
iNewTeam ) {
        case 
0iEntity create_entity"info_player_start" );
        case 
1iEntity create_entity"info_player_deathmatch" );
    }
    
    if( !
is_valid_entiEntity ) )
        return 
0;
    
    
entity_set_vectoriEntityEV_VEC_originvOrigin );
    
entity_set_vectoriEntityEV_VEC_anglesvAngles );
    
entity_set_intiEntityEV_INT_iuser49999 );
    
    return 
iEntity;

__________________
xPaw is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 08-12-2009 , 12:33   Re: Reverse Player Spawns
Reply With Quote #13

nice one digi
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-12-2009 , 14:31   Re: Reverse Player Spawns
Reply With Quote #14

Yes well, I see that you can only create spawns in precache, thanks for the code xPaw but I want to make it per-map not globally
One question, why do you use FL_KILLME and call_think() when you can simply remove it ? Works the same from what I can see...
__________________
Hunter-Digital is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-12-2009 , 14:44   Re: Reverse Player Spawns
Reply With Quote #15

I mean, instead of remove those ents, just alter their classname, like info_blabla -> _info_blabla, save state in a globale cvar, when when you switch back the state to normal, alter each _info_blabla into info_blabla, restart round and it should be fine.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-12-2009 , 15:04   Re: Reverse Player Spawns
Reply With Quote #16

Well I tried that, doesn't seem to work
Anyway, that's something a map should handle if it doesn't have equal spawns :} wouldn't be fair anyway

small update: checks if there are both player start and deathmatch in the map to switch... because if you'd use this in a kz map it would delete all spawns =)
__________________

Last edited by Hunter-Digital; 08-12-2009 at 15:07.
Hunter-Digital is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-12-2009 , 15:25   Re: Reverse Player Spawns
Reply With Quote #17

Good job man! Nice to see originality! ;)
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 08-12-2009 , 21:36   Re: Reverse Player Spawns
Reply With Quote #18

This works, no creating/deleting spawns:

PHP Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN    "Swap Spawns"
#define AUTHOR    "stupok"
#define VERSION    "1.0"

#define MAX_SPAWNS    32

new g_iSwapped

new g_iSpawnCount_T
new g_iSpawnIndexes_T[MAX_SPAWNS]
new 
g_iSpawnDisabled_T[MAX_SPAWNS]
new 
Float:g_flSpawnOrigins_T[MAX_SPAWNS][3]
new 
Float:g_flSpawnAngles_T[MAX_SPAWNS][3]

new 
g_iSpawnCount_CT
new g_iSpawnIndexes_CT[MAX_SPAWNS]
new 
g_iSpawnDisabled_CT[MAX_SPAWNS]
new 
Float:g_flSpawnOrigins_CT[MAX_SPAWNS][3]
new 
Float:g_flSpawnAngles_CT[MAX_SPAWNS][3]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd"swapspawns""SwapSpawns"ADMIN_BAN"Swaps spawns" )
    
    
FindSpawns()
}

public 
FindSpawns()
{
    new 
iEnt = -1
    
    
while( ( iEnt find_ent_by_classiEnt"info_player_deathmatch" ) ) )
    {
        
g_iSpawnIndexes_T[g_iSpawnCount_T] = iEnt
        entity_get_vector
iEntEV_VEC_origing_flSpawnOrigins_T[g_iSpawnCount_T] )
        
entity_get_vectoriEntEV_VEC_anglesg_flSpawnAngles_T[g_iSpawnCount_T] )
        
        if( ++
g_iSpawnCount_T == MAX_SPAWNS )
            break
    }
    
    
iEnt = -1
    
    
while( ( iEnt find_ent_by_classiEnt"info_player_start" ) ) )
    {
        
g_iSpawnIndexes_CT[g_iSpawnCount_CT] = iEnt
        entity_get_vector
iEntEV_VEC_origing_flSpawnOrigins_CT[g_iSpawnCount_CT] )
        
entity_get_vectoriEntEV_VEC_anglesg_flSpawnAngles_CT[g_iSpawnCount_CT] )
        
        if( ++
g_iSpawnCount_CT == MAX_SPAWNS )
            break
    }
}

public 
SwapSpawnsidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED
    
    
if( !g_iSwapped )
    {
        
// disable extra t spawns
        
if( g_iSpawnCount_CT g_iSpawnCount_T )
        {
            for( new 
g_iSpawnCount_CTg_iSpawnCount_Ti++ )
            {
                
g_iSpawnDisabled_T[i] = 1
                entity_set_string
g_iSpawnIndexes_T[i], EV_SZ_classname"_info_player_deathmatch" )
            }
        }
        
// disable extra ct spawns
        
else if( g_iSpawnCount_T g_iSpawnCount_CT )
        {
            for( new 
g_iSpawnCount_Tg_iSpawnCount_CTi++ )
            {
                
g_iSpawnDisabled_CT[i] = 1
                entity_set_string
g_iSpawnIndexes_CT[i], EV_SZ_classname"_info_player_start" )
            }
        }
    }
    else
    {
        new 
iMax maxg_iSpawnCount_Tg_iSpawnCount_CT )
        
        for( new 
0iMaxi++ )
        {
            if( 
g_iSpawnDisabled_CT[i] )
            {
                
g_iSpawnDisabled_CT[i] = 0
                entity_set_string
g_iSpawnIndexes_CT[i], EV_SZ_classname"info_player_start" )
            }
            if( 
g_iSpawnDisabled_T[i] )
            {
                
g_iSpawnDisabled_T[i] = 0
                entity_set_string
g_iSpawnIndexes_T[i], EV_SZ_classname"info_player_deathmatch" )
            }
        }
    }
    
    new 
iMin ming_iSpawnCount_Tg_iSpawnCount_CT )
    
    new 
Float:flTemp[3]
    
    for( new 
0iMini++ )
    {
        
flTemp g_flSpawnOrigins_T[i]
        
g_flSpawnOrigins_T[i] = g_flSpawnOrigins_CT[i]
        
g_flSpawnOrigins_CT[i] = flTemp
        
        flTemp 
g_flSpawnAngles_T[i]
        
g_flSpawnAngles_T[i] = g_flSpawnAngles_CT[i]
        
g_flSpawnAngles_CT[i] = flTemp
        
        entity_set_origin
g_iSpawnIndexes_T[i], g_flSpawnOrigins_T[i] )
        
entity_set_vectorg_iSpawnIndexes_T[i], EV_VEC_anglesg_flSpawnAngles_T[i] )
        
entity_set_origing_iSpawnIndexes_CT[i], g_flSpawnOrigins_CT[i] )
        
entity_set_vectorg_iSpawnIndexes_CT[i], EV_VEC_anglesg_flSpawnAngles_CT[i] )
    }
    
    
g_iSwapped = !g_iSwapped
    
    
return PLUGIN_HANDLED

__________________
stupok is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-13-2009 , 00:58   Re: Reverse Player Spawns
Reply With Quote #19

Hmm, yes indeed it works, I added your code ideea, thanks

New version (1.2) uploaded, it's morning here, I'm a little dizzy and I *may* have done some serious logic errors in there... but the plugin works just fine
__________________
Hunter-Digital is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2009 , 07:25   Re: Reverse Player Spawns
Reply With Quote #20

Nice.
May be last missing feature is a cvar to turn off logging.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 16:27.


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