Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Youtube GuiFlash Player (https://forums.graalonline.com/forums/showthread.php?t=134262464)

devilsknite1 03-19-2011 05:43 AM

Youtube GuiFlash Player
 
3 Attachment(s)
Pretty straight forward. I used born2kill's flash player as a base; it can be found at http://forums.graalonline.com/forums...hp?t=134260372. Kind of glitchy as of right now, I'll fix it up when I have time. The only known glitch so far is the fact that you sometimes need to try twice to get the video to load, or just wait an extremely long time upon the first attempt if nothing pops up instantly. Dunno, just thought it would be kind of fun to mess around with it since I didn't see it anywhere else on the forums. If any other in-game GUIs are over it, it will not display the youtube player. It also downloads files for the autoplay feature, but that can be removed as it isn't really that necessary. Sadly there are only chat commands to destroy GUIs in case of freezing or to just get rid of the video. Haven't bothered adding any conveniences to it yet.

Video tag I used to test:
Op7yi9wzR5I (it's not a rick roll............. -_- see screen shots for what the video actually is, if you're that concerned)

PHP Code:

function onActionServerSideafiaccsvar ) {
  switch( 
afi ) {
    case 
"others": {
      
temp.findPlayerByCommunityNameacc ); // Receiving account
      
temp.svar// Youtube tag
      
if ( player.account == temp.) {
        
player.chat "Well, that just doesn't make any sense, does it?";
      }
      if ( 
temp.!= NULL ) {
        
temp.r.triggerClient"gui"name"acceptance"player.accounttemp.);
      } else {
        
triggerClient"gui"name"negative"temp.);
      }
      break;
    }
  }
}

//#CLIENTSIDE

function onActionClientSideafisvarsvar2 ) {
  switch( 
afi ) {
    case 
"acceptance": {
      
player.chat svar SPC "has requested that you watch a video!";
      
onAcceptanceGUIsvarsvar2 );
      break;
    }
    case 
"negative": {
      
player.chat "The player you have requested (" svar ") was not found!";
      break;
    }
  }
}

function 
onWeaponFired() {
  
say2"/youtube <- Opens options" NL
  
"/options <- In case the window" NL
  
"freezes, this will remove it" NL
  
"/video <- removes the video from" NL
  
"your screen" NL
  
"/acceptance <- In case the window" NL
  
"freezes, this will remove it" );
}

function 
onPlayerChats() {
  if ( 
player.chat == "/youtube" ) {
    
onOpenOptionsGUI();
    
player.chat "Youtube options opened!";
  }
  if ( 
player.chat == "/options" && Options_Window1.visible ) {
    
Options_Window1.destroy();
  }
  if ( 
player.chat == "/video" && Youtube_Video.visible ) {
    
Youtube_Video.destroy();
  }
  if ( 
player.chat == "/acceptance" && Acceptance_Window1.visible ) {
    
Acceptance_Window1.destroy();
  }
}

function 
onOpenOptionsGUI() {
  new 
GuiWindowCtrl"Options_Window1" ) {
    
profile GuiBlueWindowProfile;
    
clientRelative true;
    
clientExtent "265,185";
    
canClose true;
    
canMaximize false;
    
canMove true;
    
canResize false;
    
closeQuery false;
    
destroyOnHide true;
    
text "Youtube Options Window";
    
screenwidth - ( width );
    
screenheight - ( height );

    new 
GuiScrollCtrl"Options_MultiLine1_Scroll" ) {
      
profile GuiBlueScrollProfile;
      
height 185;
      
hScrollBar "dynamic";
      
vScrollBar "dynamic";
      
width 143;

      new 
GuiMLTextCtrl"Options_MultiLine1" ) {
        
profile GuiBlueMLTextProfile;
        
height 192;
        
horizSizing "width";
        
htmlCompatibility true;
        
text "<center><b>Instructions</b><br><br>Enter the \"tag\" (fo0baR3a1 and nothing else) into the provided area. If you'd like to send this video to another player, click \"yes\" and type the community name of the player in the space provided.";
        
width 118;
      }
    }
    
    new 
GuiTextEditCtrl"Options_TextEdit1" ) {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 114;
      
146;
      
19;
    }
    
    new 
GuiTextCtrl"Options_Text1" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Youtube Tag";
      
width 70;
      
165;
    }
    
    new 
GuiTextCtrl"Options_Text2" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Send to another player?";
      
width 116;
      
147;
      
56;
    }
    
    new 
GuiTextEditCtrl"Options_TextEdit2" ) {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 114;
      
146;
      
116;
    }
    
    new 
GuiCheckBoxCtrl"Options_CheckBox1" ) {
      
profile GuiBlueCheckBoxProfile;
      
height 20;
      
text "Yes";
      
width 36;
      
147;
      
77;
      
thiso.catchEventthis"onMouseUp""onCheckYes" );
    }
    
    new 
GuiCheckBoxCtrl"Options_CheckBox2" ) {
      
profile GuiBlueCheckBoxProfile;
      
height 20;
      
text "No";
      
width 30;
      
215;
      
77;
      
thiso.catchEventthis"onMouseUp""onCheckNo" );
    }
    
    new 
GuiTextCtrl"Options_Text3" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Account name:";
      
width 73;
      
163;
      
97;
    }
    
    new 
GuiButtonCtrl"Options_Button1" ) {
      
profile GuiBlueButtonProfile;
      
height 24;
      
text "Go!";
      
width 80;
      
159;
      
136;
    }
    
    new 
