Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Spawn Protection. Урон игроку

Статус пользователя rasskazov
сообщение 18.7.2016, 11:24
Сообщение #1


Стаж: 13 лет
Город: Где-то в Крыму)

Сообщений: 499
Благодарностей: 158
Полезность: 436

Есть плагин, защита на респе N-кол-во сек.
Можно сделать чтобы игрок , в защите не мог наносить урон игроку у которого нет защиты?)
Я думаю это не сложно..
Вот код:

Cкрытый текст
Код
#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_THICK
new 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
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: