AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [DoDS] Medic Class 1.0.111 UPDATED April, 9, 2009 (https://forums.alliedmods.net/showthread.php?t=73997)

strontiumdog 07-10-2008 01:40

[DoDS] Medic Class 1.0.111 UPDATED April, 9, 2009
 
8 Attachment(s)
This is the SourceMod port of my Medic Class plugin (originally for ES).
This version is much better with smaller code and more stable.

http://i56.photobucket.com/albums/g1...nyalpha/59.jpg

The plugin features:
  • Restriction of plugin to a particular class
  • The medic's speed, ability to jump and overall health can be configured easily
  • Medics can be restricted to a certain number per team
  • Medics can heal up to a certain number of times before running out of supplies (medic packs)
  • Messages can be turned off to the medic
  • More reliable means of determining how close a medic is to the patient
  • Primary weapons can be picked up and used or it can be set to remove them on first shot
Installation
  • Copy sm_dod_medic_class.smx to addons/sourcemod/plugins
  • Unzip the folders from medic_files.zip and copy into models, sounds and materials folders - these are the medic models and bandage sound. Ensure your server is not sv_pure 2.
  • Add the models, materials and sounds to your Fast download server
  • Requires SourceMod 1.2+
Commands
!medic in chat (sm_medic in console)
Calls for a medic - has spam protection

!heal in chat (sm_heal in console)
If you are a medic, you can heal a player. You will need to stand close by them to perform a healing. A player can be healed up to maximum health but may take several medic packs to do so.

!class_medic in chat (sm_class_medic in console)
Changes to the medic class. If you change to another class or team or say !class_medic again, you will stop being a medic.

!medic_who in chat (sm_medic_who)
Lists the medics on your team


Configuration
  • sm_dod_medic_weapon 0
    default: 0
    0 will set the Medic's weapon to a pistol, 1 to a M1Carbine/C96
  • sm_dod_medic_ammo 14
    default 14
    The amount of ammo to put in the Medic's weapon
  • sm_dod_medic_nades 1
    default: 1
    Type of nade to give to the Medic
    0 is no nades (disabled), 1 is smoke nades, 2 is nades
  • sm_dod_medic_nades_ammo 1
    default: 1
    Number of nades to give to the Medic
  • sm_dod_medic_speed 1.1
    default: 1.1
    The speed of the Medic. Setting to 1.0 makes them run at the same speed as the other players
  • sm_dod_medic_weight 0.9
    default: 0.9
    The weight of the Medic. Setting to 1.0 makes them lighter and thus can jump a little higher
  • sm_dod_medic_health 80
    default: 80
    Sets the health of the Medic. Setting to 100 gives them the same health as the other players
  • sm_dod_medic_maxhealing 50
    default: 50
    The maximum amount of healing a medic can do with one Medic Pack
  • sm_dod_medic_max 2
    default: 2
    Maximum number of medics per team
  • sm_dod_medic_packs 20
    default: 20
    Sets the number of Medic Packs a medic gets at spawn
  • sm_dod_medic_messages 1
    default: 1 (0 to disable)
    1 is to display messages to the client
  • sm_dod_medic_restrict 0
    default: 0
    The Class to restrict Medics to - often used on some servers where server ops do not want snipers or MGers playing Medic
    1 = Rifleman
    2 = Assault
    3 = Support
    4 = Sniper
    5 = MG
    6 = Rocket
  • sm_dod_medic_useweapons 1
    default: 1
    1 is to allow medic to pickup weapons, 0 to remove the primary weapon on the first shot
  • sm_dod_medic_minplayers 6
    default: 0
    Sets the minimum number of players required on the server before the Medic Class becomes available. Otherwise players can self-heal instead
  • sm_dod_medic_minhealth 20
    default: 20
    Sets the minimum health required before self healing can occur
  • sm_dod_medic_maxhealth 100
    default: 100
    Sets the maximum health a player can be healed to
Changelog
Version 1.0.100
SourceMod release.

Version 1.0.101
Checks to see if pistols plugin added before adding weapons
Fixed bug where medic was able to heal enemies
Fixed bug where dead players could heal
Changed the way bandage sound is delivered
Added sounds to replace spammy messages
Fixed patient selection bug

Version 1.0.102
Added self heal plus two cvars for self healing
Fixed some minor bugs
Fixed up the code for becoming a medic
Added an option that removes a Medic's Primary weapon

Version 1.0.103
Added MaxHealth cvar provided by Lebson506th
Fixed so that medic changes only at respawn

Version 1.0.104
Fixed stupid bug in dod_stats_weapon_attack where the script tried to remove a punch weapon.....

Version 1.0.105
Fixed bug where player assumed medic features without respawning

Version 1.0.106
Fixed a bug where the server would crash if there was one bullet left in a clip.
Fixed a bug where players can fill up medic slots during respawn.

Version 1.0.107
Fixed a bug where players changing class without dying, remained medics...

Version 1.0.108
Added log action for stats.

Version 1.0.109
Fixed a bug in the 'medic who' code where it looked at the number of players on the spectator team rather than the Axis team

Version 1.0.110
Added Lebson and PsychoCoder's amendments to the code.

Version 1.0.111
Fixed minor bug - thanks Lebson


Notes
Has been tested in DoDS

If your server crashes as soon as you spawn as a medic, it probably means you have not updated to the latest gamedata/sdktools.games.ep2.txt file

Selecting a M1Carbine/C96 with smoke grenades will not work as these occupy the same weapon slot

In HLStatsX or similar stats program, create a new action called "medic_heal" and assign 1pt. Every time the player heals, they can be awarded one point for healing.


Credits
Big thanks to Lebson506th for testing and suggesting changes and updates.

Thanks to PsychoCoder for improving parts of the code.

Thanks to URF and Kamping_Killoch who did amazing medic models!

strontiumdog 07-10-2008 01:41

Re: [DoDS] Medic Class
 
I'll be back from a trip on Tuesday - any problems....well, you know the routine!
:D

DontWannaName 07-10-2008 01:51

Re: [DoDS] Medic Class
 
Dont forget to make sure that models and sounds and stuff are excluded from sv_pure 1. :D

doom_laur 07-10-2008 11:11

Re: [DoDS] Medic Class
 
Quote:

Originally Posted by strontiumdog (Post 650502)
Configuration
  • sm_dod_medic_weapon 0
    default: 0
    0 will set the Medic's weapon to a pistol, 1 to a M1Carbine/C96
  • sm_dod_medic_ammo 14
    default 14
    The amount of ammo to put in the Medic's weapon
  • sm_dod_medic_nades 1
    default: 1
    Type of nade to give to the Medic
    0 is no nades (disabled), 1 is smoke nades, 2 is nades
  • sm_dod_medic_nades_ammo 1
    default: 1
    Number of nades to give to the Medic
  • sm_dod_medic_speed 1.1
    default: 1.1
    The speed of the Medic. Setting to 1.0 makes them run at the same speed as the other players
  • sm_dod_medic_weight 0.9
    default: 0.9
    The weight of the Medic. Setting to 1.0 makes them lighter and thus can jump a little higher
  • sm_dod_medic_health 80
    default: 80
    Sets the health of the Medic. Setting to 100 gives them the same health as the other players
  • sm_dod_medic_maxhealing 50
    default: 50
    The maximum amount of healing a medic can do with one Medic Pack
  • sm_dod_medic_max 2
    default: 2
    Maximum number of medics per team
  • sm_dod_medic_packs 20
    default: 20
    Sets the number of Medic Packs a medic gets at spawn
  • sm_dod_medic_messages 1
    default: 1 (0 to disable)
    1 is to display messages to the client
  • sm_dod_medic_restrict 0
    default: 0
    The Class to restrict Medics to - often used on some servers where server ops do not want snipers or MGers playing Medic
    1 = Rifleman
    2 = Assault
    3 = Support
    4 = Sniper
    5 = MG
    6 = Rocket

Where should this be written? Is it necessary to put it into the cfg folder?

Mosalar 07-10-2008 16:02

Re: [DoDS] Medic Class
 
Awesome job Dog! here's a few initial "features".

1. The pistols plugin gives a pistol to the medics(with sm_dod_medic_weapon 1)
2. Medics can heal either team.
3. You can hear the bandage sound from from far away, and on either team(like an axis medic heals a player from the other side of the map, the allies all hear it too) maybe some radius_sound cvar?
4. Can you set a !heal timer/limiter? With a bind you can spam the chat and ears of everyone.

Win 2003 X64
MM:S v1.6.1.671
SourceMod v1.1.$PREVISION.2343

Lebson506th 07-11-2008 10:37

Re: [DoDS] Medic Class
 
Great work so far, love using this plugin on our server but something else i mentioned (besides the above mentioned things) is that medics can heal when dead... somehow.

russell99ky 07-14-2008 23:39

Re: [DoDS] Medic Class
 
Installed works fine up until someone trys to spawn as a medic then it crashes server, any ideas?

Lebson506th 07-15-2008 09:03

Re: [DoDS] Medic Class
 
Recently i've been getting some reports that when some people try to spawn it automatically makes them a medic and they have to restart the game to get out of it.

(IE, the normal command does not get them out of medic)

strontiumdog 07-15-2008 19:44

Re: [DoDS] Medic Class
 
Quote:

Originally Posted by Mosalar (Post 650820)
Awesome job Dog! here's a few initial "features".

1. The pistols plugin gives a pistol to the medics(with sm_dod_medic_weapon 1)
2. Medics can heal either team.
3. You can hear the bandage sound from from far away, and on either team(like an axis medic heals a player from the other side of the map, the allies all hear it too) maybe some radius_sound cvar?
4. Can you set a !heal timer/limiter? With a bind you can spam the chat and ears of everyone.

Win 2003 X64
MM:S v1.6.1.671
SourceMod v1.1.$PREVISION.2343

OMG!
I will add a delay so that when the Pistols one gives out the ammo as usual, this plugin will strip them and then add its own.

Or maybe I should make a class with a number of 6
:D
Maybe the server will crash - running off to try!

Will change healing to team only (but that's against the Hippocratic Oath!)

Will change the sound volume. I wanted others to hear it so that an enemy can hear a soldier getting healed nearby.

Will fix the !heal issue.....

conduit 07-15-2008 22:03

Re: [DoDS] Medic Class
 
This mod seems to crash my server every time someone spawns as a medic.

I'm running:
Metamod:Source version 1.6.1.671
SourceMod Version: 1.0.3 (Compiled on: Jun 24 2008 22:44:47)

Looked through my logs and couldn't find anything.

Any suggestions?

strontiumdog 07-15-2008 22:29

Re: [DoDS] Medic Class
 
@conduit

This is a symptom of this file

orangebox/dod/addons/sourcemod/gamedata/sdktools.games.ep2.txt

not having the correct offsets.
Check that
PHP Code:

            "GiveNamedItem"
            
{
                
"windows"    "350"
                "linux"      "351"
            


is what you have....

strontiumdog 07-15-2008 22:37

Re: [DoDS] Medic Class
 
Quote:

Originally Posted by doom_laur (Post 650671)
[/list]Where should this be written? Is it necessary to put it into the cfg folder?

Add it to the end of your server.cfg file

strontiumdog 07-16-2008 02:05

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
Updated.

Rather than adding a !heal timer, I simply changed the way the sound is delivered....only the medic and the patient hear the sounds now.

Lebson506th 07-16-2008 09:36

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
I changed the "Who" function to say if there are no medics on your team.

Code:

public Action:Who(client, args)
{
    new team = GetClientTeam(client)
    new ctr = 0
   
    for (new i = 1; i <= GetConVarInt(g_Cvar_MedicMax); i++)
    {
        if (g_medic_master[team][i] != 0)
        {
            new String:playerName[128]
            GetClientName(g_medic_master[team][i], playerName, sizeof(playerName))
            PrintToChat(client, "Medic #%i: %s", i, playerName)
            ctr++
        }
    }

    if(ctr == 0)
    {
        PrintToChat(client, "[SM] There are no medics on your team")
    }

    return Plugin_Handled
}


strontiumdog 07-16-2008 09:49

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
Nice addition
:D

??? | Jack Bauer 07-16-2008 12:43

Re: [DoDS] Medic Class
 
Quote:

Originally Posted by strontiumdog (Post 653377)
@conduit

This is a symptom of this file

orangebox/dod/addons/sourcemod/gamedata/sdktools.games.ep2.txt

not having the correct offsets.
Check that
PHP Code:

            "GiveNamedItem"
            
{
                
"windows"    "350"
                "linux"      "351"
            


is what you have....


I have the same Error and i have checked the settings you said. Server crasht again.

iBOT 07-16-2008 15:46

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
Same here! I use all the new files but server crashes everytime a medic should spawn

strontiumdog 07-16-2008 17:18

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
Yep.
I just tried 1.0.3 and the latest snapshot, and even on a vanilla server with no third party plugins, it crashes.

Here are links to a 1.1.0.2356 snapshot that works:
Windows: http://www.theville2.org/dods/sourcemod-1.1.0-r2356.zip
Linux:http://www.theville2.org/dods/source...0-r2356.tar.gz

Lebson506th 07-16-2008 18:15

Re: [DoDS] Medic Class UPDATED July 15, 2008
 
I'm running 1.1.0.2417 and it works fine for me.

Except sometimes they can't get out of medic or are made medics without typing the chat command.

strontiumdog 07-17-2008 00:44

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Updated with a few new features.

Lebson506th 07-17-2008 09:01

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Working great so far.

I noticed one thing though. When the gun disappears, it doesn't switch back to the pistol. Is that possible to do?

strontiumdog 07-17-2008 09:25

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
I noticed that too, but I think weapon selection is client side.

Lebson506th 07-17-2008 09:40

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
I added a cvar like you used to have in the ES version, the max health that a player can be healed to.

...rather than full health... you know what i'm talking about?

sm_dod_medic_maxhealth

Defaults to 80


Haven't tested it... nobody on my server.

Join me if you'd like, Dog =)

74.86.201.184:27015 http://www.game-monitor.com/i/launch.gif


Edit: Tested it, it works.
Edit2: Bug i just found. Doing the medic command takes you off of medic immediately rather than on spawn. Means you can toggle being able to use the weapons or healing just using a bound key. Fix: Take off medic on next spawn.

strontiumdog 07-17-2008 13:40

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Quote:

Edit2: Bug i just found. Doing the medic command takes you off of medic immediately rather than on spawn. Means you can toggle being able to use the weapons or healing just using a bound key. Fix: Take off medic on next spawn.
I know about this one too. Will figure out a work around...

Lebson506th 07-17-2008 13:41

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
I'm not a plugin coder, but i'm a good debugger and i pick up coding very quickly so i can offer help if you ever want it.

strontiumdog 07-17-2008 14:28

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Updated again
:D

See OP for changelog

Lebson506th 07-17-2008 14:48

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Awesome.

Now i only have 1 plugin to change for each release.

You make my life so easy Dog =)

Mosalar 07-17-2008 17:37

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
How hard would it be to have the plugin randomly choose and spawn someone as medic? And reset/rechoose on round start/end.

strontiumdog 07-17-2008 20:15

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
:shock:

Never gave it any thought, but I know on our server, it'd be soooo unpopular. People would be switching back out of medic just to get back to playing with a garand or k98....

Lebson506th 07-30-2008 19:29

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Thanks to my testers on my server we just found of a large bug that requires attention.

If a medic has an assault rifle (Thompson or MP40) and they use the Punch (MOUSE2) it crashes the server immediately. No error message.

strontiumdog 07-30-2008 19:41

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
<------- Spot the idiot.

I added punch to the list of weapons to remove....which would crash a server.
Should work now.

Lebson506th 07-30-2008 20:03

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Still crashes.


EDIT: Nevermind. A warning though, just reloading the plugin didn't do it. The server had to be restarted.
EDIT2: A thought, can you put in a case that responds to the sm_medic_who to the console is client == 0?

strontiumdog 07-30-2008 22:02

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
I've noticed that after recent updates in SourceMod.
Just reloading worked for some plugins but not others.

Will look at the sm_medic_who thingy!

Mosalar 07-30-2008 22:25

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
I can see how to restrict the use to a single class, is there a way to restrict it to 2-3 classes?

strontiumdog 07-31-2008 00:10

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
Yeah, I've been meaning to add this. The ES version had that.

Lebson506th 08-04-2008 16:35

Re: [DoDS] Medic Class UPDATED July 16, 2008
 
If you are playing as a normal class, type !class_medic and then shoot your gun it is destroyed like you instantly became a medic.

and

Code:

L 08/04/2008 - 18:17:56: Info (map "dod_argentan") (file "errors_20080804.log")
L 08/04/2008 - 18:17:56: [SM] Native "GetClientTeam" reported: Client 9 is not in game
L 08/04/2008 - 18:17:56: [SM] Debug mode is not enabled for "sm_dod_medic_class.smx"
L 08/04/2008 - 18:17:56: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 22 on

I'll try to get the debug


Also, this should make the sm_medic_who respond to a console query

PHP Code:

public Action:Who(clientargs)
{
    new 
ctr 0
    
if(client == 0) {
        for(new 
1<= GetConVarInt(g_Cvar_MedicMax); i++) {
            if(
g_medic_master[1][i] != 0) {
                new 
String:playerName[128]
                
GetClientName(g_medic_master[1][i], playerNamesizeof(playerName))

                
PrintToServer("Axis Medic #%i: %s"iplayerName)
                
ctr++
            }
        }
        for(new 
1<= GetConVarInt(g_Cvar_MedicMax); i++) {
            if(
g_medic_master[2][i] != 0) {
                new 
String:playerName[128]
                
GetClientName(g_medic_master[2][i], playerNamesizeof(playerName))

                
PrintToServer("Allies Medic #%i: %s"iplayerName)
                
ctr++
            }
        }
    }
    else {
        new 
team GetClientTeam(client)

        for (new 
1<= GetConVarInt(g_Cvar_MedicMax); i++) {
            if (
g_medic_master[team][i] != 0) {
                new 
String:playerName[128]
                
GetClientName(g_medic_master[team][i], playerNamesizeof(playerName))

                if (
IsClientInGame(client)) {
                    
PrintToChat(client"Medic #%i: %s"iplayerName)
                }
                
ctr++
            }
        }    
    }

    
// Added by Lebson506th
    
if (ctr == 0) {
        if(
client == 0) {
            
PrintToServer("[SM] The medic class is not being used")
        }
        else if (
IsClientInGame(client)) {
            
PrintToChat(client"[SM] There are no medics on your team")
        }
    }

    return 
Plugin_Handled



Lebson506th 08-04-2008 21:42

Re: [DoDS] Medic Class UPDATED August 4, 2008
 
I see the update, here's the debug info.

It's fixed in my above posted and improved code

Code:

L 08/04/2008 - 18:36:13: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
L 08/04/2008 - 18:36:13: [SM] Displaying call stack trace for plugin "sm_dod_medic_class.smx":
L 08/04/2008 - 18:36:13: [SM]  [0]  Line 553, /home/groups/sourcemod/upload_tmp/phpymePoi.sp::Who()


Edit: I just came up with an idea. Can you hook the say and stop the player from actually saying "!heal" so it doesn't spam the chat?

coal 08-23-2008 19:03

Re: [DoDS] Medic Class UPDATED August 4, 2008
 
i tryed every thing wont work on my server still crashes im runnig 1.0.0.11 had to take it off

Lebson506th 08-23-2008 19:06

Re: [DoDS] Medic Class UPDATED August 4, 2008
 
Quote:

Originally Posted by coal (Post 674435)
i tryed every thing wont work on my server still crashes im runnig 1.0.0.11 had to take it off

What version of sourcemod?

Are there errors that come up when you try to run it?

coal 08-23-2008 22:47

Re: [DoDS] Medic Class UPDATED August 4, 2008
 
mani v 1.2betes mm:s v1.6.1 havent seen any errors


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

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