Raised This Month: $32 Target: $400
 8% 

[L4D2]Request fix error


Post New Thread Reply   
 
Thread Tools Display Modes
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 07-24-2017 , 04:13   Re: [L4D2]Request fix error
Reply With Quote #11

Quote:
Originally Posted by WatchDogs View Post
OK, Please upload the fix version that works and just has that errors.

What do you mean about privilege ? For doing what ?
This plugin does not work in 2147.
So we need to see how to repair it.

PHP Code:
#include <sourcemod>
#include <sdktools>


#define Version "1.0"
#define CVAR_FLAGS FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY

#define SOUND_BOMB "physics/plastic/plastic_box_break2.wav"

public Plugin:myinfo =
{
    
name="",
    
author="",
    
description="",
    
version=Version,
    
url=""
};

new 
g_iLaggedMovementO    = -1;

new 
Float:bomb_pos[MAXPLAYERS+1][3];
new 
bomb_timer[MAXPLAYERS+1];

new 
Handle:l4d2_icebomb_time;
new 
Handle:l4d2_icebomb_speed;
new 
Handle:l4d2_icebomb_type;
new 
Handle:l4d2_icebomb_surv;
/* 手雷名称 */
//pipe_bomb      土制炸弹
//molotov        燃烧瓶
//vomitjar    胆汁液

//pipe_bomb_projectile    土制炸弹破坏
//molotov_projectile        燃烧瓶破坏
//vomitjar_projectile    胆汁液破坏

public OnPluginStart()
{
    
decl String:game_name[64];
    
GetGameFolderName(game_namesizeof(game_name));
    if (!
StrEqual(game_name"left4dead"false) && !StrEqual(game_name"left4dead2"false))
    {
        
SetFailState("此插件只支持求生之路2,L4D2.");
    }
        
    
g_iLaggedMovementO    =    FindSendPropInfo("CTerrorPlayer","m_flLaggedMovementValue");
    
    
l4d2_icebomb_time CreateConVar("l4d2_icebomb_time","15","冻结持续的时间"CVAR_FLAGS);
    
l4d2_icebomb_speed CreateConVar("l4d2_icebomb_speed","0.5","冻结时的移动速度(0 = 完全冻结,无法动弹)"CVAR_FLAGS);
    
l4d2_icebomb_type CreateConVar("l4d2_icebomb_type","0","可以使用冰冻手雷的物品(0 = 全部 1 = 土制炸弹 2 = 燃烧瓶 3 = 胆汁液)"CVAR_FLAGS);
    
l4d2_icebomb_surv CreateConVar("l4d2_icebomb_surv","0","冰冻手雷对幸存者是否有效(0 = 无效 1 = 有效)"CVAR_FLAGS);
    
    
AutoExecConfig(true"l4d2_Ice_Bomb");
}


/* 判断玩家是否有效 */
public bool:IsValidPlayer(client)
{
    if (
client || client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    
    return 
true;
}

/* 事件-实体被破坏 */
public OnEntityDestroyed(entity)
{
    
decl String:classname[32];
    
    new 
type GetConVarInt(l4d2_icebomb_type);
    
    
//获取实体所有者
    
new client GetEntPropEnt(entityProp_Data"m_hOwnerEntity");
    
    
//获取实体类名
    
GetEdictClassname(entityclassname32);
    
    
//识别实体类名
    
if(StrEqual(classname"pipe_bomb_projectile"false))
    {
        if (
type == || type == 0)
        {        
            
//获取实体坐标
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]);
            
Freeze_Points(client);
        }
    }    
    else if(
StrEqual(classname"molotov_projectile"false))
    {
        if (
type == || type == 0)
        {
            
//获取实体坐标
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]);
            
Freeze_Points(client);
        }
    }
    else if(
StrEqual(classname"vomitjar_projectile"false))
    {
        if (
type == || type == 0)
        {
            
//获取实体坐标
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]);
            
Freeze_Points(client);
        }
    }
    
    
//PrintToChatAll("武器: %s 所有者: %N", classname, client);
}

