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
  #7  
Old 08-12-2011, 12:07 AM
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
Instead of re-using the params array, you could at least use variables so other scripters can see what they actually are.

It's also better to just call findplayer once and store the 'found player' in a variable and use it instead of constantly calling findplayer every time you want to access the player's object.

I.e:

PHP Code:
function onActionServerSide() {
  
// other code..
  
if (params[0] == "GiveEC") {
    
temp.target findplayer(params[1]);
    
temp.ec_amount params[2];
    if (
temp.target != NULL) {
      if (
temp.target != player) {
        
EC_Database.(@temp.target.account) += params[2];
        
EC_Database.trigger("update");
        
temp.msg player.communityname SPC "gave " temp.ec_amount SPC "EC to " temp.target.communityname SPC "(" temp.target.account ")";
        
sendToRc(temp.msg);
        
saveLog2("ec_log.txt"temp.msg);
        
player.chat "Gave " temp.ec_amount SPC "EC!";
        
temp.target.chat "Gained " temp.ec_amount SPC "EC!";
      } else {
        
sendToRC(player.communityname SPC "tried to take EC while hosting an event.");
        
player.chat "Now, now.. You shouldn't be stealing EC...";
      }
    } else {
      
player.chat "Player doesn't exist...";
    }
  }
  
// other code..

Serverside security is also very important so make sure you follow cbk's advice and fix that too.

Your 'Join Event' GUI could use some work still as well.
__________________
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 02:57 PM.


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