View Single Post
  #1  
Old 08-30-2009, 11:48 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Custom/Default Toggle

Well this is basically a weapon script for switching your server from a default to a custom mode. Which essentially is the first step in developing custom systems for your server.

I generally give this it's own weapon script and list it first in weaponorder= in the serveroptions, because having the enables and disables all over the place is messy and you can end up with unneeded bugs. I.e: Zodiac's old map opening on crossing level link bug.

It's very basic so feel free to expand upon it in your own implementations, which may include special conditions for the different modes and so on.

PHP Code:
/*
   Allows easy-toggling between Default and Custom systems.
*/
//#CLIENTSIDE

function onPlayerEnters() {
  if (
this.defaultmode) {
    
onDefaultMode();
  } else {
    
onCustomMode();
  }
}

function 
onCustomMode() {
  
showstats(1024);
  
enablefeatures(allfeatures-2-4-8-0x100-0x200-0x400-0x800-0x2000-0x40-0x10-0x20);
  
disablemap();
  
disablepause();
  
disableweapons();
  
disableselectweapons();  
}

function 
onDefaultMode() {
  
enablemap();
  
enablepause();
  
enableweapons();
  
enableselectweapons();
  
enablefeatures(allfeatures);
  
showstats(allstats);  

If you have no need to switch between the two, feel free to use the onCustomMode function for your own use, of course you'll have to alter the enablefeatures flag portion to meet your custom needs

On the Zodiac Dev server I use the following script to toggle between the modes.

PHP Code:
function ChatBar.onAction() {
  if (
ChatBar.text == "/classicmode") {
    
ChatBar.text "";
    
this.defaultmode = !this.defaultmode;
    for (
temp.wepplayer.weapons) {
      
wep.trigger("PlayerEnters""");
    }
  }

__________________
Quote:
Reply With Quote