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, 04:34 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Once Again X_X Jail Script

I know the forum ruless, and yes i know im NOT meant to ask for help above my scripting level but i finally have this script working so you double click a player and it has "jail" "unjail" and "warn". could someone please add somehing so i can have time function so theres like a text bit with where you put the time :3?
thanks in advanced
-Gunderak

PHP Code:
function onActionServerSide() {
if (
params[0] == "jail") {
 
findplayerbycommunityname(params[1]).setlevel2("jail.nw", 31.5, 28.5).addweapon ("-Jail");;
}
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 onCreated() {
  new 
GuiTextCtrl("MyGUI_TextEdit1") { 
    
profile = GuiBlueTextProfile;
    
x = 81;
    
y = 5;
    
height = 20;
    
text = "";
  }
}
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|) { 
        if (
pl != NULL) {
           new 
GuiWindowCtrl("MyGUI_Window1") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "85,126";

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

    new 
GuiButtonCtrl("MyGUI_Button1") {
      
profile = GuiBlueButtonProfile;
      
text = "Jail";
      
width = 85;
    }
    new 
GuiButtonCtrl("MyGUI_Button2") {
      
profile = GuiBlueButtonProfile;
      
text = "UnJail";
      
width = 85;
      
y = 29;
    }
    new 
GuiButtonCtrl("MyGUI_Button3") {
      
profile = GuiBlueButtonProfile;
      
text = "Warn";
      
width = 85;
      
y = 58;
    }
    new 
GuiTextEditCtrl("MyGUI_TextEdit1") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 85;
      
x = 0;
      
y = 106;
      
MyGUI_TextEdit1.text = pl.account;
    }
      new 
GuiTextEditCtrl("MyGUI_TextEdit2") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 85;
      
x = 0;
      
y = 88;
      
MyGUI_TextEdit2.text = pl.nick;
    }
  }
}
}
function 
MyGUI_Button1.onAction() {
triggerserver("gui",this.name,"jail",MyGUI_TextEdit1.text);
player.addweapon(-Jailed);
}

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

function 
MyGUI_Button3.onAction() {
triggerserver("gui",this.name,"warn",MyGUI_TextEdit1.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, 04:48 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
When I was on your server before, you said you have been scripting for 5 years. Why do I now not believe you.
__________________
Reply With Quote
  #3  
Old 07-10-2011, 04:52 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
i never said i have been scripting for give years O_O lolwtf
i have been for like 2 months now
__________________

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, 05:07 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
Try creating another GuiTextEditCtrl and making that object the place you put the amount of jail time (seconds) into.
You could then use that time in your -Jail weapon, making it count down so when the timer reaches 0, the player would be released.
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #5  
Old 07-10-2011, 05:37 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
If you know you're not supposed to post for help on scripts above your scripting level, why are you doing it?

Go read the guides you've been linked to. Script begging is no way to make a server.
__________________
Reply With Quote
  #6  
Old 07-10-2011, 06:16 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Please, get a coder.
Reply With Quote
  #7  
Old 07-10-2011, 07:15 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You aren't even trying to understand or learn how to script, all your posts are the same dribble.

"Oh now I get it XD!! ... but how would I implemented X into the script. :3"

It's not cute, it's annoying and unfair to all the people who are actually trying to learn and want to succeed. I'm sorry but if this is your attitude towards scripting you're never going to learn and trying to help you (in hope of one day you'd be able to help yourself) will ultimately become a waste of time.

The scripts you're begging for aren't even beneficial to your server. Jail systems and the like shouldn't even be thought about when just starting development on a server.
__________________
Quote:
Reply With Quote
  #8  
Old 07-10-2011, 07:59 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
i finally have this script working so you double click a player and it has "jail" "unjail" and "warn"
Just wondering how you can have this script working.... after taking a close look. Since you where kind of begging for codes since 3 days now and "learning" from it you should have finally realized that you can´t add functions into functions... learn debugging that before "trying" to learn a jail script.

The only thing you did at that script so far was just the GUI.
__________________
MEEP!
Reply With Quote
  #9  
Old 07-10-2011, 09:32 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I will confirm that the script does work and I have patched it up for him, and I am working on the time stuff that he needs.
__________________
Reply With Quote
  #10  
Old 07-10-2011, 10:54 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
thought you cant do functions inside functions....
__________________
MEEP!
Reply With Quote
  #11  
Old 07-10-2011, 11:33 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by callimuc View Post
thought you cant do functions inside functions....
You can't, but GScript is forgiving so it's working either as a result of how it was implemented or the interpreter is guessing what it is supposed to do. Never put functions inside of functions (minus anonymous ones).
__________________
Reply With Quote
  #12  
Old 07-10-2011, 11:47 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
ah good than I thought kind of right :P
__________________
MEEP!
Reply With Quote
  #13  
Old 07-11-2011, 07:12 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
@fowlplay i am trying to learn, i learn by studing scripts and figuring out exactly how they work X_X
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #14  
Old 07-11-2011, 01:16 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Gunderak View Post
@fowlplay i am trying to learn, i learn by studing scripts and figuring out exactly how they work X_X
It would be much better to take time to learn the simple things first, before delving into more complex things like GP tools, which you don't really need anyway.

Once you get a grasp of the basic syntax, how variables and objects work, serverside/clientside differences and communication, not only would you be able to avoid such problems as you have, but you might then be able to think of ways to execute the purpose of the script better.

Scripting isn't really about piecing together functions for the sake of working.
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 06:43 PM.


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