Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Any Brilliant Tallenter Scripters? (https://forums.graalonline.com/forums/showthread.php?t=134263817)

Gunderak 07-10-2011 10:36 AM

Any Brilliant Tallenter Scripters?
 
basically i have a gui with warn , jail and unjail and i want it to be activated when you double click a player and then the text fields filled with the players account if thats possible :3
here is the script
if anyone knows how to do it it would be MUCH appriciated :3

function onActionServerSide() {
if (params[0] == "jail") {
findplayerbycommunityname(params[1]).setlevel2("jail.nw", 31.5, 28.5);
}
if (params[0] == "unjail") {
findplayerbycommunityname(params[1]).setlevel2("ge_f2.nw", 0, 24);
}
if (params[0] == "warn") {
findplayerbycommunityname(params[1]).setlevel2("warning_room.nw", 37.5, 16.5);
}
}

//Scripted By Gunderak
//#CLIENTSIDE
function onKeyPressed(code, key, scancode) {
if (key == "3") {
new GuiWindowCtrl("MyGUI_Window1") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "161,87";

canmaximize = false;
canminimize = false;
canmove = true;
canresize = true;
closequery = false;
destroyonhide = true;
text = "Tools";
y = 96;

new GuiButtonCtrl("MyGUI_Button1") {
profile = GuiBlueButtonProfile;
text = "Jail";
width = 80;
}
new GuiButtonCtrl("MyGUI_Button2") {
profile = GuiBlueButtonProfile;
text = "Unjail";
width = 80;
y = 29;
}
new GuiButtonCtrl("MyGUI_Button3") {
profile = GuiBlueButtonProfile;
text = "Warn";
width = 80;
y = 58;
}
new GuiTextEditCtrl("MyGUI_TextEdit1") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 80;
y = 5;
}
new GuiTextEditCtrl("MyGUI_TextEdit2") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 80;
y = 34;
}
new GuiTextEditCtrl("MyGUI_TextEdit3") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 80;
x = 80;
y = 64;
}
}
}
}

function MyGUI_Button1.onAction() {
triggerserver("gui",this.name,"jail",MyGUI_TextEdi t1.text);
}

function MyGUI_Button2.onAction() {
triggerserver("gui",this.name,"unjail",MyGUI_TextE dit2.text);
}

function MyGUI_Button3.onAction() {
triggerserver("gui",this.name,"warn",MyGUI_TextEdi t3.text);
}

callimuc 07-10-2011 11:24 AM

1. You should generally style your weapons. Makes it easier to debug. Also use the php tags

2. How to do it:
You would have to check first if the player is clicking the other player twice.
The function would look like:
PHP Code:

//#CLIENTSIDE
function onMouseDown(mode) {
  if (
mode == "double") {
    
say2("I just clicked my mouse twice"); //let´s you  know that you have clicked twice
  
}
} 

Than you would need a check if the mouse in on a player:
PHP Code:

//#CLIENTSIDE
function onMouseDown(mode) {
  if (
mode == "double") {
    for (
pl: players) {
      if ( 
mousex in | pl.x + 0.5, pl.x + 2.5| && mousey in | pl.y, pl.y + 3|) { //we check if the mouse is on a player
        
pl.chat = "I just got clicked twice";  //the chat of the player you clicked twice
        
player.chat = "I just clicked twice"; //your chat that you clicked somebody twice
      
}
    }
  }
} 

Now to the GUI part.
PHP Code:

//#CLIENTSIDE
function onCreated() {
  new 
GuiTextCtrl("HereCouldBeYourName") { //next lines are just for the default GUI text
    
profile = GuiBlueTextProfile;
    
x = 10;
    
y = 10;
    
height = 20;
    
text = "Text";
  }
  
player.chat = "test";
}


function 
onMouseDown(mode) {
  if (
mode == "double") {
    for (
pl: players) {
      if ( 
mousex in | pl.x + 0.5, pl.x + 2.5| && mousey in | pl.y, pl.y + 3|) { //we check if the mouse is on a player
        
pl.chat = "I just got clicked twice";  //the chat of the player you clicked twice
        
player.chat = "I just clicked twice"; //your chat that you clicked somebody twice
        
if (pl != NULL) {
          
HereCouldBeYourName.text = pl.nick;
        }
        else 
HereCouldBeYourName.text = "No player found";
      }
    }
  }
} 

I hope this helped ;) If any questions just ask

Gunderak 07-10-2011 11:45 AM

sorry im a bit of a newb, im fairly new to scripting still :3 but how would i impliment all this into my script :/
would i put function on mouse double blah blah ithen make that open it?
what do i put in herecouldbeyourname because i want it to make the test in the text box who ever i click

Gunderak 07-10-2011 11:48 AM

the server its on is Dev MrMagoo if you wanna have a looksie :3

callimuc 07-10-2011 12:46 PM

Quote:

Originally Posted by Gunderak (Post 1658184)
sorry im a bit of a newb, im fairly new to scripting still :3 but how would i impliment all this into my script :/

Depends on how you want your script styled

Quote:

Originally Posted by Gunderak (Post 1658184)
would i put function on mouse double blah blah ithen make that open it?

Yes but you also need to add the GUI or replace it with a GUI you have in your weapon (didn´t take a look at it)

Quote:

Originally Posted by Gunderak (Post 1658184)
what do i put in herecouldbeyourname because i want it to make the test in the text box who ever i click

Just replace that text with a GUI name you want. Like Gunderak_Gui_text01 or whatever you want it to be called. But on your server you shouldn´t have GUI names twice (in all scripts not just that one) because if you name them the same you could have bugs if you have more GUI´s and so on

Quote:

Originally Posted by Gunderak (Post 1658186)
the server its on is Dev MrMagoo if you wanna have a looksie :3

Did once and logged off after 1 min


All times are GMT +2. The time now is 11:19 PM.

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