Raised This Month: $12 Target: $400
 3% 

can someone help me with this?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 05-27-2021 , 12:00   can someone help me with this?
Reply With Quote #1

My goal in this plugin is to slow down when there is a Survivor spitter acid left, but when I tried to compile it, I got a few errors.

PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1

#define Spitters Sticky Goo
#define PLUGIN_VERSION "2.01"

#define ZOMBIECLASS_SPITTER 4

///Spitter
//Bools
new bool:isSpitter false;
new 
bool:isStickyGoo false;

//Handles
new Handle:cvarSpitter;
new 
Handle:cvarStickyGoo;
new 
Handle:cvarStickyGooDuration;
new 
Handle:cvarStickyGooSpeed;
new 
Handle:cvarStickyGooJump;
new 
Handle:cvarStickyGooTimer[MAXPLAYERS 1] = INVALID_HANDLE;

//Plugins İnformations
public Plugin:myinfo 
{
    
name "Sticky Goo",
    
author "DarkWob",
    
description "Slow Acid",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
    
//we setup everything that we need for the Spitter
    
HookEvent("entered_spit"Event_EnteredSpit);
    
HookEvent("spit_burst"Event_SpitBurst);
    
    
CreateConVar("sticky_goo_version"PLUGIN_VERSION"Sticky Goo"FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
cvarStickyGoo CreateConVar("l4d_stickygoo""1""Slows down Survivor when standing in spit. (Def 1)"FCVAR_NOTIFYtrue0.0false_);
    
cvarStickyGooDuration CreateConVar("l4d_stickygooduration""6""How long a Survivor is slowed for aftering entering spit. (Def 6)"FCVAR_NOTIFYtrue1.0false_);
    
cvarStickyGooSpeed CreateConVar("l4d_stickygoospeed""0.5""Speed reduction to Survivor. (Def 0.5)"FCVAR_NOTIFYtrue0.0false_);
    
cvarStickyGooJump CreateConVar("l4d_stickygoojump""1""Speed reduction to Survivor jumping. (Def 1)"FCVAR_NOTIFYtrue0.0false_);
    
    
}

public 
Action:OnPluginStart_Delayed(Handle:timer)
{
    
//Next we setup the Bool for the Spitter
    
if (GetConVarInt(cvarSpitter))
    {
        
isSpitter true;
    }
    
    if (
GetConVarInt(cvarStickyGoo))
    {
        
isStickyGoo true;
    }

}

public 
OnMapStart()
{
    
/* Precache Models */
    
PrecacheModel("models/infected"true);
    
PrecacheModel("models/infected"true);    

    
decl String:GameMode[16];
    
GetConVarString(FindConVar("mp_gamemode"), GameModesizeof(GameMode));
}
///Universal Events

//This will setup events that are required for more than one ability

/*public Event_PlayerSpawn (Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event,"userid"));

    if (IsValidClient(client) && GetClientTeam(client) == 3)
    {
        new class = GetEntProp(client, Prop_Send, "m_zombieClass");
        if (class == ZOMBIECLASS_BOOMER)
        {
            if (isBoomer && isBileFeet)
            {
            cvarBileFeetTimer[client] = CreateTimer(0.5, Event_BoomerBileFeet, client);
            }
        }
    }
}
*/
//This is a call for the Sticky Goo

public OnGameFrame()
{
    for (new 
client=1client<=MaxClientsclient++)
    {
    if (
IsValidClient(client) && GetClientTeam(client) == && isSlowed[client])
    {
        new 
flags GetEntityFlags(client);
        
        if (
flags JUMPFLAG)
        {
        
//PrintHintText(client, "JUMPER!");
        
SetEntDataFloat(clientvelocityModifierOffsetGetConVarFloat(cvarStickyGooJump), true); 
        }
    }
    }
}

public 
Event_PlayerHurt (Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    
decl String:weapon[64];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
    
//This will setup Sticky Goo - Reduce the speed of Survivors if they enter Spit

public Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
isSpitter && isStickyGoo)
    {
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));

    if (
IsValidClient(client) && GetClientTeam(client) == && !isSlowed[client])
        {
        
isSlowed[client] = true;
        if (
isAnnounce) {PrintHintText(client"Standing in the spit is slowing you down!");}
        
cvarStickyGooTimer[client] = CreateTimer(GetConVarFloat(cvarStickyGooDuration), StickyGooclient);
        
SetEntDataFloat(clientlaggedMovementOffsetGetConVarFloat(cvarStickyGooSpeed), true);
        }
    }
}

public 
Action:StickyGoo(Handle:timerany:client)
{
    if (
IsValidClient(client))
    {
        
SetEntDataFloat(clientlaggedMovementOffset1.0true); //sets the survivors speed back to normal
        
if (isAnnounce) {PrintHintText(client"The spit is wearing off!");}
        
isSlowed[client] = false;
        
        if (
cvarStickyGooTimer[client] != INVALID_HANDLE)
            {
                
KillTimer(cvarStickyGooTimer[client]);
                
cvarStickyGooTimer[client] = INVALID_HANDLE;
            }
    }
    
    return 
Plugin_Stop;
}
//Spitter Timers
    
if(cvarAcidSwipeTimer[client] != INVALID_HANDLE)
    {
        
KillTimer(cvarAcidSwipeTimer[client]);
        
cvarAcidSwipeTimer[client] = INVALID_HANDLE;
    }
    
}

public 
Event_PlayerIncapped (Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
isJockey && isDerbyDaze)
    {
    new 
client GetClientOfUserIdGetEventIntevent"victim"));

    if (
IsValidClient(client) && GetClientTeam(client) == 2)
        {    
        
DerbyDaze(client0);
        
SetEntProp(clientProp_Send"m_iHideHUD"0);
        }
    }
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
IsValidClient2(client) && GetClientTeam(client) == 2)
    {
        
isSlowed[client] = false;
        
SetEntProp(clientProp_Send"m_iHideHUD"0);
    }
        
Reset_Timers(client);
}

public 
Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
IsValidClient2(client))
    {
        
isSlowed[client] = false;
        
SetEntProp(clientProp_Send"m_iHideHUD"0);
        
Reset_Timers(client);
    }
    
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
IsValidClient2(client) && GetClientTeam(client) == 2)
    {
        
isSlowed[client] = false;
        
SetEntProp(clientProp_Send"m_iHideHUD"0);
        
Reset_Timers(client);
    }
    
Reset_Timers(client);
}

public 
IsValidClient(client)
{
    if (
client == 0)
        return 
false;

    
//if (IsFakeClient(client))
        //return false;
    
    
if (!IsClientInGame(client))
        return 
false;
    
    if (!
IsPlayerAlive(client))
        return 
false;

    return 
true;
}

public 
IsValidClient2(client)
{
    if (
client == 0)
        return 
false;

    
//if (IsFakeClient(client))
        //return false;
    
    
if (!IsClientInGame(client))
        return 
false;
    
    return 
true;
}


public 
IsPlayerGhost(client)
{
    if (
IsValidClient(client))
    {
        if (
GetEntProp(clientProp_Send"m_isGhost")) return true;
        else return 
false;
    }
    return 
1;


ERRORS:

Quote:
/groups/sourcemod/upload_tmp/textAbuXLC.sp(37) : error 017: undefined symbol "Event_EnteredSpit"
/groups/sourcemod/upload_tmp/textAbuXLC.sp(3 : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textAbuXLC.sp(3 : error 017: undefined symbol "Event_SpitBurst"
/groups/sourcemod/upload_tmp/textAbuXLC.sp(57) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textAbuXLC.sp(100) : error 017: undefined symbol "isSlowed"
/groups/sourcemod/upload_tmp/textAbuXLC.sp(100) : warning 215: expression has no effect
/groups/sourcemod/upload_tmp/textAbuXLC.sp(100) : error 001: expected token: ";", but found "]"
/groups/sourcemod/upload_tmp/textAbuXLC.sp(100) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textAbuXLC.sp(100) : fatal error 190: too many error messages on one line

Last edited by Darkwob; 05-27-2021 at 12:01.
Darkwob is offline
Johnny2525
Junior Member
Join Date: May 2015
Old 05-27-2021 , 14:58   Re: can someone help me with this?
Reply With Quote #2

As far as I know your Events should be Actions

So for example
Your:
Code:
public Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Should be
Code:
public Action:Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Same with other Events you have in your file

With rest of the errors I am sure you can figure it out.
Johnny2525 is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 05-27-2021 , 16:19   Re: can someone help me with this?
Reply With Quote #3

Quote:
Originally Posted by Johnny2525 View Post
As far as I know your Events should be Actions

So for example
Your:
Code:
public Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Should be
Code:
public Action:Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Same with other Events you have in your file

With rest of the errors I am sure you can figure it out.
When I got no response from anyone, I asked a friend for help, it solved the problem, there was no problem in the compilation, but the plugin does not work. Spitter's acid doesn't slow Survivor. can you solve this?


this is my friend fixing the problems.
PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1

#define Spitters Sticky Goo
#define PLUGIN_VERSION "2.01"

#define ZOMBIECLASS_SPITTER 4

///Spitter
//Bools
new bool:isSpitter false;
new 
bool:isStickyGoo false;


//Handles
new Handle:cvarSpitter;
new 
Handle:cvarStickyGoo;
new 
Handle:cvarStickyGooDuration;
new 
Handle:cvarStickyGooSpeed;
new 
Handle:cvarStickyGooJump;
new 
Handle:cvarStickyGooTimer[MAXPLAYERS 1] = INVALID_HANDLE;

new 
bool:isSlowed[MAXPLAYERS+1] = false;
static const 
JUMPFLAG IN_JUMP;
static 
laggedMovementOffset 0;
static 
velocityModifierOffset 0;
new 
bool:isAnnounce true;

//Plugins İnformations
public Plugin:myinfo =
{
    
name "Sticky Goo",
    
author "DarkWob",
    
description "Slow Acid",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{

    
//we setup everything that we need for the Spitter
    
HookEvent("entered_spit"Event_EnteredSpit);

    
CreateConVar("sticky_goo_version"PLUGIN_VERSION"Sticky Goo"FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
cvarStickyGoo CreateConVar("l4d_stickygoo""1""Slows down Survivor when standing in spit. (Def 1)"FCVAR_NOTIFYtrue0.0false_);
    
cvarStickyGooDuration CreateConVar("l4d_stickygooduration""6""How long a Survivor is slowed for aftering entering spit. (Def 6)"FCVAR_NOTIFYtrue1.0false_);
    
cvarStickyGooSpeed CreateConVar("l4d_stickygoospeed""0.5""Speed reduction to Survivor. (Def 0.5)"FCVAR_NOTIFYtrue0.0false_);
    
cvarStickyGooJump CreateConVar("l4d_stickygoojump""1""Speed reduction to Survivor jumping. (Def 1)"FCVAR_NOTIFYtrue0.0false_);

    
laggedMovementOffset FindSendPropInfo("CTerrorPlayer""m_flLaggedMovementValue");
    
velocityModifierOffset FindSendPropInfo("CTerrorPlayer""m_flVelocityModifier");
}

public 
Action:OnPluginStart_Delayed(Handle:timer)
{
    
//Next we setup the Bool for the Spitter
    
if (GetConVarInt(cvarSpitter))
    {
        
isSpitter true;
    }

    if (
GetConVarInt(cvarStickyGoo))
    {
        
isStickyGoo true;
    }

}

public 
OnMapStart()
{
    
/* Precache Models */
    
PrecacheModel("models/infected"true);
    
PrecacheModel("models/infected"true);

    
decl String:GameMode[16];
    
GetConVarString(FindConVar("mp_gamemode"), GameModesizeof(GameMode));
}
///Universal Events

//This will setup events that are required for more than one ability

/*public Event_PlayerSpawn (Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event,"userid"));

    if (IsValidClient(client) && GetClientTeam(client) == 3)
    {
        new class = GetEntProp(client, Prop_Send, "m_zombieClass");
        if (class == ZOMBIECLASS_BOOMER)
        {
            if (isBoomer && isBileFeet)
            {
            cvarBileFeetTimer[client] = CreateTimer(0.5, Event_BoomerBileFeet, client);
            }
        }
    }
}
*/
//This is a call for the Sticky Goo

public OnGameFrame()
{
    for (new 
client=1client<=MaxClientsclient++)
    {
    if (
IsValidClient(client) && GetClientTeam(client) == && isSlowed[client])
    {
        new 
flags GetEntityFlags(client);

        if (
flags JUMPFLAG)
        {
        
//PrintHintText(client, "JUMPER!");
        
SetEntDataFloat(clientvelocityModifierOffsetGetConVarFloat(cvarStickyGooJump), true);
        }
    }
    }
}

//This will setup Sticky Goo - Reduce the speed of Survivors if they enter Spit

public Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
isSpitter && isStickyGoo)
    {
        new 
client GetClientOfUserId(GetEventInt(event,"userid"));

        if (
IsValidClient(client) && GetClientTeam(client) == && !isSlowed[client])
        {
            
isSlowed[client] = true;
            if (
isAnnounce) {PrintHintText(client"Standing in the spit is slowing you down!");}
            
cvarStickyGooTimer[client] = CreateTimer(GetConVarFloat(cvarStickyGooDuration), StickyGooclient);
            
SetEntDataFloat(clientlaggedMovementOffsetGetConVarFloat(cvarStickyGooSpeed), true);
        }
    }
}

public 
Action:StickyGoo(Handle:timerany:client)
{
    if (
IsValidClient(client))
    {
        
SetEntDataFloat(clientlaggedMovementOffset1.0true); //sets the survivors speed back to normal
        
if (isAnnounce) {PrintHintText(client"The spit is wearing off!");}
        
isSlowed[client] = false;

        if (
cvarStickyGooTimer[client] != INVALID_HANDLE)
            {
                
KillTimer(cvarStickyGooTimer[client]);
                
cvarStickyGooTimer[client] = INVALID_HANDLE;
            }
    }

    return 
Plugin_Stop;
}

public 
IsValidClient(client)
{
    if (
client == 0)
        return 
false;

    
//if (IsFakeClient(client))
        //return false;

    
if (!IsClientInGame(client))
        return 
false;

    if (!
IsPlayerAlive(client))
        return 
false;

    return 
true;
}

public 
IsValidClient2(client)
{
    if (
client == 0)
        return 
false;

    
//if (IsFakeClient(client))
        //return false;

    
if (!IsClientInGame(client))
        return 
false;

    return 
true;
}


public 
IsPlayerGhost(client)
{
    if (
IsValidClient(client))
    {
        if (
GetEntProp(clientProp_Send"m_isGhost")) return true;
        else return 
false;
    }
    return 
1;


Last edited by Darkwob; 05-27-2021 at 16:21.
Darkwob is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-27-2021 , 17:49   Re: can someone help me with this?
Reply With Quote #4

Quote:
Originally Posted by Johnny2525 View Post
As far as I know your Events should be Actions

So for example
Your:
Code:
public Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Should be
Code:
public Action:Event_EnteredSpit (Handle:event, const String:name[], bool:dontBroadcast)
Same with other Events you have in your file

With rest of the errors I am sure you can figure it out.
Action is only required when rewriting or blocking event notifications...
Also i suggest new syntax
public void Event_EnteredSpit (Handle event, const char[] name, bool dontBroadcast)
MasterMind420 is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 05-27-2021 , 20:23   Re: can someone help me with this?
Reply With Quote #5

Quote:
Originally Posted by MasterMind420 View Post
Action is only required when rewriting or blocking event notifications...
Also i suggest new syntax
public void Event_EnteredSpit (Handle event, const char[] name, bool dontBroadcast)
Thank you for the answer, but I couldn't do what I tried to do in the plugin. can you help
Darkwob is offline
oceanyss
Member
Join Date: Jan 2012
Old 09-01-2021 , 05:20   Re: can someone help me with this?
Reply With Quote #6

Quote:
Originally Posted by Darkwob View Post
Thank you for the answer, but I couldn't do what I tried to do in the plugin. can you help
Changing a player's movement speed is a bit tricky for L4D2 as the game will automatically default any movement speed to default after running your code once.

What you want to do is move the following line to OnPlayerRunCmd so your plugin is constantly telling the game to update the player's movement speed to whatever your value is. Then add a check to OnPlayerRunCmd to ensure this change only works if your StickyGoo timer is running

SetEntDataFloat(client, laggedMovementOffset, GetConVarFloat(cvarStickyGooSpeed), true);

Hope this helps
oceanyss 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 08:13.


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