Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Basic Guild Control (https://forums.graalonline.com/forums/showthread.php?t=71885)

xXziroXx 02-02-2007 06:44 AM

Basic Guild Control
 
This is a rather basic and simple way to add and remove players to/from a guild, but thats the purpose. This is a tool for playerworld that does not require anything special to control their guilds.


wNPC:

PHP Code:

function onActionServerSide()
{
  
tokens player.chat.tokenize();
  switch (
params[0]) {
    case 
"add":
      if (
getguildnick(params[3], params[1]) == NULL) {
        
player.chat "Added" SPC params[1SPC "to" SPC params[3] @ "!";
        
with (findPlayer(params[1])) {
          
player.sendPM("You have been added to the guild" SPC params[3] @ "!<br><br>Say \"setnick" SPC params[2SPC "(" params[3] @ ")\" to put your tag on!");
          
player.chat "New PM arrived from the NPC-Server!";
        }
        
addguildmember(params[3], params[1], params[2]);
      } else 
player.chat "Error!" SPC params[1SPC "is already in the guild" SPC params[3] @ "!";
    break;
    
    case 
"remove":
      if (
getguildnick(params[2], params[1]) != NULL) {
        
player.chat "Removed" SPC params[1SPC "from" SPC params[2] @ "!";
        
with (findPlayer(params[1])) {
          
player.sendPM("You have been removed from the guild" SPC params[2] @ "!");
          
player.chat "New PM arrived from the NPC-Server!";
        }
        
removeguildmember(params[2], params[1]);
      } else 
player.chat "Error!" SPC params[1SPC "is not in" SPC params[2] @ "!";
    break;
  }
}

//#CLIENTSIDE
function onPlayerChats()
{
  
tokens player.chat.tokenize();
  switch (
tokens[0]) {
    case 
"/add":
      
triggerServer("gui"name"add"tokens[1], tokens[2], tokens[3]);
    break;
    
    case 
"/remove":
      
triggerServer("gui"name"remove"tokens[1], tokens[2]);
    break;
  }




All times are GMT +2. The time now is 12:49 PM.

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