Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spectator Fix
#1
This plugin allows HLDM players to go to spectator and back. It also adds the functionality of writing /spec in chat to alternate between states.

Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME    "Spectator Fix"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR  "sToP !"

#define HUD_OFFSET 296

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

    register_concmd("spectate", "hook_spectate")
    register_clcmd("say /spec", "chat_spectate")
}

public chat_spectate(id)
{
    client_cmd(id, "spectate")
    return PLUGIN_CONTINUE    
}

public hook_spectate(id)
{
    if(pev(id, pev_iuser1) || pev(id, pev_iuser2))
    {
          spawn_player(id)
          return PLUGIN_HANDLED
    }
 
    return PLUGIN_CONTINUE
}

spawn_player(id)
{
    set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
    dllfunc(DLLFunc_Spawn, id)
    set_pev(id, pev_iuser1, 0)
    set_pev(id, pev_iuser2, 0)
    set_pdata_int(id, HUD_OFFSET, 0)
   
    new szTeam[16]
    get_user_info(id,"model", szTeam, charsmax(szTeam))

    message_begin(MSG_ALL, get_user_msgid("TeamInfo"))
    write_byte(id)
    write_string(szTeam)
    message_end()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)