Thread: News System
View Single Post
  #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