Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-11-2011, 09:04 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
On topic:

Big Issues

serverr variables are automatically synced with the client so there's no reason for your script to request, and pull the data from the server because it already has it.

You would be better off storing the news data in a DB-NPC instead of a server variable, if someone updates the server flags with RC it will probably break your news variable if it's too long.

Your 'this.can' array for those who can change the news is pointless because you don't verify it on the server-side so a hacker can easily update it without issue.

Minor Issues

As Emera pointed out getIt() is a very non-descriptive, renaming it getNews() or getNewsData() would be much more helpful.

You don't log (savelog2) when news changes occur, log information like this is useful when abuse happens.

Your calculation to center the news is a little off. To center it properly:

PHP Code:
= (screenwidth width) / 2;
= (screenheight height) / 2
Your 'this.can' variable should probably be defined in your onCreated method instead to make it easier for others to configure the script.

On the server-side I would recommend adding:

PHP Code:
function setNews(new_news) {
  
serverr.news new_news;
}

function 
getNews() {
  return 
serverr.news;

and calling those functions instead of setting them directly in onActionServerSide. It makes it looks cleaner and is easier to extend and maintain in the long run.
__________________
Quote:
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:50 AM.


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