AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spectate system (https://forums.alliedmods.net/showthread.php?t=216697)

alonelive 05-24-2013 13:20

Spectate system
 
Hello once more! :)

Can we write a spectate system for cs 1.6? without use mp_forcecamera, mp_forcechasecam and etc.?

Each dead player can view only his alive teammates (fps, free chase cam, locked chase cam). Admin can view everybody alive in both teams (all spectator's mode include free look).

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define ADMIN_LEVEL ADMIN_BAN

new g_iMaxPlayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Killed"player""OnCBasePlayer_Killed_Post"true)
    
g_iMaxPlayers get_maxplayers()
}

public 
OnCBasePlayer_Killed_Postidkiller )
{
    if( !
killer || killer g_iMaxPlayers || id == killer )
    {
        return
    }
   
    new 
players[32], inum
    get_players
(playersinum)
       
    for (new 
0inum; ++i)
    {
        new 
iTeam cs_get_user_team(id)  // get team of dead player
        
        
if(is_user_admin(id))
        {
            
// admin can spectate everybody
            // ?.. if(is_user_alive(players[i])
            // ?.. set_view(random....
        
}
        else
        {
            
// dead player (access level "user") can view ONLY everybody in his team)
            // ?.. if(is_user_alive(players[i]) && (cs_get_user_team(players[i]) == iTeam))
            // ?.. set_view(random....
        
}
    }



bat 06-22-2013 04:45

Re: Spectate system
 
Man search in alliedmoders (facepalm) that plugins have 3 years old


All times are GMT -4. The time now is 16:27.

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