View Single Post
  #7  
Old 09-08-2010, 06:41 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Quote:
Originally Posted by Cubical View Post
class
PHP Code:
function addExp(amount){
  
clientr.exp += amount;

baddy
PHP Code:
join("player_functions");
function 
onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

However joining the player to the class on login could simplify it and make it a bit more accessible. Using the same class you can just do player.addExp(amount); anywhere serverside by doing this on login.

PHP Code:
  player.join("player_functions"); 
then your code would look like this
PHP Code:
function onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
player.addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

Hmm where would I put the exp because the baddy uses this.exp
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote