View Single Post
  #2  
Old 07-08-2005, 10:17 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
class scomm:
PHP Code:
function onPM()
{
  
text := params[1];
  switch(
params[1])
  {
    case 
"all news":
      
news("all",1);
    break;
    case 
"last news":
      
news(1,1);
    break;
  }
}

function 
onRCChat(command)
{
  
text := params[1];
  if (
params.size() > 2)
    for (
i=2; i<params.size(); i++)
      
text @= (i == 1 ? "" : ",") @ params[i];

  
text = text.trim();
  switch(
command)
  {
    case 
"add":
      if (
this.exclude.index(text) == -1)
      {
        
sendtorc("/reset " @ text);
        
this.exclude.add(text);
        
sendtonc("+Exclude: " @ text);
      } else 
sendtonc("Exclude: " @ text @ " already excluded.");
    break;
    case 
"remove":
      if (
this.exclude.index(text) > -1)
      {
        
this.exclude.delete(this.exclude.index(text));
        
sendtonc("-Exclude: " @ text);
      } else 
sendtonc("Exclude: " @ text @ " failed -- Nonexistant.");
    break;
    case 
"exlude":
      if (
this.exclude.size() > 0)
        
sendtonc("Exclude: " @ this.exclude);
    break;
    case 
"news":
      
add_news(text);
    break;
    case 
"time":
      
sendtonc(timevar2);
    break;
    case 
"date":
      
sendtonc("Date: " @ date());
    break;
    case 
"pass":
      
sendtonc(text @ ": " @ md5(text));
    break;
    case 
"reset":
      
i = findplayer(text);
      if (
i.size() > 0)
      {
        
findplayer(text).join("pfunc");
        
findplayer(text).reset();
        
sendtonc("Reset " @ text @ ": Succeeded.");
        return 
true;
      }
      
sendtonc("Reset " @ text @ ": Failed.");
    break;
    case 
"help":
      
sendtonc("*-- Commands -- *");
      
sendtonc("pass <string>: Returns encrpytion.");
      
sendtonc("time: Returns time in timevar2.");
      
sendtonc("date: Returns date in DD/MM/YYYY format.");
      
sendtonc("exclude: lists accounts excluded.");
      
sendtonc("add/remove <account>: Add/Remove account from exclusion.");
      
sendtonc("news <message>: Adds message to news in - news format.");
    break;
  }
} 
weapon MUD:
PHP Code:
function onactionserverside(command,index,option)
{
//  sendtonc("Triggered");
  
switch(command)
  {
    case 
"state":
      
player.use_item(index,option);
    break;
  }
}
//#CLIENTSIDE
function onCreated()
{
  
this.items := new[player.clientr.ilist.size()];
  for (
i := 0; i < this.items.size(); i++)
  {
    
this.items[i] := player.clientr.item.(@player.clientr.ilist[i]).link();
    
item_state(i,1-this.items[i]);
  }
//  setTimer(0.1);
}
function 
onTimeout()
{
  
onCreated();
}

