Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-10-2011, 10:36 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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);
}
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 07-10-2011, 11:24 AM
callimuc callimuc is offline
ジ
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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
__________________
MEEP!
Reply With Quote
  #3  
Old 07-10-2011, 11:45 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 07-10-2011, 11:48 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
the server its on is Dev MrMagoo if you wanna have a looksie :3
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 07-10-2011, 12:46 PM
callimuc callimuc is offline
ジ
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Gunderak View Post
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 View Post
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 View Post
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 View Post
the server its on is Dev MrMagoo if you wanna have a looksie :3
Did once and logged off after 1 min
__________________
MEEP!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:11 AM.


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