Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
hs_listnewb

 
Post new topic   Reply to topic Printable version
 View previous topic  %macro expander Post :: Post hs_antiwarp  View next topic  
Author Message
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Aug 15, 2004 11:54 pm    Post subject: hs_listnewb Reply to topic Reply with quote

This is a fun command I made. Enjoy.

?listnewb
/?addnewb <title>
/?removenewb

Example ?listnewb:
Code: Show/Hide
:            Darkflare          0       man unf-er. <3
:     KiNg Of ThE dEaD          0        too many !!!s
:              D1st0rt          0   Too cool to handle
:                 Bak-          0      lame antiwarper


Code:
Code: Show/Hide

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../asss.h"

local Imodman *mm;
local Iconfig *cfg;
local Iplayerdata *pd;
local Icmdman *cmd;
local Ichat *chat;
local Igame *game;
local Icapman *capman;

local ConfigHandle newb_conf;

local helptext_t listnewb_help =
"Targets: none\n"
"Args: none\n"
"Lists all online players with staff specified newbie titles.\n";

local void Clistnewb(const char *params, Player *p, const Target *target)
{
   int seehid = capman->HasCapability(p, CAP_SEEPRIVARENA);

   Player *i;
   Link *link;

   const char *grp;

   pd->Lock();
   FOR_EACH_PLAYER(i)
   {
      if (i->status != S_PLAYING)
         continue;

      grp = cfg->GetStr(newb_conf, "Newbie", i->name);

      if (!grp)
         continue;

      if (strcasecmp(grp, "none") == 0)
         continue;

      chat->SendMessage( p, ": %20s %10s %20s", i->name,
            (i->arena->name[0] != '#' || seehid || p->arena == i->arena) ? i->arena->name : "(private)", grp);
   }
   pd->Unlock();
}

local helptext_t addnewb_help =
"Targets: player\n"
"Args: <newb title>\n"
"Adds the specified newbie title for the player under ?listnewb.\n";

local void Caddnewb(const char *params, Player *p, const Target *target)
{
   Player *t = target->u.p;

   time_t tm = time(NULL);
   char info[128];

   snprintf(info, sizeof(info), "set by %s on ", p->name);
   ctime_r(&tm, info + strlen(info));
   RemoveCRLF(info);

   cfg->SetStr(newb_conf, "Newbie", t->name, params, info, 1);
   chat->SendMessage(p, "Set player's newbie title to '%s'.", params);
}

local helptext_t removenewb_help =
"Targets: player\n"
"Args: none\n"
"Removes a player's newbie entry.\n";

local void Cremovenewb(const char *params, Player *p, const Target *target)
{
   Player *t = target->u.p;

   time_t tm = time(NULL);
   char info[128];

   snprintf(info, sizeof(info), "set by %s on ", p->name);
   ctime_r(&tm, info + strlen(info));
   RemoveCRLF(info);

   cfg->SetStr(newb_conf, "Newbie", t->name, "none", info, 1);

   chat->SendMessage(p, "Set player's newbie title to 'none'.");
}

EXPORT int MM_hs_listnewb(int action, Imodman *mm_, Arena *arena)
{
   if (action == MM_LOAD)
   {
      mm = mm_;
      pd = mm->GetInterface(I_PLAYERDATA, ALLARENAS);
      cfg = mm->GetInterface(I_CONFIG, ALLARENAS);
      cmd = mm->GetInterface(I_CMDMAN, ALLARENAS);
      chat = mm->GetInterface(I_CHAT, ALLARENAS);
      game = mm->GetInterface(I_GAME, ALLARENAS);
      capman = mm->GetInterface(I_CAPMAN, ALLARENAS);

      if (!pd || !cfg || !cmd || !chat || !game || !capman)
      {
         return MM_FAIL;
      }

      newb_conf = cfg->OpenConfigFile(NULL, "newb.conf", NULL, NULL);

      cmd->AddCommand("listnewb", Clistnewb, listnewb_help);
      cmd->AddCommand("addnewb", Caddnewb, addnewb_help);
      cmd->AddCommand("removenewb", Cremovenewb, removenewb_help);

      return MM_OK;
   }
   else if (action == MM_UNLOAD)
   {
      cmd->RemoveCommand("listnewb", Clistnewb);
      cmd->RemoveCommand("addnewb", Caddnewb);
      cmd->RemoveCommand("removenewb", Cremovenewb);

      cfg->CloseConfigFile(newb_conf);

      mm->ReleaseInterface(pd);
      mm->ReleaseInterface(cmd);
      mm->ReleaseInterface(cfg);
      mm->ReleaseInterface(chat);
      mm->ReleaseInterface(game);
      mm->ReleaseInterface(capman);
      return MM_OK;
   }
   return MM_FAIL;
}

_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me




hs_listnewb.c - 3.21 KB
File downloaded or viewed 50 time(s)
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 648 page(s) served in previous 5 minutes.

phpBB Created this page in 0.590177 seconds : 28 queries executed (85.0%): GZIP compression disabled