|
06-03-2012
|
1
|
|
Nerd
Join Date: Sep 2011
Location: Berlin
Posts: 3,825
|
Script: Hat Viewer
This is just a result of my boredom. I'm finding that I'm quite good at channelling my boredom into doing something constructive. Basically, this shows all of the hats in levels/hats (you can change it, don't worry) and shows them as thumbnails. You can click on these thumbnails to set it as your hat and you can right click them to show the whole hat image.
PHP Code:
function onActionServerside() { switch(params[0]) { case "gethats": { temp.hatfolder.loadfolder("levels/hats/*", true); waitfor(temp.hatfolder.loadfolder, "", 5); for (hats : temp.hatfolder.tokenize(",")) { triggerclient("gui", name, "gethats", hats); } break; } } }
//#CLIENTSIDE
function onCreated() { drawGUI(); }
function drawGUI() { HatViewerWindow.destroy(); new GuiWindowCtrl("HatViewerMain") { profile = GuiBlueWindowProfile; clientrelative = true; width = 500; height = 300; clientextent = {width, height}; x = screenwidth / 2 - width / 2; y = 15; canresize = canmaximize = false; text = "Emera's Sexy Hat Viewer [2.0.1]"; new GuiScrollCtrl("HatViewerWindow") { profile = GuiBlueScrollProfile; width = 500; height = 270; x = 0; y = 0; hscrollbar = "alwaysOn"; vscrollbar = "alwaysOff"; visible = true; } new GuiButtonCtrl("HatViewerButton") { profile = GuiBlueButtonProfile; width = HatViewerWindow.width - 50; height = 30; x = 0; y = HatViewerWindow.y + HatViewerWindow.height; text = "Refresh"; visible = true; } new GuiButtonCtrl("HatViewerButton2") { profile = GuiBlueButtonProfile; width = 50; height = 30; x = HatViewerButton.width; y = HatViewerWindow.y + HatViewerWindow.height; text = "Ext"; visible = true; } } new GuiWindowCtrl("HatViewerPreviewMain") { profile = GuiBlueWindowProfile; clientrelative = true; width = 192; height = 144; clientextent = {width, height}; x = screenwidth / 2 - width / 2; y = screenheight / 2 - height / 2; text = "Preview window"; canresize = canminimize = canmaximize = visible = false; new GuiShowImgCtrl("HatViewerPreviewImage") { width = 192; height = 144; x = 0; y = 0; } } GetHats(); }
function getHats() { this.col = -1; HatViewerWindow.active = false; triggerserver("gui", name, "gethats"); }
function clearHats() { for (c : HatViewerWindow.controls) { c.destroy(); } this.col = this.row = 0; gethats(); }
function onActionClientside() { switch(params[0]) { case "gethats": { this.hatindex++; temp.hat = params[1]; if (this.col >= 4) { this.col = 0; this.row++; } else { this.col++; } with(HatViewerWindow) { new GuiShowImgCtrl("HatViewer_Hat_"@thiso.hatindex) { useownprofile = true; image = temp.hat; width = height = 48; x = 5 + (48 * thiso.row); y = 5 + (48 * thiso.col); partx = 96; party = 0; partw = 48; parth = 48; hint = "<b>"@this.image@"</b>"; thiso.catchevent(this, "onMouseDown", "onSetHatDown"); thiso.catchevent(this, "onRightMouseDown", "onPreview"); } active = true; } break; } } }
function onSetHatDown(obj) { player.attr[1] = obj.image; }
function onPreview(obj) { with(HatViewerPreviewMain) { isexternal = HatViewerMain.isexternal; text = obj.image; visible = true; bringtofront(); } HatViewerPreviewImage.image = obj.image; } function onKeyPressed(code) { if (code == 32) { HatViewerMain.visible = !HatViewerMain.visible; } }
function HatViewerButton.onMouseDown() { clearHats(); }
function HatViewerButton2.onAction() { HatViewerMain.isexternal = !HatViewerMain.isexternal; }
Enjoy.
Last edited by Emera; 06-04-2012 at 11:25 AM.
|
|
|
|