Raised This Month: $ Target: $400
 0% 

Tripmines


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Quimbo
Member
Join Date: May 2008
Plugin ID:
369
Plugin Version:
Plugin Category:
Fun Stuff
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Plant tripmines (lasermines)
    Unapprover:
    Reason for Unapproving:
    Reported not working, author inactive
    Old 06-13-2010 , 21:12   Re: Tripmines
    Reply With Quote #1

    I found another crash bug (in your orignal version naris too, not only in my changed version ;) ):

    Set sm_tripmines_stay to 0, sm_tripmines_damage to 100 and sm_tripmines_teamspecific to 2. Choose scout.
    Place 3 mines close to each other and run into the mine model (btw, why do they blow up if teamspecific is set to 2? Bug?).
    This will crash the server.

    This crashes somewhere in RemoveTripmines. I'm trying to fix it but didn't succeed atm.
    What happens is that for the first mine mineBreak is called. This breaks the mine and the player is damaged (10 health left). The 2nd mine is damaged too and mineBreak is called for it. This breaks the 2nd mine and the player dies.
    I *think* that now we have a problem: PlayerDeath is called which calls RemoveTripmines BUT the explosion already damaged the 3rd mine, which was removed by RemoveTripmines. So the engine is trying to call mineBreak for the removed mine. Not sure.

    It does not crash if you choose a class which dies on the 3rd mine!

    EDIT: I fixed it by delaying RemoveTripmines by 0.1 seconds in PlayerDeath to give the engine time to call mineBreak on all mines in the area.
    I attached a version with the fix and the improved beam trigger code (as described in previous post).
    Attached Files
    File Type: sp Get Plugin or Get Source (tripmines.sp - 336 views - 48.4 KB)

    Last edited by Quimbo; 06-13-2010 at 21:49.
    Quimbo is offline
    Sevi_FyA
    Member
    Join Date: Jul 2011
    Location: Seville
    Old 11-20-2011 , 04:00   Re: Tripmines
    Reply With Quote #2

    Quote:
    Originally Posted by naris View Post
    Here is a version that I got to work without encountering any crashes or physics issues in TF2. It should also work in DoD:S, CS:S and other mods.

    It also supports team-specific tripmines, team colored lasers, restricting tripmines to a specific team, per client maximum, purchasing tripmines in CSS, etc...

    The following convars are available to customize the plugin:

    sm_tripmines_activate_time (default 2.0)
    Tripmine activation time.

    sm_tripmines_reactivate_time (default 0.5)
    Tripmine reactivation time, after touched by a teammate.

    sm_tripmines_model
    Tripmine model

    sm_tripmines_admin (admin flag character or empty)
    Admin flag required to use tripmines (empty=anyone can use tripmines)

    sm_tripmines_restrictedteam (0-3, default 0)
    Team that does NOT get any tripmines

    sm_tripmines_teamspecific (0-2, default 1)
    Allow teammates of planter to pass (0 = no | 1 = yes | 2 = also allow planter to pass)

    sm_tripmines_touch (0-1, default 0)
    Tripmines explode when touched. (0=no|1=yes)

    sm_tripmines_allowspec (1/0, default 0)
    Allow spectators to use tripmines

    sm_tripmines_type (1/0, default 1)
    Explosion type of Tripmines (0 = normal explosion | 1 = fire explosion)

    sm_tripmines_stay (0-2, default 1)
    Tripmines stay if the owner dies. (0 = no | 1 = yes | 2 = destruct)

    sm_tripmines_health (default 10)
    Tripmines Health

    sm_tripmines_radius (default 256.0)
    Tripmines Explosion Radius

    sm_tripmines_damage (default 200)
    Tripmines Explosion Damage

    sm_tripmines_maximum (default 6)
    Maximum Number of tripmines allowed to be active per client (-1=unlimited)

    sm_tripmines_allowed (default 3)
    Number of tripmines allowed per life (-1=unlimited)

    sm_tripmines_mine_color_1 (default "0 255 255")
    Mine Color (can include alpha) for team 1 (Spectators)

    sm_tripmines_mine_color_2 (default "255 0 0")
    Mine Color (can include alpha) for team 2 (Red / Allies / Terrorists)

    sm_tripmines_mine_color_3 (default "0 0 255")
    Mine Color (can include alpha) for team 3 (Blue / Axis / Counter-Terrorists)

    sm_tripmines_beam_color_1 (default "0 255 255")
    Beam Color (can include alpha) for team 1 (Spectators)

    sm_tripmines_beam_color_2 (default "255 0 0")
    Beam Color (can include alpha) for team 2 (Red / Allies / Terrorists)

    sm_tripmines_beam_color_3 (default "0 0 255")
    Beam Color (can include alpha) for team 3 (Blue / Axis / Counter-Terrorists)

    sm_tripmines_placed_sound (default "npc/roller/blade_cut.wav")
    Sound when a tripmine is placed

    sm_tripmines_removed_sound (default "npc/roller/mine/rmine_blades_in2.wav")
    Sound when a tripmine is removed

    sm_tripmines_activated_sound (default "npc/roller/mine/rmine_blades_in2.wav")
    Sound when a tripmine is activated

    sm_tripmines_reactivated_sound (default "ui/hint.wav")
    Sound when a tripmine is reactivated, after touched by a teammate

    The following convar is available in CS:S:

    sm_tripmines_cost (default 50)
    Price to purchase Tripmines in Counter-Strike (0=give mines at round start,-1=also disable buying mines)

    The following convars are available in TF2:

    sm_tripmines_scout_limit (default -1)
    Number of tripmines allowed per life for Scouts (-1=use generic variable)

    ssm_tripmines_sniper_limit (default -1)
    Number of tripmines allowed per life for Snipers (-1=use generic variable)

    sm_tripmines_soldier_limit (default -1)
    Number of tripmines allowed per life for Soldiers (-1=use generic variable)

    sm_tripmines_demoman_limit (default -1)
    Number of tripmines allowed per life for Demomen (-1=use generic variable)

    sm_tripmines_medic_limit (default -1)
    Number of tripmines allowed per life for Medics (-1=use generic variable)

    sm_tripmines_heavy_limit (default -1)
    Number of tripmines allowed per life for Heavys (-1=use generic variable)

    sm_tripmines_pyro_limit (default -1)
    Number of tripmines allowed per life for Pyros (-1=use generic variable)

    sm_tripmines_spy_limit (default -1)
    Number of tripmines allowed per life for Spys (-1=use generic variable)

    sm_tripmines_engi_limit (default -1)
    Number of tripmines allowed per life for Engineers (-1=use generic variable)

    I also added a native interface to control tipmines from another plugin
    PHP Code:
    /**
     * Assume control of the tripmines plugin
     *
     * @param plugin_only     Set to 1 to assume complete control of the Tripmines plugin.
     * @return                none
     */
    native ControlTripmines(bool:plugin_only=true);

    /**
     * Give a player one or more tripmines to plant
     *
     * @param index     Client index
     * @param number    Set to number of tripmines to give the player. (-1 is plugin default)
     * @param per_spawn Set to number of tripmines to give the player on each spawn. (-1 is plugin default)
     * @param maximum   Set to number of tripmines allowed to be active. (-1 is plugin default)
     * @return            none
     */
    native GiveTripmines(client,number=-1,per_spawn=-1,maximum=-1);

    /**
     * Takes the player's tripmines away
     *
     * @param index     Client index
     * @return            none
     */
    native TakeTripmines(client);

    /**
     * Adds one or more tripmines for the player to plant
     *
     * @param index     Client index
     * @param number    Number of tripmines to add.
     * @return            none
     */
    native AddTripmines(client,number=1);

    /**
     * Subtracts one or more tripmines for the player to plant
     *
     * @param index     Client index
     * @param number    Number of tripmines to subtract.
     * @return            none
     */
    native SubTripmines(client,number=1);

    /**
     * Returns how many tripmines a player has (or is allowed).
     *
     * @param index     Client index
     * @param allowed   Set to  true to return number allowed, otherwise
     * @return            returns number of remaining tripmines.
     */
    native HasTripmines(client,bool:allowed=false);

    /**
     * Sets (Plants) a tripmine.
     *
     * @param index     Client index
     * @return            none
     */
    native SetTripmine(client);

    /**
     * Counts how many tripmines the player has active.
     *
     * @param index     Client index
     * @return            none
     */
    native CountTripmines(client);

    /**
     * Gets called when when a tripmine is set
     * @param client     Client index of the player setting the tripmine
     */
    forward Action:OnSetTripmine(client); 
    **Updated to version 3.3
    • Added convars to set beam and mine color and alpha
    • Added sm_tripmines_allowspec convar to allow/disallow spectators to plant mines
    • Changed sm_tripmines_teamspecific to have additional setting (2) to allow planter to pass
    • Changed tripmine properties for CSS to match original plugin
    • Hooked OnTouchedByEntity for tripmines so they can't be used like stairs

    **Updated to version 3.4
    • Fixed player_spawn not getting hooked in CSS
    • Tweaked tripmine entity creation to attempt to fix invulerable tripmines

    **Updated to version 3.5
    • Added sm_tripmines_admin convar to specify admin flag to check (if any)
    • Fixed sm_tripmines_maximum not getting used if NativeControl is off
    • Changed to check TeamSpecific in addition to FriendlyFire when igniting players
    • Check TeamSpecific setting if the tripmine's owner touches the tripmine itself.
    • Disable buying tripmines in CSS when the cost is set to -1

    **Updated to version 3.6
    • Fixed admin flag check, which was backwards (only allowed non-admins)

    **Updated to version 3.7
    • Added sm_tripmines_reactivate_time to specify reactivation time, after touched by a teammate.
    • Added convars (sm_tripmines_placed_sound, sm_tripmines_removed_sound, sm_tripmines_activated_sound, sm_tripmines_reactivated_sound) to specify sounds
    • Added sm_tripmines_touch convar to enable/disable tripmines exploding when they are touched
    • Merged crash from re-creating beams fix from Quimbo
    • Merged crash from removing tripmines fix from Quimbo

    **Updated to version 3.8
    • Added sm_tripmines_health to specify tripmines health, defaults to 10.

    **Updated to version 3.9
    • Ignore deaths due to fishes that aren't actual deaths.
    • Check to ensure entities are actually created.

    **Updated to version 4.0
    • Re-factored to reduce crashes.
    This version donīt count the dead, it seems that the player who touch the mine commits suicide

    Quote:
    Originally Posted by Quimbo View Post
    I found another crash bug (in your orignal version naris too, not only in my changed version ;) ):

    Set sm_tripmines_stay to 0, sm_tripmines_damage to 100 and sm_tripmines_teamspecific to 2. Choose scout.
    Place 3 mines close to each other and run into the mine model (btw, why do they blow up if teamspecific is set to 2? Bug?).
    This will crash the server.

    This crashes somewhere in RemoveTripmines. I'm trying to fix it but didn't succeed atm.
    What happens is that for the first mine mineBreak is called. This breaks the mine and the player is damaged (10 health left). The 2nd mine is damaged too and mineBreak is called for it. This breaks the 2nd mine and the player dies.
    I *think* that now we have a problem: PlayerDeath is called which calls RemoveTripmines BUT the explosion already damaged the 3rd mine, which was removed by RemoveTripmines. So the engine is trying to call mineBreak for the removed mine. Not sure.

    It does not crash if you choose a class which dies on the 3rd mine!

    EDIT: I fixed it by delaying RemoveTripmines by 0.1 seconds in PlayerDeath to give the engine time to call mineBreak on all mines in the area.
    I attached a version with the fix and the improved beam trigger code (as described in previous post).
    This version if you have the deaths but is activated teamkiller when the player touch themine

    I made ​​several modifications without success and I would like to ask to Quimbo or Naris help me change it

    Escuseme my english Iīm Spanish
    Sevi_FyA is offline
    lascage
    Member
    Join Date: Nov 2010
    Old 11-20-2011 , 04:14   Re: Tripmines
    Reply With Quote #3

    Can you help me for my ask ? look up the thread.
    thx
    lascage is offline
    Sevi_FyA
    Member
    Join Date: Jul 2011
    Location: Seville
    Old 11-20-2011 , 09:49   Re: Tripmines
    Reply With Quote #4

    Quote:
    Originally Posted by lascage View Post
    Can you help me for my ask ? look up the thread.
    thx
    I donīt Know, My nivel is low
    Sevi_FyA 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 12:21.


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