AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   MvM_allinone (v2.1.5) (https://forums.alliedmods.net/showthread.php?t=6529)

karlos 10-05-2004 13:26

MvM_allinone (v2.1.5)
 
5 Attachment(s)
Code:

/*
* This plugin is allows you to run Marine vs Marine without any problems
* - Players and buildings are now Blue vs Red (new models)
* - MvM in classic
*
* Author:
*        -> White Panther
*
* Credits:
*        Sandstorm                                -        rip from his ava for scoreboard fix
*        CheesyPeteza                                -        his Respawn System
*        DarK_SouL                                -        his fix of CheesyPeteza        Respawn System and winning message change
*        Zamma & White Panther                        -        mvmmodels plugin
*        mahnsawce                                -        rip off from MvM Auto Glow plugin and his weld fix
*        CorDorMick                                -        testing
*        -mE-                                        -        idea for code performance
*        Depot                                        -        his assistance in getting bugs fixed
*        OneEyed + theqizmo                        -        helping with MvM crashes (back to old code) + speed performance
*        9 iI IN C IH G IL O C IK                -        his v_ color models
*        #endgame                                -        basic v_ model code
*        ZODIAC + the RichNet NS Community        -        testing
*
* Usage:
*        - say "/votemvm"        ->        to start a vote to play current map in MvM mode ( if config available )
*        - amx_mvm_convert        ->        to change to this map and run it in MvM mode
*        - amx_mvm_auto                ->        turns autoassign on or off
*
* Info:
*        - Converter config files are expected to be in amxmodx/configs/mvm_configs/
*        - each file must be named <Map-Name>.cfg ( without .bsp )
*
* v1.0:
*        - initial release
*
* v1.1.3:
*        - fixed prob where models were precached on all combat maps instead of only on mvm combat (mahnsawce)
*        - fixed bug where players respawned and model has not been changed
*        - error with unknown players should be fixed
*
* v1.2.3:
*        - fixed:
*                - possible error
*                - error with unknown players
*                - plugin was not running on maps where CC was on team 2 instead of 3
*        - added:
*                - ability to autoassign players (default off) (amx_mvm_auto 1/0)
*        - changes:
*                - moved from ns2amx to engine + fakemeta + ns
*
* v1.2.9c:
*        - fixed:
*                - bug where red teams scoreboard was green while players where reinforcing
*                - players could have default (green) model until they died or got JP/HA
*                - red players could spectate through eyes of blue players when dead
*                - another default model bug
*                - changed the way of getting command chairs and armorys to improve speed (thx -mE-)
*        - added:
*                - respawn display added
*        - changed:
*                - the new temp command chair (red team) will get all pevs from the original copied
*                - the way of getting the players team (not pev anymore)
*                - code improvements (+)
*
* v1.3:
*        - fixed:
*                - again another default model bug (:P)
*                - red CC has now correct animation
*        - changed:
*                - code improvements
*
* v1.3.2b:
*        - fixed:
*                - dublicated red CC (during initialization and ingame)
*                - runtime error
*        - changed:
*                - moved from pev/set_pev to entity_get/entity_set
*
* v1.3.3:
*        - fixed:
*                - crash on some maps
*        - changed:
*                - code cleaning
*
* v1.4:
*        - fixed:
*                - crash bug on maps (notice that on some maps team bases have been switched,
*                        this is a crash prevention due to bad maps)
*        - changed:
*                - check for precaching models
*
* v1.5:
*        - fixed:
*                - crash bug on maps (now seems to be completely fixed)
*                        ( PS: switching team bases has been removed )
*
* v1.5.3:
*        - fixed:
*                - another crash on bad made maps ( 2nd cc was not set to 3 but to 2 )
*                - possible bug where cc could be switched
*        - changed:
*                - removed unneeded code
*
* v1.5.4:
*        - fixed:
*                - horrible bug where cc was removed on all non MvM maps ( sry )
*
* v1.6:
*        - fixed:
*                - all crash bugs
*        - changed:
*                - reversed to 1.2.3 method ( thx "OneEyed" and "theqizmo" )
*                - code improvements
*
* v1.6.2:
*        - fixed:
*                - possible bug where blue could not see red teams normal chat (dont think it has ever happened but bug was there)
*        - changed:
*                - minor speed improvement
*                - code improvements
*
* v1.6.3:
*        - fixed:
*                - problem where red team did not spawn ( accidently stopped an inportant timer, sry )
*
* v1.6.4:
*        - fixed:
*                - minor runtime error (very rare and not harmful )
*        - changed:
*                - server_frame is hooked with ent and support other plugins that uses the same system (speed improvement thx OneEyed)
*
* v1.6.5:
*        - fixed:
*                - client_spawn blocked other plugins to call that function (thx KCE)
*
* v1.7:
*        - fixed:
*                - NS 3.1 support
*        - changed:
*                - removed about 50% of code due to NS 3.1
*
* v1.7.1:
*        - fixed:
*                - minor runtime error
*
* v1.7.3:
*        - fixed:
*                - compatibility with hybrid maps
*        - changed:
*                - new MvM map detection results in much smaller code
*
* v2.0.3:
*        - added:
*                - support for classic MvM ( ns_mvm_ maps )
*        - changed:
*                - entity_get/set_xxx replaced with pev/set_pev ( performance )
*                - minor code tweaks
*
* v2.1.0:
*        - fixed:
*                - player could get wrong model on round start
*                - improved classic support:
*                        - electrified Structures have correct color
*                        - correct elec spark color
*                        - commander gets notified when upgrades have finished
*        - added:
*                - Converter to change MvA to MvM on the fly ( map restart needed )
*                - support for colored view models
*                - Helper support
*                - team names can be changed via defines
*        - changed:
*                - NS 3.2 merge
*
* v2.1.0b:
*        - fixed:
*                - bug in mvm config parsing
*
* v2.1.1:
*        - fixed:
*                - structures could get wrong model after upgrade complete
*                - second marine team would not get upgrades
*                - icons for placed structures/drop items are now shown ( except mines )
*
* v2.1.2:
*        - fixed:
*                - blue team accidently got involved into checks ( classic maps )
*
* v2.1.3:
*        - fixed:
*                - joining teams now gives a correct message "XXX has joined the YYY"
*                - "client_impulse" not checked on combat maps
*                - removed unneeded code
*        - added:
*                - define to determine winner by score in case of a tie
*        - changed:
*                - if both CC's are alive there is a tie
*
* v2.1.4:
*        - fixed:
*                - if "TIE_WIN_BY_SCORE" was enabled, winning by destroying enemy CC was ignored
*
* v2.1.5:
*        - fixed:
*                - winning message on some maps incorrect
*/

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <ns>

MvM_allinone + Models (download here)

MvM Models and Configs

"mvm_configs.rar" has some predefined configurations to convert default maps to MvM, just extract them to "SteamApps/<account>/half-life/ns/amxmodx/"

"mvm_models_basic.rar" is needed, just extract it to "SteamApps\<account>\half-life\ns\"

"mvm_models_ns_buildings.rar" is only needed if you want to play MvM on NS, just extract it to "SteamApps\<account>\half-life\ns\"

"mvm_v_models.rar" (models by "9 iI IN C IH G IL O C IK") is only needed if you want to play MvM with correct view models ( eg: your own hand with a GL ), just extract it to "SteamApps\<account>\half-life\ns\"
You will need to edit sma to enable those new v_ models

Johnny got his gun 10-05-2004 15:57

Exactly why can't you check amount of "commchairs"?

depot 10-05-2004 16:21

Re: mvm_allinone
 
Quote:

Originally Posted by karlos
IMPORTANT:
when this plugin is loaded and a combat map is running clients will download the model even if not mvm (its due to amxx cause i cant check the amount of commchairs in plugin_precache() [with amx it works :evil

As noted in the modNS.org forums, I hope there's a workaround for this.
Any server op in his right mind is going to have sv_downloadurl enabled, and for every player that joins my server to be forced to download the models would gobble up my month's allocation of bandwidth up in about 2 days. Perhaps Steve could help you code this to prevent all clients from having to download the models. Or maybe even a MetaMod plugin?

voogru 10-05-2004 17:37

Why not just detect the map name for co_ ?

Thats how NS determines if its a combat map or not.

devicenull 10-05-2004 18:13

Quote:

Originally Posted by voogru
Why not just detect the map name for co_ ?

Thats how NS determines if its a combat map or not.

Either one of two things happened here:
1) This isnt the voogru we're thinking of
2) You haven't heard of marinevsmarine maps? They're a hack on the combat maps.. so you need to look for two commchairs on the map

I use this code to count cc's
Code:
new cc, count cc = find_ent_by_class(0,"team_command") while (cc != 0) { count++ cc=find_ent_by_class(cc,"team_command") }
Sorry I cant indent it, I'm typing this right into my webbrowser

BigBaller 10-05-2004 19:04

2 Attachment(s)
I unrar your files and zipped them up for you. More people use winzip then ace or winrar for there file compression needs.

To save you some trouble (and support questions) here they are.

Just ask me to remove attachments if you want me to.

voogru 10-05-2004 20:15

Quote:

Originally Posted by devicenull
Quote:

Originally Posted by voogru
Why not just detect the map name for co_ ?

Thats how NS determines if its a combat map or not.

Either one of two things happened here:
1) This isnt the voogru we're thinking of
2) You haven't heard of marinevsmarine maps? They're a hack on the combat maps.. so you need to look for two commchairs on the map

Okay, I misunderstood the problem.

fsfod 10-06-2004 06:41

ns has not created the cc's when plugin_precache is called they are created some time after
and remove check_create function it does nothing in amxx

trying todo anything entity related in plugin_precache is bound to lead to problems.

karlos 10-06-2004 12:12

Quote:

Originally Posted by fsfod
ns has not created the cc's when plugin_precache is called they are created some time after

yes this must be so, but with amx it works, and there must be a posiblility, maybe to read data from the bsp as it is there defined to spawn 2 ccs
Quote:

Originally Posted by fsfod
and remove check_create function it does nothing in amxx

u r wrong, its needed so that a new cc is created and asigned to team 2 and gets the propertys of the original cc
removing or changing to team 2 the original cc results in game end
without it the red team would not have a cc (cc is somewhere else) so they cant loose
Quote:

Originally Posted by fsfod
trying todo anything entity related in plugin_precache is bound to lead to problems

see point 1, amx it works amxx NOT

@devicenull
your code does the same thing mine does
Code:
check_cc_num(){     new entid = find_ent_by_class(-1, "team_command")     new num     while( entid > 0 ){         num++         if( num > 1 )             return 1         entid = find_ent_by_class(entid, "team_command")     }     return 0 }

@BigBaller
i dont mind
the reason of using ace is the compresion advantage and i only have 4 mb space and with this i have 3.27mb used

PS:
WHY U RATE IT AS BROKEN AS IT IS WORKING !!!!!!!!!!!!

Johnny got his gun 10-07-2004 03:11

Sorry I'm not into NS but if AMX can do it I'm sure we can do it as well. Not like we're working on different HL engines here. ;-)

You could try hooking a few function calls using the fakemeta module, like setmodel or other that are called at/before precache time, to see if you need to precache these models.

A very hacky solution could be to use the c-style file functions to read through the whole map file in plugin_precache to see how many times "commchair" occurs, that should be the number of entities used.

Btw why not write like this:
Code:
check_cc_num() {     new entity = 0, commchairs = 0     while ((entity = find_ent_by_class(entity, "team_command")))         commchairs++         return commchairs }


All times are GMT -4. The time now is 02:34.

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