GuiButtonCtrl"Options_Button2" ) {
      
profile GuiBlueButtonProfile;
      
height 24;
      
text "Cancel";
      
width 80;
      
159;
      
161;
    }
  }
  
Options_CheckBox2.checked true;
  
Options_TextEdit2.active false;
}

function 
Options_Button1.onAction() {
  if ( 
Options_CheckBox2.checked == true ) {
    
onOpenFlashGUIOptions_TextEdit1.text );
    
sleep);
    
Options_Window1.destroy();
  }
  if ( 
Options_CheckBox2.checked == false ) {
    if ( 
Options_TextEdit2.text != "" ) {
      if ( 
Options_TextEdit2.text != "Please enter an account name!" ) {
        
triggerServer"gui"name"others"Options_TextEdit2.textOptions_TextEdit1.text );
        
onOpenFlashGUIOptions_TextEdit1.text );
        
sleep);
        
Options_Window1.destroy();
      }
    } else {
      
Options_TextEdit2.text "Please enter an account name!";
    }
  }
}

function 
Options_Button2.onAction() {
  
Options_Window1.destroy();
}

function 
onCheckYes() {
  
Options_CheckBox1.checked true;
  
Options_TextEdit2.active true;
  
Options_CheckBox2.checked false;
}

function 
onCheckNo() {
  
Options_CheckBox2.checked true;
  
Options_TextEdit2.active false;
  
Options_CheckBox1.checked false;
}

function 
onAcceptanceGUIsvarsvar2 ) {
  new 
GuiWindowCtrl"Acceptance_Window1" ) {
    
profile GuiBlueWindowProfile;
    
clientRelative true;
    
clientExtent "320,59";
    
canClose true;
    
canMaximize false;
    
canMove true;
    
canResize false;
    
closeQuery false;
    
destroyOnHide true;
    
text "Video Request!";
    
screenwidth - ( width );
    
screenheight - ( height );

    new 
GuiTextCtrl"Acceptance_Text1" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text svar SPC "would like you to watch a video";
      
width 234;
      
14;
      
4;
    }
    
    new 
GuiTextCtrl"Acceptance_Text2" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text svar2;
      
width 100;
      
220;
      
4;
    }
    
    new 
GuiButtonCtrl"Acceptance_Button1" ) {
      
profile GuiBlueButtonProfile;
      
text "Accept";
      
width 80;
      
14;
      
29;
    }
    
    new 
GuiButtonCtrl"Acceptance_Button2" ) {
      
profile GuiBlueButtonProfile;
      
text "Decline";
      
width 80;
      
226;
      
29;
    }
  }
}

function 
Acceptance_Button1.onAction() {
  
player.chat Acceptance_Text2.text;
  
onOpenFlashGUIAcceptance_Text2.text );
  
sleep);
  
Acceptance_Window1.destroy();
}

function 
Acceptance_Button2.onAction() {
  
Acceptance_Window1.destroy();
}

function 
onOpenFlashGUIsvar ) {
  new 
GuiFlash"Youtube_Video" ) {
    
width 768;
    
height 432;
    
screenwidth - ( width );
    
screenheight - ( height );
    
requiresActiveX false;
    
requiresPlugin false;
    
tryActiveX true;
    
tryPlugin true;
    
loopMovie false;
    
downloadWebFiles true;
    
movieName "http://www.youtube.com/v/" svar "&autoplay=1";
  }
  
  new 
GuiFlash"Youtube_Loader" ) {
    
Youtube_Video.x;
    
Youtube_Movie.y;
    
width Youtube_Movie.width;
    
height Youtube_Movie.height;
    
requiresActiveX false;
    
requiresPlugin false;
    
tryActiveX true;
    
tryPlugin true;
    
loopMovie false;
    
downloadWebFiles true;
    
moviename "";
  }
  
sleep);
  
Youtube_Loader.destroy();


Added default closing of GUIs along with the cancel button.
Removed the players account from triggers.

nullify 03-19-2011 06:21 AM

Never gonna give you up...

cbk1994 03-19-2011 06:36 AM

There is no absolutely no reason to send your own account along with a trigger. All it does it open up the possibility for a memory editor to change their own account on clientside, which would allow you to send requests that look like they're from a different user.

Also, why not use GuiRadioCtrl instead of makeshift radio buttons using check boxes?

You should also enable closing the window. It's confusing from a UI perspective when you have to click a "Cancel" button instead of clicking the normal "x".

Nice work though, it's quite interesting.

devilsknite1 03-20-2011 02:08 AM

Quote:

Originally Posted by cbk1994 (Post 1637251)
There is no absolutely no reason to send your own account along with a trigger. All it does it open up the possibility for a memory editor to change their own account on clientside, which would allow you to send requests that look like they're from a different user.

Also, why not use GuiRadioCtrl instead of makeshift radio buttons using check boxes?

You should also enable closing the window. It's confusing from a UI perspective when you have to click a "Cancel" button instead of clicking the normal "x".

Nice work though, it's quite interesting.

- This is true, but for some reason it really didn't like it when I didn't send the players account along with the trigger; it was mainly for debugging purposes. Removed.

- Eh, I just like the boxes versus the circles. Not really affecting anything from a functionality standpoint, so not going to really bother with that one, but will keep it in mind for other GUIs.

- Agreed. Changed.


All times are GMT +2. The time now is 09:13 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.