View Single Post
  #7  
Old 05-19-2007, 05:31 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Skyld View Post
Why not just do it all serverside? There is nothing there that needs to be clientside at all.


^Right, take a look at these:


PHP Code:
function onActionServerSide()
{
 if (
params[0] == "PurchaseItem")
  {
   switch(
params[1])
    {
     case 
"Juggling":
      if (
clientr.etcoins >= 30)
       {
        
clientr.etcoins -= 30;
        
addweapon("*Prizes/Juggle");
       }
      else
       {
        
player.chat "Insufficient funds!";
       }
      break;
    }
  }
}

//#CLIENTSIDE
function onPlayerChats()
{
 
tokens player.chat.tokenize();
 if (
tokens[0] == "buy")
  {
   
this.t_chat tokens.substring(4);
   switch(
this.t_chat)
    {
     case 
"Juggling":
      
triggerserver("gui",name,"PurchaseItem","Juggling");
      break;
    }
  }


Compared to:

PHP Code:
function onPlayerChats()
{
 
tokens player.chat.tokenize();
 if (
tokens[0] == "buy")
  {
   
this.t_chat tokens.substring(4);
   switch(
this.t_chat)
    {
     case 
"Juggling":
      if (
clientr.etcoins >= 30)
       {
        
clientr.etcoins -= 30;
        
addweapon("*Prizes/Juggle");
       }
      else
       {
        
player.chat "Insufficient funds!";
       }
      break;
    }
  }


Get the picture?
Reply With Quote