Raised This Month: $ Target: $400
 0% 

[L4D & L4D2] ESPer Tank (1.2) [2020/Jan/22nd]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
spike1234
Junior Member
Join Date: Jun 2019
Location: Japan
Plugin ID:
6886
Plugin Version:
1.0
Plugin Category:
Fun Stuff
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Tank can throw more rocks with psychic power!
    Old 01-08-2020 , 09:40   [L4D & L4D2] ESPer Tank (1.2) [2020/Jan/22nd]
    Reply With Quote #1

    This is my first plugin, so may be there are some misses.
    If you found, please let me know.
    And sorry for my poor English.

    Info:
    This plugin gives ability for tank that throwing more rocks with psychic power!
    Floated rocks will fly to place where tank looking at.
    https://www.youtube.com/watch?v=mQclK6b96fI
    Cvars:
    PHP Code:
    sm_esperTank_enable "1"                    // Whether enable plugin
    sm_esperTank_distance_h "125.0"            // How long distance(horizontal) away when float up
    sm_esperTank_distance_v "100.0"            // How long distance(vertical) away when float up
    sm_esperTank_count "4"                    // How many rocks float up at once
    sm_esperTank_floatGravity "-0.02"            // Gravity while floating
    sm_esperTank_floatSpeed "25.0"            // Momentum of float up
    sm_esperTank_delay "1.5"                    // Wait this seconds for start throwing
    sm_esperTank_delay_next "0.2"                // Delay(sec) of throwing next rock
    sm_esperTank_speed "800"                // Throwing power
    sm_esperTank_error "10.0"                // Aim accuracy on throwing (10.0 = [-5.0 - +5.0] degrees get worse randomly)
    sm_esperTank_damage "10"                // Amount of damage
    sm_esperTank_health "75"                    // Amount of rock's health 
    Changes:
    Code:
    1.0 (2020/Jan/8th)
    - Initial release
    
    1.1 (2020/Jan/17th)
    - Fix error of cache wrong entity
    - Change method of getting tank client index
    - Delete/Drop rocks if owner tank was not found
    - Add some explanation in source code
    
    1.2 (2020/Jan/22nd)
    - Fix incorrect fixing on 1.1
    Thanks:
    • Ernecio - Testing in L4D.
    • Silvers - Correcting way of cache entity.


    Known issues:
    sm_esperTank_damage is not work. (I don't know why...)
    sm_esperTank_health is override the Cvar:"z_tank_throw_health"
    Tank who used ability last overrides control of all floated rocks by other tanks.

    There is a possibility to conflict with other rock plugins.
    Attached Files
    File Type: sp Get Plugin or Get Source (esper_tank.sp - 715 views - 7.2 KB)
    __________________

    My first language is not English.
    So I would be grateful if you correct my sentences if I wrote something wrong.
    I'm not active recently, sorry.

    Last edited by spike1234; 01-27-2020 at 08:11.
    spike1234 is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 01-08-2020 , 20:19   Re: [L4D2] ESPer Tank v1.0
    Reply With Quote #2

    Tank: wingardium leviosa!
    __________________
    HarryPotter is offline
    larrybrains
    Senior Member
    Join Date: May 2017
    Old 01-08-2020 , 20:25   Re: [L4D2] ESPer Tank v1.0
    Reply With Quote #3

    Pretty cool looking plugin!
    larrybrains is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 01-08-2020 , 20:33   Re: [L4D2] ESPer Tank v1.0
    Reply With Quote #4

    Amazing!

    I had a similar idea (never implemented),
    I wanted to create a tornado of rocks around the tank, and then randomly send the rocks in direction of the client.
    So the survivors would have to destroy the rocks first to hit the tank.

    I never make it, but your plugin is very close
    __________________
    Marttt is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 01-10-2020 , 05:03   Re: [L4D2] ESPer Tank v1.0
    Reply With Quote #5

    bugged out the DI and only spawn tanks after tanks after tanks also bugged out the saferoom door ~couldnt finish map and kept getting more tanks~
    sonic155 is offline
    spike1234
    Junior Member
    Join Date: Jun 2019
    Location: Japan
    Old 01-10-2020 , 08:57   Re: [L4D2] ESPer Tank v1.0
    Reply With Quote #6

    Quote:
    Originally Posted by Ernecio View Post
    Hi, doing a quick review of the source code i saw that there was no incompatibility for L4D1 so i tried it in L4D1 without making any modifications and everything works fine for L4D1, I mention this because in the title and the video they only refer to L4D2 Good Idea
    Thank you for checking!
    __________________

    My first language is not English.
    So I would be grateful if you correct my sentences if I wrote something wrong.
    I'm not active recently, sorry.
    spike1234 is offline
    AK978
    Senior Member
    Join Date: Jun 2018
    Old 01-11-2020 , 08:21   Re: [L4D & L4D2] ESPer Tank (1.0)
    Reply With Quote #7

    L 01/11/2020 - 14:246: [SM] Exception reported: Property "m_vecOrigin" not found (entity 254/instanced_scripted_scene)
    L 01/11/2020 - 14:246: [SM] Blaming: esper_tank.smx
    L 01/11/2020 - 14:246: [SM] Call stack trace:
    L 01/11/2020 - 14:246: [SM] [0] GetEntPropVector
    L 01/11/2020 - 14:246: [SM] [1] Line 170, esper_tank.sp::ThrowRock

    L 01/11/2020 - 14:14:28: [SM] Blaming: esper_tank.smx
    L 01/11/2020 - 14:14:28: [SM] Call stack trace:
    L 01/11/2020 - 14:14:28: [SM] [0] GetClientEyePosition
    L 01/11/2020 - 14:14:28: [SM] [1] Line 157, esper_tank.sp::ThrowRock
    L 01/11/2020 - 14:14:28: [SM] Exception reported: Client 20 is not in game

    Last edited by AK978; 01-11-2020 at 08:31.
    AK978 is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 01-11-2020 , 16:59   Re: [L4D & L4D2] ESPer Tank (1.0)
    Reply With Quote #8

    Quote:
    Originally Posted by Aya Supay View Post
    try this
    That's not going to fix the problem. You're still going to be affecting invalid clients if the tank disconnects or the wrong entity if it's deleted and another one is created, hence why the error is saying it's affecting "instanced_scripted_scene" instead of whatever classname you expect.

    BAD:
    PHP Code:
    g_tank GetClientOfUserId(event.GetInt("userid"));    

    CreateTimer(0.01FloatRockUpentity);
            
    CreateTimer(g_hThrowDelay.FloatValue g_hThrowDelayNext.FloatValue g_fDelayThrowRockentity);


    public 
    Action FloatRockUp(Handle timerany entity)
    {
        if(!
    IsValidEdict(entity)) return;
        
    public 
    Action ThrowRock(Handle timerany entity)
    {
        if(!
    IsValidEdict(entity))return; 

    People need to learn to pass entity references and userids into timers or when storing entity/client indexes, and reverse to validate. This is such a common problem with many developers who don't learn to validate stuff correctly. Sorry to say but please look at any of my plugins for examples on a better way to script and validate stuff, it seems too many are lazy or don't know what they're doing. EntRefToEntIndex will return -1 (INVALID_ENT_REFERENCE) when the entity is invalid. IsValidEdict(-1) will return false and exit.


    Correct method:

    PHP Code:
    // Store the userid
    g_tank event.GetInt("userid");

    // Retrieve user index from userid and validate. Put this before and where you need to use g_tank.
    int tank GetClientOfUserId(g_tank);
    if( 
    tank == ) return;
    // Then use the var "tank" instead of g_tank in the rest of the function.


    CreateTimer(0.01FloatRockUpEntIndexToEntRef(entity));
            
    CreateTimer(g_hThrowDelay.FloatValue g_hThrowDelayNext.FloatValue g_fDelayThrowRockEntIndexToEntRef(entity)));


    public 
    Action FloatRockUp(Handle timerany entity)
    {
        
    entity EntRefToEntIndex(entity);
        if(!
    IsValidEdict(entity)) return;
        
    public 
    Action ThrowRock(Handle timerany entity)
    {
        
    entity EntRefToEntIndex(entity);
        if(!
    IsValidEdict(entity))return; 


    You also have a nested statement for no reason:
    PHP Code:
    {CreateTimer(GetRandomFloat(0.01.0), FloatRock);} 
    delete the { }.


    I've not checked the rest of the code.

    Edit: Aya Supay, you've published several plugins and been around for a while, you're still making the same common mistakes. I cannot trust any of your plugins to actually work as intended.

    Developers need to think logically and laterally, many fail to do so.
    __________________

    Last edited by Silvers; 01-11-2020 at 17:02.
    Silvers is offline
    Aya Supay
    Member
    Join Date: Nov 2015
    Old 01-11-2020 , 23:14   Re: [L4D & L4D2] ESPer Tank (1.0)
    Reply With Quote #9

    Quote:
    Originally Posted by Silvers View Post
    That's not going to fix the problem. You're still going to be affecting invalid clients if the tank disconnects or the wrong entity if it's deleted and another one is created, hence why the error is saying it's affecting "instanced_scripted_scene" instead of whatever classname you expect.

    BAD:
    PHP Code:
    g_tank GetClientOfUserId(event.GetInt("userid"));    

    CreateTimer(0.01FloatRockUpentity);
            
    CreateTimer(g_hThrowDelay.FloatValue g_hThrowDelayNext.FloatValue g_fDelayThrowRockentity);


    public 
    Action FloatRockUp(Handle timerany entity)
    {
        if(!
    IsValidEdict(entity)) return;
        
    public 
    Action ThrowRock(Handle timerany entity)
    {
        if(!
    IsValidEdict(entity))return; 

    People need to learn to pass entity references and userids into timers or when storing entity/client indexes, and reverse to validate. This is such a common problem with many developers who don't learn to validate stuff correctly. Sorry to say but please look at any of my plugins for examples on a better way to script and validate stuff, it seems too many are lazy or don't know what they're doing. EntRefToEntIndex will return -1 (INVALID_ENT_REFERENCE) when the entity is invalid. IsValidEdict(-1) will return false and exit.


    Correct method:

    PHP Code:
    // Store the userid
    g_tank event.GetInt("userid");

    // Retrieve user index from userid and validate. Put this before and where you need to use g_tank.
    int tank GetClientOfUserId(g_tank);
    if( 
    tank == ) return;
    // Then use the var "tank" instead of g_tank in the rest of the function.


    CreateTimer(0.01FloatRockUpEntIndexToEntRef(entity));
            
    CreateTimer(g_hThrowDelay.FloatValue g_hThrowDelayNext.FloatValue g_fDelayThrowRockEntIndexToEntRef(entity)));


    public 
    Action FloatRockUp(Handle timerany entity)
    {
        
    entity EntRefToEntIndex(entity);
        if(!
    IsValidEdict(entity)) return;
        
    public 
    Action ThrowRock(Handle timerany entity)
    {
        
    entity EntRefToEntIndex(entity);
        if(!
    IsValidEdict(entity))return; 


    You also have a nested statement for no reason:
    PHP Code:
    {CreateTimer(GetRandomFloat(0.01.0), FloatRock);} 
    delete the { }.


    I've not checked the rest of the code.

    Edit: Aya Supay, you've published several plugins and been around for a while, you're still making the same common mistakes. I cannot trust any of your plugins to actually work as intended.

    Developers need to think logically and laterally, many fail to do so.

    well I still have to learn so anyway thanks for the information

    I only focus on animations and models is not much my field the code

    My plugins work for me if they report an error

    how this open code I am willing to solve only for l4d1 not l4d2 as you
    Aya Supay is offline
    spike1234
    Junior Member
    Join Date: Jun 2019
    Location: Japan
    Old 01-16-2020 , 10:25   Re: [L4D & L4D2] ESPer Tank (1.0)
    Reply With Quote #10

    Quote:
    Originally Posted by Silvers View Post
    That's not going to fix the problem. You're still going to be affecting invalid clients if the tank disconnects or the wrong entity if it's deleted and another one is created, hence why the error is saying it's affecting "instanced_scripted_scene" instead of whatever classname you expect.
    ...
    Thank you for reporting what I missed.
    I fixed some codes but it may be not enough
    because of I still can't understand correctly about EntIndexToEntRef. (I must study more...)

    If you don't mind, please give me some advice!
    __________________

    My first language is not English.
    So I would be grateful if you correct my sentences if I wrote something wrong.
    I'm not active recently, sorry.
    spike1234 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 02:44.


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