Page 1 of 1

Spawn protection

Posted: 2014 Dec 15 22:14
by acTesT
Sveiki, gal kas turit pluginą normalų optimatizuoto kodo Spawn protection'ą? :)

Re: Spawn protection

Posted: 2014 Dec 15 22:43
by NZT
Sveikas, štai prašom:

Code: Select all

#include <amxmodx>#include <hamsandwich>#include <fun> #define PLUGIN "Spawn Protection"#define VERSION "1.2"#define AUTHOR "Safety1st" #define GLOW_THICK 10   // set glow shell thickness here from 1 to 100; comment to disable glow new pSPtime public plugin_init() {    register_plugin( PLUGIN, VERSION, AUTHOR )     pSPtime = register_cvar( "sp_time", "3" )   // cvar for controlling protection time     RegisterHam( Ham_Spawn, "player", "FwdSpawnPost", .Post = 1 )} #if defined GLOW_THICKnew giSPthick public plugin_cfg() {    giSPthick = clamp( GLOW_THICK, 1, 100 )}#endif public FwdSpawnPost(id) {    // check is needed because HamSpawn is called for spectators too    if ( !is_user_alive(id) )        return     // enable protection    set_user_godmode( id, .godmode = 1 ) #if defined GLOW_THICK    if ( giSPthick ) {        switch ( get_user_team(id) ) {            case 0  : {                // game without teams, random color                set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, giSPthick )            }            case 1  : set_user_rendering( id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, giSPthick /* red */ )            default : set_user_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, giSPthick /* blue */ )        }    }#endif     set_task( get_pcvar_float( pSPtime ), "DisableProtection", id )} public DisableProtection(id) {    if ( !is_user_connected(id) )        return     set_user_godmode(id)    // disable godmode #if defined GLOW_THICK    if ( giSPthick )        set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0 )#endif}

Re: Spawn protection

Posted: 2014 Dec 16 17:24
by acTesT
Ačiū, pasiredaguosiu biški :)