Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   General Graal Discussion (https://www.graalians.com/forums/forumdisplay.php?f=2)
-   -   Script Help (https://www.graalians.com/forums/showthread.php?t=7064)

The Doctor 06-02-2012 12:26 AM

Script Help
 
I have a simple drag script and was wondering how to freeze the player being dragged through the air with freezeplayer2();. Any suggestions?

Twinny 06-02-2012 03:24 AM

You could do it in a few ways. Set a variable like client.isfrozen which can be read client side and checked in a time out. If true, freeze otherwise don't. This variable could be used in other scripts as well. You would have to make sure you unset the variable when player logins in case they disconnect whilst being dragged.

Another option is to trigger the player when they need to be frozen. This could be part of a weapon e.g. 'Movement' or 'System' or even in a class the player object has joined I.e. player.freezeplayer(int) which will trigger client side and then freeze the player. You would then have another option to unfreeze them. This way means no timeouts so less CPU time.

The Doctor 06-02-2012 03:31 AM

Thank you (+rep). Also, I've removed opening a player's profile so I can add some player options to them. I want a drop down GUI to pop up next to the player when I right click them. Is there an if() statement to detect if someone right clicked their mouse on the player?

Twinny 06-02-2012 03:47 AM

Nothing like that. Instead, you can use findnearestplayer(float x, float y) in a function onMouseDown e.g.

PHP Code:

Function onMouseDown(mode) {
  If (
mode == "left") {
    
Temp.pl findnearestplayer(mousexmousey);
     
Player.chat format("%s was clicked"temp.pl.communityname);
    }
  } 

You could also use findnearestplayers which returns an array of close players.

Note: there won't be a limit on range. If you only want players within 5 tiles, you will either need to test distance using the returned obj(s) or custom function e.g.

PHP Code:

For (temp.pl players) {
  If (
temp.pl.x in |mousex-2.5mousex+2.5|) {
    If (
temp.pl.y in |mousey-2.5mousey+2.5) {
      
//woo
    
}
  }


Depends how you want to go

The Doctor 06-02-2012 03:52 AM

That's all! Thank you.

The Doctor 06-05-2012 01:06 AM

New question. I have a small bar with NPCs in it. I only want staff to go through the npc door that warps you to the other level. So far, I have the tag Owner to be able to warp. It works, but I want it to work for all the staff specified in the server options. Here's what I have so far. I'm thinking it was an if() statement in there somewhere.

PHP Code:

if (player.guild == "Owner") {
//warp script here



Twinny 06-05-2012 01:13 AM

Quote:

Posted by Shawn (Post 133873)
New question. I have a small bar with NPCs in it. I only want staff to go through the npc door that warps you to the other level. So far, I have the tag Owner to be able to warp. It works, but I want it to work for all the staff specified in the server options. Here's what I have so far. I'm thinking it was an if() statement in there somewhere.

PHP Code:

if (player.guild == "Owner") {
//warp script here



I think you should be able to use serveroptions.staff serverside sooo

PHP Code:

if (player.guild in serveroptions.staff) {
  
doStuff();


That said, I'm not sure if it is serveroptions. or something. Test and see what you get.

The Doctor 06-05-2012 02:27 AM

You've been a great help :)
I'll test it right away

I tested it, didn't work. I think it's because instead of player.guild, it should be the player's community name/graal ID.

Tricxta 06-05-2012 02:44 AM

Quote:

Posted by Shawn (Post 133913)
You've been a great help :)
I'll test it right away

I tested it, didn't work. I think it's because instead of player.guild, it should be the player's community name/graal ID.

Nah, I understand where twinny is comming from. You're basically checking if the players guild is a staff guild defined in serveroptions, your alternate way also works(using player.account) and has a better chance of working since not everyone bothers defining staff guilds though. Gl with whatever abuse it is that you're creating.

The Doctor 06-05-2012 02:45 AM

It's a door? What abuse am I creating with a staff room?

Thanks anyway.

Tricxta 06-05-2012 02:46 AM

Quote:

Posted by Shawn (Post 133922)
It's a door? What abuse am I creating with a staff room?

Thanks anyway.

You'd be suprised what you can make a door do in graal.

The Doctor 06-05-2012 02:47 AM

"You must spread some reputation before giving it to Tricxta again"

Quote:

Posted by Tricxta (Post 133923)
You'd be suprised what you can make a door do in graal.

Ban players when they walk into it? Nah, haha.

Tricxta 06-05-2012 02:49 AM

Quote:

Posted by Shawn (Post 133924)
"You must spread some reputation before giving it to Tricxta again"



Ban players when they walk into it? Nah, haha.

I was actually thinking of a door that attacks people if they're not staff and try use it. Your idea works to :smile:

The Doctor 06-05-2012 02:51 AM

PHP Code:

function onPlayerTouchsMe(){
if (
player.guild in serveroptions.staff) {
setlevel2("futustia-bar.nw"10.544.5);
player.dir 2;
}
else {
player.chat "I need an admin tag!";
}


Here's my ifelse so far. What did I do wrong? I was wearing my owner tag specified in the server options.

BboyEatsbacon 06-05-2012 03:07 AM

Quote:

Posted by Shawn (Post 133928)
PHP Code:

function onPlayerTouchsMe(){
if (
player.guild in serveroptions.staff) {
setlevel2("futustia-bar.nw"10.544.5);
player.dir 2;
}
else {
player.chat "I need an admin tag!";
}


Here's my ifelse so far. What did I do wrong? I was wearing my owner tag specified in the server options.

Should be
PHP Code:

function onPlayerTouchsMe(){
  if (
player.guild in serveroptions.staffguilds) {
    
setlevel2("futustia-bar.nw"10.544.5);
    
player.dir 2;
  }
  else {
    
player.chat "I need an admin tag!";
  }


PHP Code:

serveroptions.staff 

is a string that all of the server staff are stored in.

PHP Code:

serveroptions.staffguilds 

is a string that all of the server staff guilds are stored in.


All times are GMT. The time now is 11:29 AM.

Powered by vBulletin/Copyright ©2000 - 2025, vBulletin Solutions Inc.