Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Player Commands (https://forums.graalonline.com/forums/showthread.php?t=70401)

xAndrewx 11-26-2006 12:12 PM

Player Commands
 
Basically, I made a set of functions for a system. Anything the player says will go through this NPC.

This is the class:
HTML Code:

function displayHelp()
{
  sendrpgmessage("Help Functions :-");
  sendrpgmessage(" Random Functions :-");
  sendrpgmessage("  /sit                  :- Makes the player sit");
  sendrpgmessage("  /sleep                :- Makes the player sleep");
  sendrpgmessage("  /die                  :- Makes the player die");
 
  player.chat = "Read your console log! (F2)";
}

function doAction(newGani)
{
  if (player.freezesecs > 0)
  {
    return false;
  }
  if ((timevar2 - this.lastAction) in |0, 0.2|)
  {
    return false;
  }
  this.lastAction = timevar2;
  player.setAni(temp.newGani, "");
  player.freezePlayer(0.15);
}

This is the weapon:
HTML Code:

function onActionServerside(curOption)
{
  temp.currentChat = temp.curOption.tokenize();
  temp.currentOption = temp.currentChat[0];
  temp.currentAssign = temp.currentChat[1];
 
  switch(temp.currentOption)
  {
    case "help":
      newplayer_chat::displayHelp();
    break;
   
    case "sit":
    case "sleep":
    case "die":
      temp.curGani = (temp.currentOption == "die"?
                      "dead": temp.currentOption);
      newplayer_chat::doAction(temp.curGani);
    break;   
  } 
}
this.join("newplayer_chat");

//#CLIENTSIDE
function onPlayerChats()
{
  if (client.disabled.index("chat") > -1)
  {
    player.chat = " ";
    return false;
  }
  if (player.chat.starts("/"))
  {
    triggerserver("weapon", this.name, player.chat.substring(1));
  }
    else
  {
    return false;
  }
  player.chat = "";
}

To disable the player's chat, simply add this in to the player's attributes
'client.disabled=chat,'


All times are GMT +2. The time now is 03:50 PM.

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