Raised This Month: $ Target: $400
 0% 

[REQ] play as spec


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cs1.7
Senior Member
Join Date: Oct 2008
Old 07-19-2009 , 03:30   [REQ] play as spec
Reply With Quote #1

a 3rd team in CS... The spectators.

A player types /specplay in chat and he gets spawned on a random place on the map CT or T spawn.

  • he spawns with p228,TMP, m4
  • has VIP model
  • he is respawned every 20 seconds

Last edited by cs1.7; 09-14-2010 at 01:51.
cs1.7 is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 09-13-2010 , 23:46   Re: [REQ] /specwarrior
Reply With Quote #2



can someone make this? will be fun!!!


---------

edit:


a try:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin("Spec Warrior",VERSION,"XXX")
    
register_clcmd"say /spec""chat_trigger" );
    
RegisterHam(Ham_Killed,"player","Forward_PlayerKilled",1)
}


public 
chat_trigger(id)
{
    
cs_set_user_teamidCS_TEAM_SPECTATOR )
    
set_task(20.0,"Countdown",id)
}

public 
Forward_PlayerKilled(id)
{
    if(
is_user_connected(id))
    {        
        
Countdown(id)
    }
}

public 
Countdown(id)
{
        
set_hudmessage(255255255, -1.00.3000.01.10.00.0, -1)
        
show_hudmessage(id"You Will Respawn in %d seconds...")

        
ExecuteHam(Ham_CS_RoundRespawn,id)
        
cs_set_user_model(id"vip")
        
cs_give_itemid"weapon_fiveseven" )
        
cs_set_user_bpammoidCSW_FIVESEVEN100 )
        
cs_give_itemid"weapon_tmp" )
        
cs_set_user_bpammoidCSW_TMP120 )
        
cs_give_itemid"weapon_m4a1" )
        
cs_set_user_bpammoidCSW_M4A190 )





__________________
_____________
/_____\
[° ||| °]
./..............\▓

Last edited by cs1.7; 09-14-2010 at 00:32.
cs1.7 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-14-2010 , 01:32   Re: [REQ] play as spec
Reply With Quote #3

Will still have things to fix but should be better :

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define VERSION    "1.0"

new CsTeams:g_iOldTeam[33]
new 
g_iMaxPlayers

public plugin_init()
{
    
register_plugin("Spec Warrior",VERSION,"XXX")

    
RegisterHam(Ham_Killed,"player","Forward_PlayerKilled",1)
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
g_iMaxPlayers get_maxplayers()
}

public 
client_putinserverid )
{
    
g_iOldTeam[id] = CS_TEAM_UNASSIGNED
}

public 
client_disconnectid )
{
    
g_iOldTeam[id] = CS_TEAM_UNASSIGNED
}

public 
Event_HLTV_New_Round()
{
    new 
CsTeams:iTeam
    
for(new id=1id<=g_iMaxPlayersid++)
    {
        
remove_task(id)
        if( 
is_user_connected(id) )
        {
            
iTeam g_iOldTeam[id]
            if( 
CS_TEAM_T <= iTeam <= CS_TEAM_CT )
            {
                
cs_set_user_team(idiTeam)
                
g_iOldTeam[id] = CS_TEAM_UNASSIGNED
            
}
        }
    }
}

public 
Forward_PlayerKilled(id)
{
    new 
CsTeams:iTeam cs_get_user_team(id)
    if( 
iTeam != CS_TEAM_SPECTATOR )
    {
        
g_iOldTeam[id] = iTeam
    
}

    
set_task(20.0"RespawnSpec"id)
}

public 
RespawnSpec(id)
{
    if( !
is_user_connected(id) )
    {
        return
    }

    
ExecuteHamB(Ham_CS_RoundRespawn,id)
    
cs_set_user_vip(id)
    
give_itemid"weapon_fiveseven" )
    
cs_set_user_bpammoidCSW_FIVESEVEN100 )
    
give_itemid"weapon_tmp" )
    
cs_set_user_bpammoidCSW_TMP120 )
    
give_itemid"weapon_m4a1" )
    
cs_set_user_bpammoidCSW_M4A190 )

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 09-14-2010 , 15:03   Re: [REQ] play as spec
Reply With Quote #4

thx ..but all the plugin does ..is transfer me to a team if i join specs


edit


ok got this working.

3 things missing:


  • vip model aint workin'. I guess that function is a different thing. Not mdl related.
  • no guns are given.
  • after death ..player isnt respawned.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich> 

#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin("Spec Warrior",VERSION,"XXX")
    
register_clcmd"say /spec""chat_trigger" );
    
RegisterHam(Ham_Killed,"player","Forward_PlayerKilled",1)
}


public 
chat_trigger(id)
{
    
cs_set_user_teamidCS_TEAM_SPECTATOR )
    
ExecuteHamB(Ham_CS_RoundRespawn,id)
    
cs_set_user_vip(id)
    
give_itemid"weapon_fiveseven" )
    
cs_set_user_bpammoidCSW_FIVESEVEN100 )
    
give_itemid"weapon_tmp" )
    
cs_set_user_bpammoidCSW_TMP120 )
    
give_itemid"weapon_m4a1" )
    
cs_set_user_bpammoidCSW_M4A190 )
}

public 
Forward_PlayerKilled(id)
{
    if( (
is_user_connected(id)) && (cs_get_user_team(id) == CS_TEAM_SPECTATOR) )
    {
    
Countdown(id)
    }
}

public 
Countdown(id)
{
    
set_hudmessage(255255255, -1.00.3000.01.10.00.0, -1)
    
show_hudmessage(id"You Will Respawn in %d seconds...")

    
ExecuteHamB(Ham_CS_RoundRespawn,id)
    
cs_set_user_vip(id)
    
give_itemid"weapon_fiveseven" )
    
cs_set_user_bpammoidCSW_FIVESEVEN100 )
    
give_itemid"weapon_tmp" )
    
cs_set_user_bpammoidCSW_TMP120 )
    
give_itemid"weapon_m4a1" )
    
cs_set_user_bpammoidCSW_M4A190 )

__________________
_____________
/_____\
[° ||| °]
./..............\▓

Last edited by cs1.7; 09-14-2010 at 15:38.
cs1.7 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 09-14-2010 , 16:43   Re: [REQ] play as spec
Reply With Quote #5

I think you need to set a task to spawn them when they die. Also, since you are using ExecuteHamB(), hook Ham_Spawn and see if they are alive, and then give them the weapons.
__________________
RedRobster is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-15-2010 , 02:09   Re: [REQ] play as spec
Reply With Quote #6

I know problem, cs_set_user_vip should only workd with CTs, may be same problem with give_item.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
surfguitarkevin
Member
Join Date: Aug 2007
Old 09-15-2010 , 06:19   Re: [REQ] play as spec
Reply With Quote #7

will the spectators have a hud display? also, i now want a ham sandwich and there is nowhere to get one at 6am
__________________

Last edited by surfguitarkevin; 09-15-2010 at 06:21.
surfguitarkevin is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 09-15-2010 , 06:34   Re: [REQ] play as spec
Reply With Quote #8

those things are missing:

  • hud display (top right of screen) for spectators that displays their K/D score
  • a few specified spawn points/origins for specs. Neutral zone
__________________
_____________
/_____\
[° ||| °]
./..............\▓

Last edited by cs1.7; 09-15-2010 at 07:04.
cs1.7 is offline
Slifer
Junior Member
Join Date: Sep 2010
Old 09-16-2010 , 12:40   Re: [REQ] play as spec
Reply With Quote #9

try this.

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <engine>

const Float:SPECTATOR_RESPAWN_TIME =                10.0

new CsTeamsg_iTeam[33];

new 
g_iMaxPlayersg_MsgSync;

public 
plugin_init()
{
    
register_plugin"Spec Can Play""1.0""Slifer" )
    
    
RegisterHamHam_Killed"player""fw_PlayerKilled" )
    
RegisterHamHam_Spawn,  "player""fw_PlayerSpawn")
    
    
register_clcmd"say /spec""TransferPlayerToSpec" )
    
    
g_MsgSync CreateHudSyncObj()
    
g_iMaxPlayers get_maxplayers()
    
    
set_task1.0"SpectatorHud",_,_,_"b" )
}

public 
fw_PlayerSpawnid )
{
    
g_iTeam[id] = cs_get_user_teamid )
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    if( 
g_iTeam[victim] == CS_TEAM_SPECTATOR )
    {
        
set_taskSPECTATOR_RESPAWN_TIME"RespawnPlayer"victim )
    }
}

public 
TransferPlayerToSpecid )
{
    if( 
g_iTeam[id] == CS_TEAM_SPECTATOR )
    {
        
client_printidprint_chat"You alredy are SPECTATOR" )
        return 
PLUGIN_HANDLED;
    }
    
    
cs_set_user_teamidCS_TEAM_SPECTATOR )
    
client_printidprint_chat"You are now SPECT" )
    
    
RespawnPlayerid )
    
    return 
PLUGIN_HANDLED;
}

public 
RespawnPlayerid )
{
    
set_hudmessage02550, -1.00.620.50.10.01.0)
    
show_hudmessage(id"Respawn!" )

    
entity_set_int(idEV_INT_deadflagDEAD_RESPAWNABLE)
    
entity_set_int(idEV_INT_iuser10)
    
call_think(id)
    
DispatchSpawn(id)
    
    
set_user_healthid100 )
    
    
cs_set_user_modelid"vip" )
    
    
GiveWeaponsid )
}

public 
SpectatorHud( )
{
    for( new 
id 1id <= g_iMaxPlayersid++ )
    {
        if( 
g_iTeam[id] == CS_TEAM_SPECTATOR )
        {    
            
set_hudmessage002000.90.210.03.02.01.0, -1)
            
ShowSyncHudMsgidg_MsgSync"Frags: %i^nDeaths: %i"get_user_frags(id), get_user_deaths(id))
        }
    }
}

GiveWeaponsid )
{
    
give_itemid"weapon_fiveseven" )
    
give_itemid"weapon_tmp" )
    
give_itemid"weapon_m4a1" )
    
    
cs_set_user_bpammoidCSW_FIVESEVEN100 )
    
cs_set_user_bpammoidCSW_TMP120 )
    
cs_set_user_bpammoidCSW_M4A190 

Slifer 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:22.


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