public function 
item_state(index,state)
{
  if (
player.clientr.ilist.size() > index)
  {
    
index := player.clientr.ilist[index];
    
triggeraction(0,0,"serverside",this.name,"state",index,state);
  } else echo(
"Request Failed: Change Item Syste (Item doesn't exist).");
} 
weapon Message:
PHP Code:
if (actionserverside)
{
  for (
o: allplayers)
  {
    
with (o)
    {
      
client.message.insert(0,params[0] @ ": " @ params[1]);
      if (
client.message.size() > 5)
        
client.message.delete(5);
    }
  }
}
//#CLIENTSIDE
if (playerchats)
{
  if (!
strequals(#c,) && !strequals(#e(0,1,#c),/) && !strequals(#e(0,6,#c),warpto) && !strequals(#e(0,6,#c),update))
  
{
    
setstring mess,;
    
addstring mess,#c;
    
triggeraction 0,0,serverside,Message,#a,#s(mess);
    
setplayerprop #c,;
  
} else if (strequals(#c,/clear))
  
{
    
setstring client.message,;
    
setplayerprop #c,;
  
}
}
if (
created || timeout)
{
  
hideimgs 200,210;
// TEXT
  
for (i=0;i<sarraylen(client.message);i++)
  {
    
showtext 201 + i*2,11,screenheight - 9 - 25 - 15*(i+1),,b,#I(client.message,i);
    
changeimgvis 201 + i*2,5;
    
changeimgzoom 201 + i*2,.8;
    
changeimgcolors 201 + i*2,0,0,0,1;

    
showtext 200 + i*2,10,screenheight - 10 - 25- 15*(i+1),,b,#I(client.message,i);
    
changeimgvis 200 + i*2,6;
    
changeimgzoom 200 + i*2,.8;
    
changeimgcolors 200 + i*2,0.8,0.5,0.1,1;
  }

  
showpoly 210,{0,screenheight - 85 - 25,screenwidth,screenheight - 85 - 22,screenwidth,screenheight,0,screenheight};
  
changeimgvis 210,4;
  
changeimgcolors 210,0.2,0.1,0,0.2;

// DOWNLOAD
  
if (strlen(#D) > 0 || this.show > 0)
  
{
    
percent = downloadsize == 0 ? 150 : int(150 * downloadpos / downloadsize);

    if (
percent != 150)
      
this.show = 2;
    else
      
this.show -= 0.05;

    
showpoly 220,{screenwidth - 160,screenheight - 24 - 22,screenwidth -  10,screenheight - 24 - 22,screenwidth -  10,screenheight - 10,screenwidth - 160,screenheight - 10};
    
changeimgvis 220,5;
    
changeimgcolors 220,0.3,0.2,0,0.3 + .5 * (1-(this.show/2));

    
showpoly 221,{screenwidth - 10 - percent,screenheight - 24,screenwidth -  10,screenheight - 24,screenwidth -  10,screenheight - 10,screenwidth - 10 - percent,screenheight - 10};
    
changeimgvis 221,8;
    
changeimgcolors 221,0.3,0.2,0,0.2 + .4 * (1-(this.show/2));

    if (
this.show == 2)
    {
      for (
i=0;i<2;i++)
      {
        
showtext 222 + i,screenwidth - 85 - i,screenheight - 17 - 22 - i,,cb,#v(downloadpos) / #v(downloadsize) #v(this.show);
        
changeimgvis 222 + i,6 + i;
        
changeimgcolors 222 + i,0.3*i,0.2*i,0,0.5*(2 - i);
        
changeimgzoom 222 + i,0.7;
      }
    } else  
hideimgs 222,223;
  } else  
hideimgs 220,223;

  
timeout = 0.2 - (strlen(#D) > 0 || this.show > 0) * 0.15;
}
public function 
msg(message)
{
  
client.message.insert(0,message);
  if (
client.message.size() > 5)
    
client.message.delete(5);
}

function 
onPlayerLogin(other)
{
  if (
other.level != false)
    
msg("Player " @ other.account @ ": Logged in.");
}

function 
onPlayerLogout(other)
{
  if (
other.level != false)
  
msg("Player " @ other.account @ ": Logged out.");
} 
weapon Piffy:
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.amm = 6;
  for (
i:=0;i< this.amm; i++)
    
showpoly(200 + i,{player.x + 0,player.y + 0,player.x + 0,player.y + 1});

  
this.a := {201,202,203};
  for (
o: this.a)
  {
    
with(findimg(o))
    {
      
this.tail := 200;
      
this.rots := random(0,(3.14/16));
    }
  }
  
this.a := {204,205};
  for (
o: this.a)
  {
    
with(findimg(o))
    {
      
this.tail := 202;
      
this.rots := random(0,(3.14/8));
    }
  }
  
onTimeout();
}
function 
onTimeout()
{
  
with (findimg(200))
  {
    
this.rotation := (this.rotation + (3.14 / 16))%6.28;
    for (
i := 0; i < (this.polygon.size()/2); i++)
    {
      
this.polygon[i*2] := player.x + sin(this.rotation)*i;
      
this.polygon[i*2+1] := player.y + cos(this.rotation)*i;
    }
  }

  for (
i := 0; i < (this.amm - 1); i++)
  {
    
with (findimg(201 + i))
    {
      
this.rotation := (this.rotation + this.rots)%6.28;
      
this.polygon[0] := findimg(this.tail).polygon[2];
      
this.polygon[1] := findimg(this.tail).polygon[3];

      
this.polygon[2] := this.polygon[0] + sin(this.rotation);
      
this.polygon[3] := this.polygon[1] + cos(this.rotation);
    }
  }
  
setTimer(0.05);
} 
__________________
In a world of change... Who'll you believe?
Reply With Quote