Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Setting Client Flags (https://forums.graalonline.com/forums/showthread.php?t=134264446)

Emera 09-02-2011 01:40 PM

Setting Client Flags
 
I am currently constructing a simple class selection system, and I am going to store the class information using the players flags. I want to be able to select a row from a text list and apply the class to the player by pressing a GUI button. I am having some difficulties. It won't set the flag. Can anybody help out?

PHP Code:

function Class_Button1.onAction() {
  
client.class = Class_TextList1.selectedrow;


Thank you for your help.
If there is any other way to store information for a player other than client flags, please let me know. I have heard of clientr flags and was wondering what they were. I did some research and I see they can only be read clientside and applied to the player serverside. I am using client flags for the time being though.

I have a suspicion that the problem occurring lies here.
PHP Code:

Class_TextList1.selectedrow


Mark Sir Link 09-02-2011 01:42 PM

selected.text

Emera 09-02-2011 01:43 PM

Quote:

Originally Posted by Mark Sir Link (Post 1666688)
selected.text

I can always rely on you to solve my very simple scripting issues. Thank you!
Now I have that sorted, should I really be using clientr.class so dirty hackros can't modify the class using CheatEngine or whatever they are using?

Mark Sir Link 09-02-2011 02:17 PM

Quote:

Originally Posted by Emera (Post 1666689)
I can always rely on you to solve my very simple scripting issues. Thank you!
Now I have that sorted, should I really be using clientr.class so dirty hackros can't modify the class using CheatEngine or whatever they are using?

You'd have to trigger the server on class selection to use a clientr var then, and you'd probably want to evaluate that a class isn't already selected as well since it appears that it is possible for hackers to triggerserver whatever they want.

Emera 09-02-2011 02:51 PM

Quote:

Originally Posted by Mark Sir Link (Post 1666690)
You'd have to trigger the server on class selection to use a clientr var then, and you'd probably want to evaluate that a class isn't already selected as well since it appears that it is possible for hackers to triggerserver whatever they want.

I didn't know they could do that. I might have to think about a way around hackros being able to accomplish that.

Mark Sir Link 09-02-2011 03:12 PM

Quote:

Originally Posted by Emera (Post 1666694)
I didn't know they could do that. I might have to think about a way around hackros being able to accomplish that.

doing something like if(clientr.class == null) {clientr.class = class;} would be sufficient to make sure they couldn't force that trigger to allow for class changing.

with how things are currently going, anything that is sensitive needs to be stored into a clientr or other sort of server side storage, with additional verifications used to insure the triggerserver is coming from where you expect or not interfering with existing data

SoundFreak 09-02-2011 04:31 PM

Quote:

Originally Posted by Mark Sir Link (Post 1666695)
doing something like if(clientr.class == null) {clientr.class = class;} would be sufficient to make sure they couldn't force that trigger to allow for class changing.

with how things are currently going, anything that is sensitive needs to be stored into a clientr or other sort of server side storage, with additional verifications used to insure the triggerserver is coming from where you expect or not interfering with existing data

See where you are coming from. I don't know why the Graal Online team can't add a better anti-hack mechanism to Graal. The current one is ridiculous and isn't worth being called a defense mechanism. We have to script it ourselves.

Crow 09-02-2011 04:37 PM

Quote:

Originally Posted by SoundFreak (Post 1666730)
See where you are coming from. I don't know why the Graal Online team can't add a better anti-hack mechanism to Graal. The current one is ridiculous and isn't worth being called a defense mechanism. We have to script it ourselves.

Gotta admit, it'd be nice to have some mechanics built into the client.

Emera 09-02-2011 04:38 PM

I agree. It would be better if it had more of a defense mechanism to hacking programs and such other than what we can do with GS2.

ff7chocoboknight 09-02-2011 04:50 PM

Thor has Classic pretty well protected with his shotgun and baseball bat.

Emera 09-02-2011 05:17 PM

Quote:

Originally Posted by ff7chocoboknight (Post 1666740)
Thor has Classic pretty well protected with his shotgun and baseball bat.

Yes I have heard he has a very good protection system in place, that logs and protects against just about everything. But, not all of us are as talented in GS2 as Thor, so we need a solution that doesn't involve learning GS2 to that high of a standard, but I encourage everybody to try and learn it anyway :D

Anyway. Something not related to client flags, but related to the same system I was describing in my first post. I was wondering how to change the height of a row in a GuiTextList Control. I have seen it done many times, for instance, in Kavan's staff panel, he has list of all the online players, weapons and levels. They are three times the height of a normal row. I tried using profile.fontsize = 10 but it seems the text dissapears anything after 8. Should I be using useownprofile = true?

fowlplay4 09-02-2011 05:19 PM

The coolest hack I've seen yet is the one that injects scripts. It's kind of hard to bring the client Anti-Hack up to date though when we're still stuck on V5.

This "insecure" code:

PHP Code:

function onActionServerSide() {
  if (
params[0] == "levelup") {
    
clientr.level++;
  }
  else if (
params[0] == "setclass") {
    
clientr.class = params[1];
  }


To "secure" it you should be adding exp on the server-side, checking the exp against their exp needed, and leveling up there instead of relying on a client-side system and sending a trigger to increase the level.

You would also make sure the class they pick is in the list of valid classes, and that they don't already have a class.

Server-side verification is a must wherever (I.e: Web Apps) you go though, clients are inheritly insecure.

Honestly though the hacking problem on Graal isn't that bad. The recurring wall-walking and freeze hacks are easily detected.

Emera 09-02-2011 05:21 PM

FowlPlay4 is this the kind of protection you put in place when you scripted your EXP system for Zodiac, or added to it since then? It would be nice anyway if somebody could add some more advanced protection to the client system.

Mark Sir Link 09-02-2011 05:31 PM

Quote:

Originally Posted by Emera (Post 1666749)
Yes I have heard he has a very good protection system in place, that logs and protects against just about everything. But, not all of us are as talented in GS2 as Thor, so we need a solution that doesn't involve learning GS2 to that high of a standard, but I encourage everybody to try and learn it anyway :D

Anyway. Something not related to client flags, but related to the same system I was describing in my first post. I was wondering how to change the height of a row in a GuiTextList Control. I have seen it done many times, for instance, in Kavan's staff panel, he has list of all the online players, weapons and levels. They are three times the height of a normal row. I tried using profile.fontsize = 10 but it seems the text dissapears anything after 8. Should I be using useownprofile = true?

I can't speak to the size of the text since I haven't actually seen it but you could set an icon size to force a certain height if setting height itself does nothing.

seticonsize(1,32);

Emera 09-02-2011 05:35 PM

Quote:

Originally Posted by Mark Sir Link (Post 1666757)
I can't speak to the size of the text since I haven't actually seen it but you could set an icon size to force a certain height if setting height itself does nothing.

seticonsize(1,32);

Yes this seemed to work. Thank you ever so much.
PHP Code:

new GuiTextListCtrl("Class_TextList1") {
  
profile GuiTextListProfile;
  
height 34;
  
horizsizing "width";
  
sortcolumn 134406400;
  
sortmode "value";
  
width 312;
  
updateclasseslist();
  
profile.fonttype "Tempsitc";
  
profile.fontsize 15;
  
seticonsize(132);


I think my problem was that the height of the text was greater than the height of the row, so it made it seem invisible. Thank you.

fowlplay4 09-02-2011 05:37 PM

Quote:

Originally Posted by Emera (Post 1666753)
FowlPlay4 is this the kind of protection you put in place when you scripted your EXP system for Zodiac, or added to it since then? It would be nice anyway if somebody could add some more advanced protection to the client system.

It's not something I did for "protection" it's just the proper way to do an EXP system.

Baddies are killed on the server-side, so it makes no sense to send a trigger to the client to add exp, check, and then tell the server that it's time for them to level up.

Emera 09-02-2011 07:54 PM

OK, another minor thing I need assistance with. I want to change the Multi Line text whenever I select a row and display text according to the class (row) selected. So, for instance...
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.archerdesc "Description for archer";
  if (
Class_TextList1.selectedrowid == 1) {
    
Class_MultiLine1.text this.archerdesc;
  }


But obviously there is no such thing as...
PHP Code:

if (Class_TextList1.selectedrowid == 1) { 

So how would I detect if a certain row is selected (ID, Text) and display the appropriate text?
Many thanks if you help.

Mark Sir Link 09-02-2011 10:29 PM

when you create the textlist, you should add some variable to each object as you add the rows like

PHP Code:

new GuiTextListCtrl("List"){
  
with(addrow(0"Archer")){
    
desc "Description for archer";
  }
  
with(addrow(1"Class2")){
    
desc "blah";
  }

  
thiso.catchevent(name"onSelect""onClassSelect");
}

function 
onClassSelect(temp.rows){
  
Class_MultiLine1.text rows.selected.desc;



Emera 09-03-2011 11:23 AM

I think it would be better if I post the script I currently have and work around that.
PHP Code:

function onActionServerSide() {
  if (
params[0] == "addclass") {
    
clientr.class = params[1]; //Adds the player flag
  
}
}

//#CLIENTSIDE
function onCreated() {
  if (
clientr.class == NULL) { //To prevent multi-class choosing
    
new GuiWindowCtrl("Class_Window1") {
      
profile GuiBlueWindowProfile;
      
clientrelative true;
      
clientextent "320,240";
      
canclose false;
      
canmaximize false;
      
canminimize false;
      
canmove true;
      
canresize false;
      
closequery false;
      
destroyonhide true;
      
text "Choose your class!";
      
517;
      
203;
      
profile.fontstyle "b";

      new 
GuiScrollCtrl("Class_MultiLine1_Scroll") {
        
profile GuiBlueScrollProfile;
        
height 60;
        
hscrollbar "dynamic";
        
vscrollbar "dynamic";
        
visible true;
        
width 316;
        
hscrollbar "alwaysOff";
        
2;
        
2;

        new 
GuiMLTextCtrl("Class_MultiLine1") {
          
profile GuiBlueMLTextProfile;
          
height 51;
          
horizsizing "width";
          
plaintext "<center> Please choose the class below you wish to take on an epic journey and become the greatest warrior in the game! Choose wisely! You can't change it!";
          
text "<center> Please choose the class below you wish to take on an epic journey and become the greatest warrior in the game! Choose wisely! You can\'t change it!";
          
width 291;
        }
      }
      new 
GuiScrollCtrl("Class_TextList1_Scroll") {
        
profile GuiBlueScrollProfile;
        
height 138;
        
hscrollbar "alwaysOff";
        
vscrollbar "dynamic";
        
width 316;
        
2;
        
65;
        
visible true;

        new 
GuiTextListCtrl("Class_TextList1") {
          
profile GuiBlueTextListProfile;
          
height 34;
          
horizsizing "width";
          
sortcolumn 134406400;
          
sortmode "value";
          
width 312;
          
updateclasseslist();
          
profile.fontsize 15;
          
seticonsize(123);
          
profile.fontstyle "b";
          
profile.textshadow true;
        }
      }
      new 
GuiButtonCtrl("Class_Button1") {
        
profile GuiBlueButtonProfile;
        
text "Choose";
        
width 314;
        
3;
        
206;
      }
    }
  }
}

function 
Class_Button1.onAction() {
  
triggerserver("gui"this.name"addclass"Class_TextList1.selected.text);
  
Class_Window1.destroy();
}

function 
UpdateClassesList() {
  
clearrows();
  
addrow(0"Archer");
  
addrow(1"Wizard");
  
addrow(2"Knight");
  
addrow(3"Alchemist");
  
addrow(4"Dark Mage");
  
addrow(5"Light Mage");
  
addrow(6"Elf");
  
addrow(7"Necroshade");
  
addrow(8"Paladin");
  
addrow(9"Troll");
  
addrow(10"Human");
  if (
clientr.isStaff) { //Special classes.
    
addrow(11"God");
    
addrow(12"Destroyer");
    
addrow(13"Summoner");
  }


As you can see I am using a function to add the rows to the TextList Control. I was wondering how I could include the usage of variables in the function called UpdateClassList();

I was actually hoping to achieve something like this...
PHP Code:

// Snippet taken from crow's "Very awesome staff panel"
this.classStats = { 
    { 
"Class1""Desc1" }, 
    { 
"Class2""Desc2" 
  }; 


(This snippet was taken from Crows "Very awesome staff panel")
and then I could change the description and name of the classes easily at the top of the script. Can this be done?

cbk1994 09-03-2011 10:08 PM

Do some serverside verification.

PHP Code:

function onActionServerSide() {
  if (
params[0] == "addclass") {
    if (
clientr.class != null) {
      return 
player.chat "You already have a class!";
    }
    
    
temp.validClasses = {"Archer""Wizard""Knight""etc"};
   
    if (! (
params[1in temp.validClasses)) {
      return 
player.chat "That's not a valid class!";
    }
    
    
clientr.class = params[1]; //Adds the player flag
  
}



Mark Sir Link 09-04-2011 01:02 AM

Quote:

Originally Posted by Emera (Post 1666846)
As you can see I am using a function to add the rows to the TextList Control. I was wondering how I could include the usage of variables in the function called UpdateClassList();


using addrow returns the row object upon creation, however, I imagine this doesn't even work since you aren't referencing an object to add the rows to.

In the function, you either need to encompass all the addrows within a with statement:
PHP Code:

with(NameOfTextListObjectHere){



or prefix every instance of addrow with the name of the object.

The first is probably easier.

In terms of adding a variable to the row object, addrow returns the row object upon being invoked. If you only want to add one variable to the row, calling

PHP Code:

addrow(id"Archer").classStats = {"your""data""here"}; 

is perfectly fine.

Otherwise, encompass the addrow within a with statement.

PHP Code:

with(addrow(id"Archer")){
  
classStats1 "your";
  
classStats2 "data";
  
classStats3 "here";



SoundFreak 09-04-2011 05:41 PM

Not being funny or anything here Aaron, but wouldn't it be easier to do something like this. I haven't thought hard enough about how you could incorporate this into your code, but it would be worth looking up.
PHP Code:

this.classes = {
{
"Archer""This is a description.""This is the icon.png"},
{
"Wizard""This is the description.""This is the icon.png"},
//etc
}; 

Then, players could easily add new rows, change rows descriptions and also add an icon to the side of the row, just to add that little detail. Would be a nice addition. Using...
PHP Code:

{"Class""Description""Icon"}; 

Would really tidy things up a bit.
PHP Code:

with(addrow(id"Archer")){
  
classStats1 "your";
  
classStats2 "data";
  
classStats3 "here";


Agree with this also, but I do actually prefer the idea above, but I don't even know yet if this can be incorporated into the system.
Also, you should be adding security on the serverside like CBK and 0pix0 said. Them dirty "hackros" can change whatever they want as long as it remains clientside. I am giving you a "green pepper" anyway. (For those of you who don't know, Aaron likes to say red pepper and green pepper rather than red rep or green rep. I really don't know were this originated from)

Emera 09-04-2011 05:54 PM

Quote:

Originally Posted by SoundFreak (Post 1666996)
Not being funny or anything here Aaron, but wouldn't it be easier to do something like this. I haven't thought hard enough about how you could incorporate this into your code, but it would be worth looking up.
PHP Code:

this.classes = {
{
"Archer""This is a description.""This is the icon.png"},
{
"Wizard""This is the description.""This is the icon.png"},
//etc
}; 

Then, players could easily add new rows, change rows descriptions and also add an icon to the side of the row, just to add that little detail. Would be a nice addition. Using...
PHP Code:

{"Class""Description""Icon"}; 

Would really tidy things up a bit.
PHP Code:

with(addrow(id"Archer")){
  
classStats1 "your";
  
classStats2 "data";
  
classStats3 "here";


Agree with this also, but I do actually prefer the idea above, but I don't even know yet if this can be incorporated into the system.
Also, you should be adding security on the serverside like CBK and 0pix0 said. Them dirty "hackros" can change whatever they want as long as it remains clientside. I am giving you a "green pepper" anyway. (For those of you who don't know, Aaron likes to say red pepper and green pepper rather than red rep or green rep. I really don't know were this originated from)

Like the idea. Might do some research, but it really was an extension of the post I previously made. Very good idea though. Haven't seen you in a while and I hope you get in touch with me. I will forum PM you my details. You always were smarter than me. Thanks bro.

SoundFreak 09-04-2011 08:55 PM

Quote:

Originally Posted by Emera (Post 1667003)
Like the idea. Might do some research, but it really was an extension of the post I previously made. Very good idea though. Haven't seen you in a while and I hope you get in touch with me. I will forum PM you my details. You always were smarter than me. Thanks bro.

Ah but your sounds are better than mine...
Touche!

Emera 09-04-2011 08:57 PM

Quote:

Originally Posted by SoundFreak (Post 1667035)
Ah but your sounds are better than mine...
Touche!

Ah but the forums are yet to hear your music. Maybe you should give them a little taster of what you can do. If you are as good as you were when I last saw you (High school), then I imagine you will be even better now. Post something in the sound and music section.


All times are GMT +2. The time now is 05:10 PM.

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