Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Zoom Script? (https://forums.graalonline.com/forums/showthread.php?t=134266498)

Fysez 05-22-2012 11:18 PM

Zoom Script?
 
I made a zoom script, And i know i'm not the only one who has.
But I did this, and it doesn't show up to others as enlarged?
I've tried different ways but the clientside makes it nearly impossible for me to work with.
PHP Code:

//#CLIENTSIDE
function onPlayerChats() {
if (
player.chat.starts("/zoom ")) {
player.zoom player.chat.substring(7).trim();
setzoomeffect this.zoom;
}



DustyPorViva 05-22-2012 11:54 PM

Well first you must know why it doesn't work. Players send certain variables to the server, and thus that data is then shared with other visible players. These variables include important data like player.x, player.y, player.attr[0-30], looks and so on and so forth. This data is needed for you to keep an accurate account of other players(knowing where they are, what they look like and so on). However besides those important variables, many are not sent. This includes things like player.zoom, client.vars, and such.

In order to share that data, you're going to have to force it to other players using one of the variables that ARE shared, and you will accomplish this using player.attr's.

PHP Code:

function onPlayerChats() {
  if (
player.chat.starts("/zoom ")) {
    
temp.newzoom player.chat.substring(7).trim();
    
// Be careful not to overwrite attr's already being used by other scripts
    
player.attr[5] = newzoom;
  }


Now what you'll also need to designate a special gani as an attr as well. This gani will contain SCRIPT portion that sets the player's zoom to attr[5]. Since the gani is also an attr, other players will load the script from the gani, which will load your attr[5], thus setting your zoom appropriately when they see you.

PHP Code:

function onPlayerChats() {
  if (
player.chat.starts("/zoom ")) {
    
temp.newzoom player.chat.substring(7).trim();
    
// Be careful not to overwrite attr's already being used by other scripts
    
player.attr[5] = newzoom;
    
player.attr[6] = "Fysez_playerzoom.gani";
  }


I have no gani to share though for this, so you'll have to do the research yourself. Eventually you can write up a small parsing script that lets you compress all of this data into one attr, to save data. You can also pass other things like player.alpha, player.stretch and so on.

Fysez 06-07-2012 09:29 PM

I don't know how to 'Script' Gani's. However,
I don't know why i didn't think of it, But I ended up working with triggers
to make the zoom work.
So here it is for anyone who wants to use it=P
PHP Code:

findplayer("Graal781471").addweapon(this.name);
function 
onActionServerSide() {
if (
params[0] == "zoom") {
setzoomeffect this.zoom;
} else if (
params[0] == "overzoom") {
player.chat "Zoom effect is too big! Big zoom = HUGE lag!";
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (
player.chat.starts("/zoom ")) {
if (
player.chat.substring(6)=<9) {
player.zoom player.chat.substring(7).trim();
triggerserver("gui",this.name,"zoom",0,player.account,0.5);
} else if (
player.chat.substring(6)=>9) {
triggerserver("gui",this.name,"overzoom",0,player.account,0.5);
}
}



Hezzy002 06-07-2012 09:38 PM

There's no way that script works at all, mate. There's a lot of issues with it and Dusty explained how to do it with one of the most reasonable techniques.

callimuc 06-07-2012 10:28 PM

Quote:

Originally Posted by Fysez (Post 1696690)
I don't know how to 'Script' Gani's. However,
I don't know why i didn't think of it, But I ended up working with triggers
to make the zoom work.
So here it is for anyone who wants to use it=P
PHP Code:

findplayer("Graal781471").addweapon(this.name);
function 
onActionServerSide() {
if (
params[0] == "zoom") {
setzoomeffect this.zoom;
} else if (
params[0] == "overzoom") {
player.chat "Zoom effect is too big! Big zoom = HUGE lag!";
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (
player.chat.starts("/zoom ")) {
if (
player.chat.substring(6)=<9) {
player.zoom player.chat.substring(7).trim();
triggerserver("gui",this.name,"zoom",0,player.account,0.5);
} else if (
player.chat.substring(6)=>9) {
triggerserver("gui",this.name,"overzoom",0,player.account,0.5);
}
}



Did you even check your RC after saying "/zoom #"?

Also I'd call it an 'overcomplicated clientside stealth script'


All times are GMT +2. The time now is 09:08 PM.

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