• Страница 1 из 1
  • 1
Форум » Counter-Strike 1.6 » Сервер Counter-Strike 1.6 » Помощь по скриптингу » Freezing Ability
Freezing Ability
Дата: Понедельник, 25.02.2019, 14:07 | Сообщение # 1
Дух ( Новичок )
Offline
  • MayroN
  • Репутация: 0
  • Сообщений:1
  • Разработчик
  • Статус пользователя Я бы изменил этот мир,но Бог не дает исходников...
Вы можете исправить способность замораживания в плагине.
Т. е., если игрок заморожен, он может сразу двигаться,если начать идти.И также розмораживаеться сходу,если удать по ему ножом или же подойти вплотную.

Это все есть подобное в первой способности окаменения, которая работает так как надо..

public Ability_TypeMainOne ( id, iTarget) - Окаменение
public Ability_TypeMainFour (id, iTarget) - Заморозить


Немогу правильно перенести нужные строки

Спасибо.


Код
#include <amxmodx>

Добавлено (25.02.2019, 14:11)
---------------------------------------------


Дата: Понедельник, 25.02.2019, 17:58 | Сообщение # 2
Любитель
Offline
  • shield
  • Репутация: 7
  • Сообщений:38
  • Постоянный
  • Статус пользователя i am from india
    and learning some russian
    i just love this amba
[code]#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <dhudmessage>
#include <ColorChat>
#include <xs>

#define PLUGIN "Elemental Knife"
#define VERSION "1.0"
#define AUTHOR "EpisCape"

#define MAX_KNIVES 4
#define MSG_LENGTH 255
#define TIME_THINK 1.0
#define TASK_TOSSGLOWREMOVE 0x653
#define TASK_FIRE 0x379

#define CLASSNAME_DEFAULT "info_null"
#define CLASSNAME_STANBLOCK "info_stanblock"
#define CLASSNAME_STANBLOCKCRASH "info_stanblockcrash"
#define CLASSNAME_ICECUBE "info_icebuce"
#define CLASSNAME_ICECUBECRASH "info_icecubecrash"

/* ==========================================
---------------- Настройки ----------------
========================================== */
#define PREFIX_INFO "[Нож Смерти]" // Префикс
#define RELOAD_ABILITY 10.0 // Перезарядка способности (сек)

// 1 нож
#define RELOAD_TIME_STANBLOCK 3.0 // Длительность окаменения (сек)
#define DAMAGE_HEALTH_STANBLOCK 35.0 // Наносимый урон от окаменения

// 2 нож
#define TOSS_POWER_SHIFT 4.0 // Сила смещения подброса
#define TOSS_POWER_FLIP 400.0 // Сила подкидывания подброса
#define TOSS_ZONE_DIST 300.0 // Зона поражения для рядом стоящих игроков (в юнитах)

// 3 нож
#define FIRE_TIME 3.0 // Длительность горения (сек)
#define FIRE_DAMAGE 20.0 // Наносимый урон от горения (в секунду)

// 4 нож
#define WATER_CUBE_LIFE_TIME 4.0 // Длительность наводнения (сек)
#define WATER_CUBE_DMG_HEALTH 10.0 // Наносимый урон от наводнения

enum KNIVES_TYPE
{
KNIFE_ONE = 0,
KNIFE_TWO,
KNIFE_THREE,
KNIFE_FOUR
};

new const KNIVES_LIST[MAX_KNIVES][] =
{
"Клинки",
"Кинджал",
"Телекинез",
"Смертельная Коса"
};

new const KNIVES_INFO_ABILITY[MAX_KNIVES][] =
{
"Окаменение",
"Подброс",
"Поджигание",
"Наводнение"
};

new const ELEMS_MODELS_VIEW[MAX_KNIVES][] =
{
"models/knife_dm/v_knife_ghost.mdl",
"models/knife_dm/v_knife_nexon.mdl",
"models/knife_dm/v_knife_telekinesis.mdl",
"models/knife_dm/v_knife_thanatos.mdl"
};

