View Single Post
  #4  
Old 12-02-2009, 10:24 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Thanks for the advice Chompy. I was actually thinking to myself in Maths today: "Crap, I forgot to add functionality to update the list! Damn...", lol.

Anyway, enjoy!

EDIT: Holy crap, I didn't expect the percentage symbols to work!

Instructions & Code
Add this to Control-NPC - if event exists, just copy the function call and do whatever you wish.

PHP Code:
function onRCChat() {
  if ( 
params[0] == "updateweaponlist" ) ( @ globalWeaponTrigger ).updateWeaponList();

This is the updated code:

PHP Code:
function onCreated() {
  
updateWeaponList();
  
globalTriggerName this.name;
}

public function 
triggerAlleventNameparameters ) {
  for ( 
temp.weaponthis.weapons ) {
    ( @ 
temp.weapon ).triggereventNameparameters );
  }
}

public function 
updateWeaponList() {
  
this.weapons NULL;
  
  
temp.charMap = {
                  {
"%045""-"},
                  {
"%042""*"},
                  {
"%047""/"},
                  {
"%032"" "}
                 }; 
  
  
temp.weaponsFolder.loadfolder"weapons/*.txt");
  
  for (
temp.weapontemp.weaponsFolder) {
    
removeescapesfromfilenametemp.weapon );
    
this.weapons.addtemp.weapon.substring6temp.weapon.length() - ) );
  }
  
  echo( 
this.name ": weapon list updated." );


Last edited by Codein; 12-03-2009 at 02:22 PM..
Reply With Quote