Freeze_Points(client)
{
    new 
Float:entpos[3];
    new 
Float:distance;
    
    
//开始循环判断
    
for (new 1<= MaxClientsi++)
    {
        
//判断玩家是否在游戏且实体是有效的
        
if (!IsClientInGame(i) || !IsValidEntity(i))
            continue;
        if (!
IsPlayerAlive(i))
            continue;
        if (
GetConVarInt(l4d2_icebomb_surv) == 0)
        {
            if (
GetClientTeam(i) == 2)
                continue;
        }
        
//获取实体坐标
        
GetEntPropVector(iProp_Send"m_vecOrigin"entpos);
        
//对比距离
        
distance GetVectorDistance(bomb_pos[client], entpos);
        if (
distance <= 250)
        {
            
//PrintToChatAll("进入冰冻范围: %N", i);
            
SetEntDataFloat(i,g_iLaggedMovementOGetConVarFloat(l4d2_icebomb_speed),true);
            
ScreenFade(i05020010010001);
            
//运行计时器
            
bomb_timer[i] = 0;
            
CreateTimer(1.0Ice_Bomb_TimeriTIMER_REPEAT);
        }
    }

}

public 
Action:Ice_Bomb_Timer(Handle:timerany:client)
{
    if (!
IsClientInGame(client
        || !
IsValidEntity(client
        || !
IsPlayerAlive(client))
    {
        
//PrintToChatAll("无效解冻: %N", client);
        
bomb_timer[client] = 0;
        
SetEntDataFloat(clientg_iLaggedMovementO1.0true);
        return 
Plugin_Stop;
    }

    
bomb_timer[client] += 1;
    if (
bomb_timer[client] >= GetConVarInt(l4d2_icebomb_time))
    {
        
//PrintToChatAll("正常解冻: %N", client);
        
bomb_timer[client] = 0;
        
SetEntDataFloat(clientg_iLaggedMovementO1.0true);
        return 
Plugin_Stop;    
    }

    new 
Float:entpos[3]    
    new 
Float:effectpos[3];
    
//获取实体坐标
    
GetEntPropVector(clientProp_Send"m_vecOrigin"entpos);
    
effectpos[0] = entpos[0];
    
effectpos[1] = entpos[1];
    
effectpos[2] = entpos[2] + 90;
    
ShowParticle(effectpos"item_defibrillator_body"1.0);
    
AttachParticle(client"water_child_water5");
    
SetEntDataFloat(client,g_iLaggedMovementOGetConVarFloat(l4d2_icebomb_speed), true);
    
ScreenFade(client05020010010001);    
    
EmitSoundToClient(clientSOUND_BOMB);
    
    return 
Plugin_Continue;
}

//屏幕颜色
public ScreenFade(targetredgreenbluealphadurationtype)
{
    new 
Handle:msg StartMessageOne("Fade"target);
    
BfWriteShort(msg500);
    
BfWriteShort(msgduration);
    if (
type == 0)
        
BfWriteShort(msg, (0x0002 0x0008));
    else
        
BfWriteShort(msg, (0x0001 0x0010));
    
BfWriteByte(msgred);
    
BfWriteByte(msggreen);
    
BfWriteByte(msgblue);
    
BfWriteByte(msgalpha);
    
EndMessage();

}


/* 显示你想要的粒子效果 */
public ShowParticle(Float:pos[3], String:particlename[], Float:time)
{
    new 
particle CreateEntityByName("info_particle_system");
    if (
IsValidEdict(particle))
    {
        
TeleportEntity(particleposNULL_VECTORNULL_VECTOR);
        
DispatchKeyValue(particle"effect_name"particlename);
        
DispatchKeyValue(particle"targetname""particle");
        
DispatchSpawn(particle);
        
ActivateEntity(particle);
        
AcceptEntityInput(particle"start");
        
CreateTimer(timeDeleteParticlesparticle);
    }  
}

/* 删除粒子 */
public Action:DeleteParticles(Handle:timerany:particle)
{
    if (
IsValidEntity(particle))
    {
        new 
String:classname[64];
        
GetEdictClassname(particleclassnamesizeof(classname));
        if (
StrEqual(classname"info_particle_system"false))
            
RemoveEdict(particle);
    }
}

/* 连接粒子 */
public AttachParticle(entString:particleType[])
{
    
decl String:tName[64];
    new 
particle CreateEntityByName("info_particle_system");
    if (
IsValidEdict(particle))
    {
        new 
Float:pos[3];
        
GetEntPropVector(entProp_Send"m_vecOrigin"pos);
        
TeleportEntity(particleposNULL_VECTORNULL_VECTOR);
        
GetEntPropString(entProp_Data"m_iName"tNamesizeof(tName));
        
DispatchKeyValue(particle"targetname""tf2particle");
        
DispatchKeyValue(particle"parentname"tName);
        
DispatchKeyValue(particle"effect_name"particleType);
        
DispatchSpawn(particle);
        
SetVariantString(tName);
        
AcceptEntityInput(particle"SetParent"particleparticle0);
        
ActivateEntity(particle);
        
AcceptEntityInput(particle"start");
    }
}

/* 预先缓存 */
public PrecacheParticle(String:particlename[])
{
    new 
particle CreateEntityByName("info_particle_system");
    if (
IsValidEdict(particle))
    {
        
DispatchKeyValue(particle"effect_name"particlename);
        
DispatchKeyValue(particle"targetname""particle");
        
DispatchSpawn(particle);
        
ActivateEntity(particle);
        
AcceptEntityInput(particle"start");
        
CreateTimer(0.01DeleteParticlesparticle);
    }  
}

public 
OnMapStart()
{
    
//预缓存粒子特效
    
PrecacheParticle("item_defibrillator_body");
    
PrecacheParticle("water_child_water5");
    
//预缓存音效文件
    
PrecacheSound(SOUND_BOMBtrue);

__________________
I like this BBS sharing of spirit

I come from China, my English is poor

Last edited by phoenix0001; 07-24-2017 at 04:16.
phoenix0001 is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-24-2017 , 04:37   Re: [L4D2]Request fix error
Reply With Quote #12

OK, Upload the newest and fix source.
WatchDogs is offline
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 07-24-2017 , 05:01   Re: [L4D2]Request fix error
Reply With Quote #13

PHP Code:
#include <sourcemod>  
#include <sdktools>  


#define Version "1.0"  
#define CVAR_FLAGS FCVAR_SPONLY|FCVAR_NOTIFY  

#define SOUND_BOMB "physics/plastic/plastic_box_break2.wav"  

public Plugin:myinfo =  

    
name "",  
    
author "",  
    
description "",  
    
version Version,  
    
url "" 
}; 

new 
g_iLaggedMovementO = -1

new 
Float:bomb_pos[MAXPLAYERS 1][3]; 
new 
bomb_timer[MAXPLAYERS 1]; 

new 
Handle:l4d2_icebomb_time
new 
Handle:l4d2_icebomb_speed
new 
Handle:l4d2_icebomb_type
new 
Handle:l4d2_icebomb_surv
/* 手雷名称 */ 
//pipe_bomb      土制炸弹  
//molotov        燃烧瓶  
//vomitjar    胆汁液  

//pipe_bomb_projectile    土制炸弹破坏  
//molotov_projectile        燃烧瓶破坏  
//vomitjar_projectile    胆汁液破坏  

public OnPluginStart() 

    
decl String:game_name[64]; 
    
GetGameFolderName(game_namesizeof(game_name)); 
    if (!
StrEqual(game_name"left4dead"false) && !StrEqual(game_name"left4dead2"false)) 
    { 
        
SetFailState("只支持L4D2"); 
    } 
     
    
g_iLaggedMovementO FindSendPropInfo("CTerrorPlayer""m_flLaggedMovementValue"); 
     
    
l4d2_icebomb_time CreateConVar("l4d2_icebomb_time""15""冻结持续的时间"CVAR_FLAGS); 
    
l4d2_icebomb_speed CreateConVar("l4d2_icebomb_speed""0.5""冻结时的移动速度(0 = 完全冻结,无法动弹)"CVAR_FLAGS); 
    
l4d2_icebomb_type CreateConVar("l4d2_icebomb_type""0""可以使用冰冻手雷的物品(0 = 全部 1 = 土制炸弹 2 = 燃烧瓶 3 = 胆汁液)"CVAR_FLAGS); 
    
l4d2_icebomb_surv CreateConVar("l4d2_icebomb_surv""0""冰冻手雷对幸存者是否有效(0 = 无效 1 = 有效)"CVAR_FLAGS); 
     
    
AutoExecConfig(true"l4d2_Ice_Bomb"); 



/* 判断玩家是否有效 */ 
public bool:IsValidPlayer(client

    if (
client || client MaxClients)return false
    if (!
IsClientInGame(client))return false
     
    return 
true


/* 事件-实体被破坏 */ 
public OnEntityDestroyed(entity

    if (
entity <= MaxClients || entity 2048 || !IsValidEdict(entity) || !IsValidEntity(entity))return; 
     
    
decl String:classname[32]; 
     
    new 
type GetConVarInt(l4d2_icebomb_type); 
     
    
//获取实体所有者  
    
new client GetEntPropEnt(entityProp_Data"m_hOwnerEntity"); 
     
    
//获取实体类名  
    
GetEdictClassname(entityclassname32); 
     
    
//识别实体类名  
    
if (StrEqual(classname"pipe_bomb_projectile"false)) 
    { 
        if (
type == || type == 0
        { 
            
//获取实体坐标  
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]); 
            
Freeze_Points(client); 
        } 
    } 
    else if (
StrEqual(classname"molotov_projectile"false)) 
    { 
        if (
type == || type == 0
        { 
            
//获取实体坐标  
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]); 
            
Freeze_Points(client); 
        } 
    } 
    else if (
StrEqual(classname"vomitjar_projectile"false)) 
    { 
        if (
type == || type == 0
        { 
            
//获取实体坐标  
            
GetEntPropVector(entityProp_Send"m_vecOrigin"bomb_pos[client]); 
            
Freeze_Points(client); 
        } 
    } 
     
    
//PrintToChatAll("武器: %s 所有者: %N", classname, client);  


Freeze_Points(client

    new 
Float:entpos[3]; 
    new 
Float:distance
     
    
//开始循环判断  
    
for (new 1<= MaxClientsi++) 
    { 
        
//判断玩家是否在游戏且实体是有效的  
        
if (!IsClientInGame(i) || !IsValidEntity(i)) 
            continue; 
        if (!
IsPlayerAlive(i)) 
            continue; 
        if (
GetConVarInt(l4d2_icebomb_surv) == 0
        { 
            if (
GetClientTeam(i) == 2
                continue; 
        } 
        
//获取实体坐标  
        
GetEntPropVector(iProp_Send"m_vecOrigin"entpos); 
        
//对比距离  
        
distance GetVectorDistance(bomb_pos[client], entpos); 
        if (
distance <= 250
        { 
            
//PrintToChatAll("进入冰冻范围: %N", i);  
            
SetEntDataFloat(ig_iLaggedMovementOGetConVarFloat(l4d2_icebomb_speed), true); 
            
ScreenFade(i05020010010001); 
            
//运行计时器  
            
bomb_timer[i] = 0
            
CreateTimer(1.0Ice_Bomb_TimeriTIMER_REPEAT); 
        } 
    } 
     


public 
Action:Ice_Bomb_Timer(Handle:timerany:client

    if (!
IsClientInGame(client
         || !
IsValidEntity(client
         || !
IsPlayerAlive(client)) 
    { 
        
//PrintToChatAll("无效解冻: %N", client);  
        
bomb_timer[client] = 0
        
SetEntDataFloat(clientg_iLaggedMovementO1.0true); 
        return 
Plugin_Stop
    } 
     
    
bomb_timer[client] += 1
    if (
bomb_timer[client] >= GetConVarInt(l4d2_icebomb_time)) 
    { 
        
//PrintToChatAll("正常解冻: %N", client);  
        
bomb_timer[client] = 0
        
SetEntDataFloat(clientg_iLaggedMovementO1.0true); 
        return 
Plugin_Stop
    } 
     
    new 
Float:entpos[3
    new 
Float:effectpos[3]; 
    
//获取实体坐标  
    
GetEntPropVector(clientProp_Send"m_vecOrigin"entpos); 
    
effectpos[0] = entpos[0]; 
    
effectpos[1] = entpos[1]; 
    
effectpos[2] = entpos[2] + 90
    
ShowParticle(effectpos"item_defibrillator_body"1.0); 
    
AttachParticle(client"water_child_water5"); 
    
SetEntDataFloat(clientg_iLaggedMovementOGetConVarFloat(l4d2_icebomb_speed), true); 
    
ScreenFade(client05020010010001); 
    
EmitSoundToClient(clientSOUND_BOMB); 
     
    return 
Plugin_Continue


//屏幕颜色  
public ScreenFade(targetredgreenbluealphadurationtype

    new 
Handle:msg StartMessageOne("Fade"target); 
    
BfWriteShort(msg500); 
    
BfWriteShort(msgduration); 
    if (
type == 0
        
BfWriteShort(msg, (0x0002 0x0008)); 
    else 
        
BfWriteShort(msg, (0x0001 0x0010)); 
    
BfWriteByte(msgred); 
    
BfWriteByte(msggreen); 
    
BfWriteByte(msgblue); 
    
BfWriteByte(msgalpha); 
    
EndMessage(); 
     



/* 显示你想要的粒子效果 */ 
public ShowParticle(Float:pos[3], String:particlename[], Float:time

    new 
particle CreateEntityByName("info_particle_system"); 
    if (
IsValidEdict(particle)) 
    { 
        
TeleportEntity(particleposNULL_VECTORNULL_VECTOR); 
        
DispatchKeyValue(particle"effect_name"particlename); 
        
DispatchKeyValue(particle"targetname""particle"); 
        
DispatchSpawn(particle); 
        
ActivateEntity(particle); 
        
AcceptEntityInput(particle"start"); 
        
CreateTimer(timeDeleteParticlesparticle); 
    } 


/* 删除粒子 */ 
public Action:DeleteParticles(Handle:timerany:particle

    if (
IsValidEntity(particle)) 
    { 
        new 
String:classname[64]; 
        
GetEdictClassname(particleclassnamesizeof(classname)); 
        if (
StrEqual(classname"info_particle_system"false)) 
            
RemoveEdict(particle); 
    } 


/* 连接粒子 */ 
public AttachParticle(entString:particleType[]) 

    
decl String:tName[64]; 
    new 
particle CreateEntityByName("info_particle_system"); 
    if (
IsValidEdict(particle)) 
    { 
        new 
Float:pos[3]; 
        
GetEntPropVector(entProp_Send"m_vecOrigin"pos); 
        
TeleportEntity(particleposNULL_VECTORNULL_VECTOR); 
        
GetEntPropString(entProp_Data"m_iName"tNamesizeof(tName)); 
        
DispatchKeyValue(particle"targetname""tf2particle"); 
        
DispatchKeyValue(particle"parentname"tName); 
        
DispatchKeyValue(particle"effect_name"particleType); 
        
DispatchSpawn(particle); 
        
SetVariantString(tName); 
        
AcceptEntityInput(particle"SetParent"particleparticle0); 
        
ActivateEntity(particle); 
        
AcceptEntityInput(particle"start"); 
    } 


/* 预先缓存 */ 
public PrecacheParticle(String:particlename[]) 

    new 
particle CreateEntityByName("info_particle_system"); 
    if (
IsValidEdict(particle)) 
    { 
        
DispatchKeyValue(particle"effect_name"particlename); 
        
DispatchKeyValue(particle"targetname""particle"); 
        
DispatchSpawn(particle); 
        
ActivateEntity(particle); 
        
AcceptEntityInput(particle"start"); 
        
CreateTimer(0.01DeleteParticlesparticle); 
    } 


public 
OnMapStart() 

    
//预缓存粒子特效  
    
PrecacheParticle("item_defibrillator_body"); 
    
PrecacheParticle("water_child_water5"); 
    
//预缓存音效文件  
    
PrecacheSound(SOUND_BOMBtrue); 

__________________
I like this BBS sharing of spirit

I come from China, my English is poor
phoenix0001 is offline
BlackSabbarh
Senior Member
Join Date: Sep 2018
Old 03-04-2019 , 17:07   Re: [L4D2]Request fix error
Reply With Quote #14

Is this plugin working, has it been repaired?
BlackSabbarh is offline
AK978
Senior Member
Join Date: Jun 2018
Old 03-04-2019 , 19:34   Re: [L4D2]Request fix error
Reply With Quote #15

My previous version, I am not sure if I have done it.
Attached Files
File Type: sp Get Plugin or Get Source (ice_bomb.sp - 123 views - 9.0 KB)
AK978 is offline
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 03-05-2019 , 07:11   Re: [L4D2]Request fix error
Reply With Quote #16

Wow! It has been fixed!
__________________
I like this BBS sharing of spirit

I come from China, my English is poor
phoenix0001 is offline
Jerry_21
Member
Join Date: Jun 2017
Old 03-05-2019 , 20:26   Re: [L4D2]Request fix error
Reply With Quote #17

I thought it was interesting because of the name of the add-on, but after trying it in the game I did not see it doing anything at all. Can you indicate how it works? If it's not too much to ask, can you post a demonstration video?
Jerry_21 is offline
AK978
Senior Member
Join Date: Jun 2018
Old 03-05-2019 , 21:09   Re: [L4D2]Request fix error
Reply With Quote #18

The object is a special infection causing delay + special effects.
AK978 is offline
Jerry_21
Member
Join Date: Jun 2017
Old 03-05-2019 , 21:18   Re: [L4D2]Request fix error
Reply With Quote #19

Quote:
Originally Posted by AK978 View Post
The object is a special infection causing delay + special effects.
Okay. Thanks for the clarification xD
Jerry_21 is offline
BlackSabbarh
Senior Member
Join Date: Sep 2018
Old 03-19-2019 , 19:02   Re: [L4D2]Request fix error
Reply With Quote #20

I think special effects do not work.
BlackSabbarh is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:03.


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