new const ELEMS_MODELS_WEAPON[MAX_KNIVES][] =
{
"models/knife_dm/p_knife_ghost.mdl",
"models/knife_dm/p_knife_nexon.mdl",
"models/knife_dm/p_knife_telekinesis.mdl",
"models/knife_dm/p_knife_thanatos.mdl"
};

new const ELEMS_MODELS[][] =
{
"models/knife_dm/earth_stone.mdl",
"models/knife_dm/earth_stone_crash.mdl",
"models/knife_dm/water_cube.mdl",
"models/knife_dm/water_cube_crash.mdl"
};

new const ELEMS_SOUND_WORLD[][] =
{
"knife_dm/miss"
};

new const ELEMS_SOUND_AMBIENT[][] =
{
"knife_dm/earth_block.wav",
"knife_dm/earth_block_crash.wav",
"knife_dm/fire_scream.wav"
};

new const ELEMS_SPRITE[][] =
{
"sprites/knife_dm/fire_flame.spr"
};

new g_iKnife[33], g_iButton[33], g_iCurMaxSpeed[33], g_iFireAttacker[33], g_iWaterAttacker[33], g_iSpriteFire, bool:g_bFirstTime[33];
new g_sMsgHudInfo[33][MSG_LENGTH+1];
new Float: g_fTimeMsg[33], Float: g_fCurTime, Float: g_fTimeAbility[33],
Float: g_fTimeStan[33], Float: g_fFireTime[33], Float: g_fTimeFrost[33];
new bool: g_bStan[33], bool: g_bToss[33], bool: g_bFire[33], bool: g_bFrost[33];

public plugin_precache()
{
for(new i; i < MAX_KNIVES; i++)
{
engfunc(EngFunc_PrecacheModel, ELEMS_MODELS_VIEW[i]);
engfunc(EngFunc_PrecacheModel, ELEMS_MODELS_WEAPON[i]);
}

for(new i; i < sizeof(ELEMS_MODELS); i++)
engfunc(EngFunc_PrecacheModel, ELEMS_MODELS[i]);

new sBufferPath[256];

for(new i; i < sizeof(ELEMS_SOUND_WORLD); i++)
{
format(sBufferPath, charsmax(sBufferPath), "%s.wav", ELEMS_SOUND_WORLD[i]);
engfunc(EngFunc_PrecacheSound, sBufferPath);
}

for(new i; i < sizeof(ELEMS_SOUND_AMBIENT); i++)
engfunc(EngFunc_PrecacheSound, ELEMS_SOUND_AMBIENT[i]);

g_iSpriteFire = engfunc(EngFunc_PrecacheModel, ELEMS_SPRITE[0]);
}

public client_connect(id)
{
client_cmd(id, "bind ^"x^" ^"knife^"")
g_iKnife[id] = random_num(0, MAX_KNIVES-1);
}

public client_disconnect(id)
{
if(task_exists(id + TASK_TOSSGLOWREMOVE))
remove_task(id + TASK_TOSSGLOWREMOVE);

g_iWaterAttacker[id] = -1;
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

register_clcmd("knife", "Clcmd_KnifeChoose");

RegisterHam(Ham_Player_PreThink, "player", "fw_HamPlayerThinkPre");
RegisterHam(Ham_Player_PostThink, "player", "fw_HamPlayerThinkPost", true);
RegisterHam(Ham_Spawn, "player", "fw_HamPlayerSpawnPost", true);
RegisterHam(Ham_Killed, "player", "fw_HamPlayerKlliedPost", true);
RegisterHam(Ham_Touch, "player", "fw_HamPlayerTouchPost", true);

RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_HamKnifePostDeploy", .Post = true);

RegisterHam(Ham_Think, CLASSNAME_DEFAULT, "fw_HamEntThinkPost", true);
}

public fw_HamPlayerThinkPre(id)
{
if(!is_user_alive(id))
return;

g_iButton[id] = pev(id, pev_button);

if(g_iButton[id] & IN_USE && g_fTimeAbility[id] <= 0)
Ability_Active_One(id);

if(g_bStan[id] || g_bFrost[id])
set_pev(id, pev_velocity, {0.0, 0.0, -100.0});
}

public fw_HamPlayerThinkPost(id)
{
if(!is_user_alive(id))
return;

g_fCurTime = get_gametime();

if(g_fTimeMsg[id] < g_fCurTime)
{
if(g_fTimeAbility[id] > 0)
{
set_dhudmessage(255, 0, 0, 0.01, 0.92, 1, 0.1, TIME_THINK, 0.1, 0.1);

g_fTimeAbility[id] -= TIME_THINK;
format(g_sMsgHudInfo[id], MSG_LENGTH, "Нож • %s • Ярость • %s • %i секунд(ы) осталось", KNIVES_LIST[g_iKnife[id]], KNIVES_INFO_ABILITY[g_iKnife[id]], floatround(g_fTimeAbility[id]));
}else{
set_dhudmessage(0, 255, 0, 0.01, 0.92, 0, 0.1, TIME_THINK, 0.1, 0.1);

format(g_sMsgHudInfo[id], MSG_LENGTH, "Нож • %s • Ярость • %s • [E]", KNIVES_LIST[g_iKnife[id]], KNIVES_INFO_ABILITY[g_iKnife[id]]);
}

show_dhudmessage(id, "%s", g_sMsgHudInfo[id]);

g_fTimeMsg[id] = g_fCurTime + TIME_THINK;
}
}

public Ability_Active_One(id)
{
new iTarget, iBody;
get_user_aiming(id, iTarget, iBody, 1000);

if(!is_user_alive(iTarget))
{
client_cmd(id, "spk %s", ELEMS_SOUND_WORLD[0]);
g_fTimeAbility[id] = RELOAD_ABILITY / 2;
return;
}

if(get_user_team(id) == get_user_team(iTarget))
{
client_cmd(id, "spk %s", ELEMS_SOUND_WORLD[0]);
g_fTimeAbility[id] = RELOAD_ABILITY / 2;
return;
}

if(g_bStan[iTarget] || g_bToss[iTarget] || g_bFire[iTarget] || g_bFrost[iTarget])
{
client_cmd(id, "spk %s", ELEMS_SOUND_WORLD[0]);
g_fTimeAbility[id] = RELOAD_ABILITY / 2;
return;
}

switch(g_iKnife[id])
{
case KNIFE_ONE: Ability_TypeMainOne(id, iTarget);
case KNIFE_TWO: Ability_TypeMainTwo(id, iTarget);
case KNIFE_THREE: Ability_TypeMainThree(id, iTarget);
case KNIFE_FOUR: Ability_TypeMainFour(id, iTarget);
}

g_fTimeAbility[id] = RELOAD_ABILITY;
}

public Ability_TypeMainOne(id, iTarget)
{
new Float: fOrigin[3];
pev(iTarget, pev_origin, fOrigin);

engfunc(EngFunc_DropToFloor, iTarget);
g_iCurMaxSpeed[iTarget] = pev(iTarget, pev_maxspeed);
set_pev(iTarget, pev_maxspeed, -1.0);

g_fTimeStan[iTarget] = RELOAD_TIME_STANBLOCK;
g_bStan[iTarget] = true;

new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CLASSNAME_DEFAULT));

set_pev(iEnt, pev_classname, CLASSNAME_STANBLOCK);
set_pev(iEnt, pev_origin, fOrigin);
set_pev(iEnt, pev_owner, iTarget);

engfunc(EngFunc_DropToFloor, iEnt);
engfunc(EngFunc_SetModel, iEnt, ELEMS_MODELS[0]);
engfunc(EngFunc_EmitSound, iEnt, 0, ELEMS_SOUND_AMBIENT[0], 1.0, 1.0, 0, 100);

set_ent_animation(iEnt, 0, 1.0, 1.0);

ExecuteHamB(Ham_TakeDamage, iTarget, iEnt, id, DAMAGE_HEALTH_STANBLOCK, DMG_GENERIC);

set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
}

public Ability_TypeMainTwo(id, iTarget)
{
new iVictim = FM_NULLENT, Float: fOrigin[3], Float: fVelocity[3], Float: fData[3];
pev(iTarget, pev_origin, fOrigin);

while((iVictim = engfunc(EngFunc_FindEntityInSphere, iVictim, fOrigin, TOSS_ZONE_DIST)))
{
if(!is_user_alive(iVictim))
continue;

if(get_user_team(iTarget) != get_user_team(iVictim))
continue;

if(g_bToss[iVictim])
continue;

g_bToss[iVictim] = true;

switch(random_num(0, 2))
{
case 0: global_get(glb_v_forward, fData)
case 1: global_get(glb_v_up, fData);
case 2: global_get(glb_v_right, fData);
}

if(vector_length(fVelocity) < 100)
{
fData[0] += random_float(100.0, 300.0);
fData[1] += random_float(100.0, 300.0);
fData[2] += random_float(100.0, 300.0);
}

pev(iVictim, pev_velocity, fVelocity);

xs_vec_add(fVelocity, fData, fVelocity);
xs_vec_mul_scalar(fVelocity, TOSS_POWER_SHIFT, fVelocity);

fVelocity[2] += TOSS_POWER_FLIP;
set_pev(iVictim, pev_velocity, fVelocity);

set_task(1.0, "Toss_EffectRemove", iVictim + TASK_TOSSGLOWREMOVE);
}
}

public Ability_TypeMainThree(id, iTarget)
{

g_bFire[iTarget] = true;
g_fFireTime[iTarget] = FIRE_TIME;

g_iFireAttacker[iTarget] = id;
set_task(0.1, "Fire_Think", iTarget + TASK_FIRE, .flags = "b");
}

public Ability_TypeMainFour(id, iTarget)
{
new Float: fOrigin[3];
pev(iTarget, pev_origin, fOrigin);

engfunc(EngFunc_DropToFloor, iTarget);

g_fTimeFrost[iTarget] = WATER_CUBE_LIFE_TIME;
g_bFrost[iTarget] = true;

new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CLASSNAME_DEFAULT));

set_pev(iEnt, pev_classname, CLASSNAME_ICECUBE);
set_pev(iEnt, pev_origin, fOrigin);
set_pev(iEnt, pev_owner, iTarget);

engfunc(EngFunc_DropToFloor, iEnt);
engfunc(EngFunc_SetModel, iEnt, ELEMS_MODELS[2]);
engfunc(EngFunc_EmitSound, iEnt, 0, ELEMS_SOUND_AMBIENT[0], 1.0, 1.0, 0, 100);

set_ent_animation(iEnt, 0, 1.0, 1.0);

g_iWaterAttacker[iTarget] = id;

set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
}

public fw_HamPlayerSpawnPost(id)
{
if(!is_user_connected(id))
return;
g_bFirstTime[id] = false
Clcmd_KnifeChoose(id)

g_bStan[id] = false;
g_bToss[id] = false;
g_bFire[id] = false;
g_bFrost[id] = false;
}

public fw_HamPlayerKlliedPost(iVictim, iAttacker, iCorpse)
{
if(!is_user_connected(iVictim))
return;

}

public fw_HamPlayerTouchPost(id, iTarget)
{
if(!is_user_alive(id) || !is_user_alive(iTarget))
return;

if(get_user_team(id) != get_user_team(iTarget))
return;

if(g_bStan[id] && !g_bStan[iTarget])
Ability_TypeMainOne(id, iTarget);

if(g_bFire[id] && !g_bFire[iTarget])
Ability_TypeMainFour(id, iTarget);
}

public fw_HamEntThinkPost(iEnt)
{
if(!pev_valid(iEnt))
return;

static sClassName[32];
pev(iEnt, pev_classname, sClassName, charsmax(sClassName));

if(equal(CLASSNAME_STANBLOCK, sClassName))
{
static iTarget; iTarget = pev(iEnt, pev_owner);

if(!is_user_alive(iTarget) && is_user_connected(iTarget))
{
g_bStan[iTarget] = false;
set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME);

engfunc(EngFunc_EmitSound, iEnt, 0, ELEMS_SOUND_AMBIENT[1], 1.0, 1.0, 0, 100);
return;
}

if(g_fTimeStan[iTarget] > 0)
{
g_fTimeStan[iTarget] -= 0.1;

static Float: fOrigin[3];
pev(iTarget, pev_origin, fOrigin);
set_pev(iEnt, pev_origin, fOrigin);

engfunc(EngFunc_DropToFloor, iEnt);

set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
}else{
g_bStan[iTarget] = false;
set_pev(iTarget, pev_maxspeed, float(g_iCurMaxSpeed[iTarget]));

set_ent_animation(iEnt, 0, 4.0, 1.0);

set_pev(iEnt, pev_classname, CLASSNAME_STANBLOCKCRASH);
engfunc(EngFunc_SetModel, iEnt, ELEMS_MODELS[1]);

set_pev(iEnt, pev_nextthink, get_gametime() + 4.0);
}
}

if(equal(CLASSNAME_ICECUBE, sClassName))
{
static iTarget; iTarget = pev(iEnt, pev_owner);

static Float: fOrigin[3], Float: fOrigin2[3], iVictim;
static Float: fFrostTime[33], iAttacker;
pev(iEnt, pev_origin, fOrigin);
iAttacker = is_user_connected(g_iWaterAttacker[iTarget]) ? g_iWaterAttacker[iTarget] : iTarget;

iVictim = FM_NULLENT;
while((iVictim = engfunc(EngFunc_FindEntityInSphere, iVictim, fOrigin, 50.0)))
{
if(!is_user_alive(iVictim))
continue;

if(get_user_team(iTarget) == get_user_team(iVictim))
{
if(fFrostTime[iVictim] < g_fCurTime)
{
ExecuteHamB(Ham_TakeDamage, iTarget, iAttacker, iAttacker, WATER_CUBE_DMG_HEALTH, DMG_DROWN);
fFrostTime[iTarget] = g_fCurTime + 1.0;
}
}

pev(iVictim, pev_origin, fOrigin2);

if(get_distance_f(fOrigin, fOrigin2) > 50.0)
{
g_fTimeFrost[iTarget] = 0.0;
break;
}
}

if(g_fTimeFrost[iTarget] > 0)
{
g_fTimeFrost[iTarget] -= 0.1;

set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
}else{
g_bFrost[iTarget] = false;

set_ent_animation(iEnt, 0, 4.0, 1.0);

set_pev(iEnt, pev_classname, CLASSNAME_STANBLOCKCRASH);
engfunc(EngFunc_SetModel, iEnt, ELEMS_MODELS[3]);

set_pev(iEnt, pev_nextthink, get_gametime() + 4.0);
}
}

if(equal(CLASSNAME_STANBLOCKCRASH, sClassName) || equal(CLASSNAME_ICECUBECRASH, sClassName))
{
engfunc(EngFunc_EmitSound, iEnt, 0, ELEMS_SOUND_AMBIENT[1], 1.0, 1.0, 0, 100);
set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME);
}
}

public Toss_EffectRemove(task_id)
{
new iTarget = task_id - TASK_TOSSGLOWREMOVE;

if(!is_user_alive(iTarget))
return;

if(g_bToss[iTarget])
{
g_bToss[iTarget] = false;
}
}

public Fire_Think(task_id)
{
new iTarget = task_id - TASK_FIRE;

if(!is_user_alive(iTarget))
g_bFire[iTarget] = false;

if(g_bFire[iTarget])
{
if(g_fFireTime[iTarget] > 0)
{
if(pev(iTarget, pev_flags) & FL_INWATER)
{
remove_task(task_id);
g_bFire[iTarget] = false;
return;
}

static iOrigin[3];
get_user_origin(iTarget, iOrigin);

message_begin(MSG_ALL, SVC_TEMPENTITY, iOrigin)
write_byte(TE_SPRITE);
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_short(g_iSpriteFire)
write_byte(10);
write_byte(1000);
message_end();

static Float: fFireTime[33];

if(fFireTime[iTarget] < g_fCurTime)
{
new iAttacker = is_user_connected(g_iFireAttacker[iTarget]) ? g_iFireAttacker[iTarget] : iTarget;
ExecuteHamB(Ham_TakeDamage, iTarget, iAttacker, iAttacker, FIRE_DAMAGE, DMG_BURN);

g_fFireTime[iTarget] -= 1.0;
fFireTime[iTarget] = g_fCurTime + 1.0;
}
}else{

g_iFireAttacker[iTarget] = -1;
g_bFire[iTarget] = false;
}
}
else
remove_task(task_id);
}

public Clcmd_KnifeChoose(id)
{
new iMenu, sItem[64], sInfo[3];

iMenu = menu_create("\rНож Смерти^n\yВыбор Ножа\w", "KnifeChoose_Handler");

for(new i; i < MAX_KNIVES; i++)
{
format(sItem, charsmax(sItem), g_iKnife[id] == i ? "\y%s" : "\w%s", KNIVES_LIST[i], KNIVES_LIST[i]);
num_to_str(i, sInfo, charsmax(sInfo));
menu_additem(iMenu, sItem, sInfo);
}
menu_setprop(iMenu, MPROP_PERPAGE, 0);
menu_display(id, iMenu);
}

public KnifeChoose_Handler(id, iMenu, iItem)
{
if(iItem == MENU_EXIT)
return;

if(g_iKnife[id] == iItem)
{
ColorChat(0, RED, "^4%s ^3У Вас уже есть этот Нож", PREFIX_INFO);
return;
}

g_iKnife[id] = iItem;

if(is_user_alive(id))
{
ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373));

g_fTimeAbility[id] = RELOAD_ABILITY;
}

ColorChat(0, RED, "^4%s ^3Нож ^4%s", PREFIX_INFO, KNIVES_LIST[g_iKnife[id]]);
ColorChat(0, RED, "^4%s ^3Ярость ^4%s", PREFIX_INFO, KNIVES_INFO_ABILITY[g_iKnife[id]]);
}

public fw_HamKnifePostDeploy(iWeapon)
{
new id = get_pdata_cbase(iWeapon, 41, 4);

if(!is_user_alive(id))
return;

set_pev(id, pev_viewmodel2, ELEMS_MODELS_VIEW[g_iKnife[id]]);
set_pev(id, pev_weaponmodel2, ELEMS_MODELS_WEAPON[g_iKnife[id]]);
}

stock set_ent_animation(iEnt, iAnim, Float: fAnimTime, Float: fFrame)
{
set_pev(iEnt, pev_sequence, iAnim);
set_pev(iEnt, pev_animtime, fAnimTime);
set_pev(iEnt, pev_framerate, fFrame);
set_pev(iEnt, pev_frame, 0.0);
}
[/php]
Сообщение отредактировал shield - Понедельник, 25.02.2019, 17:59
Форум » Counter-Strike 1.6 » Сервер Counter-Strike 1.6 » Помощь по скриптингу » Freezing Ability
  • Страница 1 из 1
  • 1
Поиск:
(threadpage)