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

[L4D2] Spitter rocks


Post New Thread Reply   
 
Thread Tools Display Modes
Author
rekcah
Member
Join Date: Jun 2019
Plugin ID:
6744
Plugin Version:
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    spitter can throw tank rocks
    Old 10-04-2019 , 17:58   [L4D2] Spitter rocks
    Reply With Quote #1

    Spitter can throw a tank rock every 10 seconds by scratching(m2).

    when a Spitter spawns there is a 3 second delay before it can throw rocks.

    rocks do 10 damage, damage points wont be awarded to a player.
    Attached Files
    File Type: sp Get Plugin or Get Source (spitter rocks.sp - 487 views - 1.9 KB)

    Last edited by rekcah; 03-20-2021 at 03:48. Reason: updated
    rekcah is offline
    MasterMind420
    BANNED
    Join Date: Nov 2010
    Old 10-05-2019 , 08:07   Re: [L4D2] Spitter rocks
    Reply With Quote #2

    Quote:
    Originally Posted by rekcah View Post
    Spitter can throw a tank rock every 5 seconds by scratching(m2).

    I'm not sure why but it doesn't always work properly if there are multiple spitters, however in my testing works fine for 1 spitter.
    At first glance i can't see why all spitters shouldn't be throwing rocks...however you can try this to see if it resolves the issue...this should work.

    Code:
    iThrower[MAXPLAYERS+1];
    new Float:NextUseRock[MAXPLAYERS+1];
    
    public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
    {
    	if (!IsClientInGame(client) || !IsPlayerAlive(client))
    		return Plugin_Continue;
    		
    	if(IsSpitter(client) && !IsGhost(client) && GetClientTeam(client) == 3)
    	{
    		if ((buttons & IN_ATTACK2) && GetGameTime() > NextUseRock[client])
    		{
    			NextUseRock[client] = GetGameTime() + 5.0;
    			//PrintToChat(client,"rock thrown");
    			
    			iThrower[client] = CreateEntityByName("env_rock_launcher");
    			DispatchKeyValue(iThrower[client],"Rock Damage Override", "10");
    			DispatchSpawn(iThrower[client]);
    			
    			decl Float:pos[3];
    			decl Float:ang[3];
    			decl Float:npos[3];
    			GetClientAbsOrigin(client,pos);
    			GetClientEyeAngles(client,ang);
    			npos[0] = (pos[0] + 50 * Cosine(DegToRad(ang[1])));
    			npos[1] = (pos[1] + 50 * Sine(DegToRad(ang[1])));
    			npos[2] = (pos[2] + 150);
    			
    			TeleportEntity(iThrower[client],npos,ang,NULL_VECTOR);
    			AcceptEntityInput(iThrower[client], "LaunchRock");
    			AcceptEntityInput(iThrower[client], "Kill");			
    		}
    	}
    }

    Last edited by MasterMind420; 10-05-2019 at 08:08.
    MasterMind420 is offline
    BHaType
    Great Tester of Whatever
    Join Date: Jun 2018
    Old 10-08-2019 , 05:07   Re: [L4D2] Spitter rocks
    Reply With Quote #3

    Quote:
    Originally Posted by MasterMind420 View Post
    Code:
    	if(IsSpitter(client) && GetClientTeam(client) == 3)
    
    stock bool:IsSpitter(client)
    {
        if (GetEntProp(client, Prop_Send, "m_zombieClass") == 4) return true;
        return false;
    }
    Does it need GetClientTeam (client) == 3?
    __________________
    cry

    Last edited by BHaType; 10-08-2019 at 05:10.
    BHaType is offline
    Send a message via AIM to BHaType
    rekcah
    Member
    Join Date: Jun 2019
    Old 10-08-2019 , 16:02   Re: [L4D2] Spitter rocks
    Reply With Quote #4

    I think I found the cause for it not always working, wasn't because of multiple spitters, was actually because I wasn't resetting the NextUseRock array, I've fixed and updated that now so it should work. I also changed the time between throws to 10 seconds.

    I'm pretty sure it does need the team check, I believe IsSpitter will still return true even if the player is a survivor.

    Last edited by rekcah; 10-08-2019 at 16:04.
    rekcah is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 10-08-2019 , 18:36   Re: [L4D2] Spitter rocks
    Reply With Quote #5

    rehcah you are right, for example, if a player becomes a spitter on versus and change to survivor team the IsSpitter will be true even being a survivor. (I did some tests and checked that)

    Well I don't know really well what this plugin does, I installed and looks like it just simulates a rock being throw but no damage or animation is done, only shakes the screen. (from my tests)
    Also for a better logic you may change the if check to if(GetClientTeam(client) == 3 && IsSpitter(client) && !IsGhost(client)).
    As well add the 10 seconds timer to a cvar, so admins can configure the time without recompiling it.
    __________________
    Marttt is offline
    Reply



    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 07:11.


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