Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Once Again X_X Jail Script (https://forums.graalonline.com/forums/showthread.php?t=134263822)

Gunderak 07-10-2011 04:34 PM

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);
}
        }
      }
    } 


Emera 07-10-2011 04:48 PM

When I was on your server before, you said you have been scripting for 5 years. Why do I now not believe you.

Gunderak 07-10-2011 04:52 PM

i never said i have been scripting for give years O_O lolwtf
i have been for like 2 months now

iBeatz 07-10-2011 05:07 PM

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.

cbk1994 07-10-2011 05:37 PM

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.

Crow 07-10-2011 06:16 PM

Please, get a coder.

fowlplay4 07-10-2011 07:15 PM

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.

callimuc 07-10-2011 07:59 PM

Quote:

Originally Posted by Gunderak (Post 1658218)
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.

Emera 07-10-2011 09:32 PM

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.

callimuc 07-10-2011 10:54 PM

:oo: thought you cant do functions inside functions....

cbk1994 07-10-2011 11:33 PM

Quote:

Originally Posted by callimuc (Post 1658282)
:oo: 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).

callimuc 07-10-2011 11:47 PM

ah good than I thought kind of right :P

Gunderak 07-11-2011 07:12 AM

@fowlplay i am trying to learn, i learn by studing scripts and figuring out exactly how they work X_X

ffcmike 07-11-2011 01:16 PM

Quote:

Originally Posted by Gunderak (Post 1658327)
@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.


All times are GMT +2. The time now is 10:57 AM.

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