AAO25.com
Community => Games & Programming => Topic started by: LEEFFM on Friday, December 05, 2014, 01:51:36 AM
-
Code Located At http://pastebin.com/WDFYBxAL (http://pastebin.com/WDFYBxAL)
when I pasted it some areas where tabbed even though they are not tabbed in the document just makes it look messier lol.
This is the Ultimate Mod ive been working on not done yet still have plans for it.
as of now the client commands are:
everyone is a medic there is no command it is forced.
mutate thirdperson - Sets Behindview On
mutate firstperson - Sets Behindview Off
mutate [class] - Forces You A Weapon While Alive
classes are: AR,RPK,R,AK,G,GP,M,SF,AK74SU,PSO,MOS,SVD,S24,S,SPR,V,RPG,AT4,M9
mutate shotty - Forces You A Shotgun While Alive
current admin commands consist of:
all client commands
mutate allowrifles 1|2 - 1 Rifles Are Allowed | 2 Rifles Are Not Allowed
mutate allowmgs 1|2 - 1 Machine Guns Are Allowed | 2 Machine Guns Are Not Allowed
mutate allowsnipers 1|2 - 1 Snipers Are Allowed | 2 Snipers Are Not Allowed
mutate nvg 1|2 - 1 Night Vision Goggles Are Allowed | 2 Night Vision Goggles Are Not Allowed
mutate allowrockets 1|2 - 1 Rockets Are Allowed | 2 Rockets Are Not Allowed
(Shotgun and M9 are always allowed!)
mutate riflesonly 1|2 - 1 Rifles Only On | 2 Rifles Only Off
mutate mgsonly 1|2 - 1 Machine Guns Only On | 2 Machine Guns Only Off
mutate snipersonly 1|2 - 1 Snipers Only On | 2 Snipers Only Off
mutate shottyonly 1|2 - 1 Shotty Only On | 2 Shotty Only Off
mutate m9only 1|2 - 1 M9 Only On | M9 Rifles Only Off
mutate kill [PlayerID] - kills player "PlayerName has Killed Himself" displays reason as "PlayerName has been killed by an Admin for Violation(s) of Server Rules!" people disobeying rules don't kick or ban unless you have to stop their rule breaking in its tracks.
mutate jail [PlayerID] - sends player to Leavenworth with reason "PlayerName was Court Marshaled for Violation(s) of Server Rules!" the same person(s) still disobeying rules and not listening to admins send them to jail.
mutate addadmin [PlayerID] - temporarily adds admin Note: this does not edit your ini files you must still add admins in manually but for temporary use this command
mutate restart - spams console command "admin say SERVER IS RESTARTING!!!" so people know when your manually restarting your server.
mutate rules - shows server rules.
mutate clist - shows a list of commands
The Compiled Mod Is Located at http://www.megafileupload.com/en/file/585196/UltimateMod-u.html (http://www.megafileupload.com/en/file/585196/UltimateMod-u.html)
you must remove the [Megafileupload] from the name of the file to use it.
place the file in your servers system folder.
under [Engine.GameEngine]
add line: ServerActors=UltimateMod.ultimatemod
hackhunter must = 0 for mutate thirdperson or your screen will shake and it will kick you back to firstperson. hackhunter being disabled disables tracking but mod servers are not tracked anyways. hackhunter is where all warning you see in game are that make your screen shake.
-
Don't know how much you know about code optimisation, but this one is the mess ...
1. use 'switch' or 'else if' statement - if not, engine will check every single 'if' even if already found one.
2. no need to compare a bool variable ('if (bAllow203 == true)') - bool variable it self is enough ('if (bAllow203)')
3. use '&&' statement instead of writing the pyramid of 'if' statements.
e.g. Bad:
function checkdefaultsettings () {
if (bAllowRifles == true) {
if (bAllow203 == true) {
if (bAllowMgs == true) {
if (bAllowSnipers) {
if (bAllowRockets == true) {
if (bNVG == true) {
bDefaultSettings = true ;
}
}
}
}
}
}
}
Good:
function checkdefaultsettings ()
{
if (bAllowRifles && bAllow203 && bAllowMgs && bAllowSnipers && bAllowRockets && bNVG)
bDefaultSettings = true;
}
Last thing: Keep all brackets visible as in example above to keep code clean and transparent.
-
thanks for the tips but as for the last tip I like doing it
function MyFunction {
}
its easier for myself to read the code that way :P but I will defiantly use the other tips ^^
-
... but harder to find missing bracket.
Try to keep your code modular as possible - it helps to understand and above all you can't get lost ...
-
I gotta admit, I do the same thing LEEFFM does. Except, I comment the ending bracket to state which function or item it belongs to.
-
I do what NoBigDeal does. It just makes the code much easier to read with the brace on a new line. I find it annoying that Netbeans and Eclipse default to the same line braces, although you can change it after doing some digging through the settings.