![]() |
Global Trigger Weapons
Why?
I admit, it's rather simple but if you ever run into needing something like this then atleast you won't have to reinvent the wheel :P Serverside Global Weapon Trigger Methods: void GlobalEvents.triggerAll( string eventName, array parameters[] );This triggers an event on every weapon serverside. GlobalEvents should be replaced by your NPC name. PHP Code:
Same syntax as serverside. This is actually rather simple but it's one less tediuous task for yourself :) PHP Code:
Thanks for reading! :) |
Hey, works. Rep for you.
|
Would be nice if there was some way to detect files outside of levels/ being updated, as it could then auto update list. So, only suggestion I got atm is some way to update the list, ie. RC Command, a timer (deprecated though, first thing I said would be much better, but I guess we have to wait?)
edit; http://forums.graalonline.com/forums...62#post1541962 |
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:
PHP Code:
|
The NPCServer also need R(ead) rights to the weapons/ folder for this to work ;)
|
As a note, you can use the "removeescapesfromfilename" function to removing the escaping used in filenames (rather than the charMap you have).
removeescapesfromfilename(str) - returns string echo(removeescapesfromfilename("weapon%045Test.txt ")); outputs: weapon-Test.txt |
Quote:
Quote:
|
Quote:
|
Well, I guess it kinda makes sense since loadFolder() really isn't doing much but getting a list of file names.
|
Quote:
Updated the latest post. |
Quote:
|
Quote:
|
Why are you doing this?
PHP Code:
PHP Code:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
Start = 6, so ommitting the 'weapon' prefix. End = length - 4; omitting the '.txt' suffix. |
Quote:
|
Quote:
"testingfoobarbaz".substring(3, 5) It starts at 3, so it excludes the red testingfoobarbaz Then it will extract the text between starting index 3 and the length from this index. testingfoobarbaz The text inbetween the colored text is what you end up with |
Quote:
PHP Code:
|
| All times are GMT +2. The time now is 05:55 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.