Thread: GS2 Radio
View Single Post
  #8  
Old 04-17-2005, 01:31 AM
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
PHP Code:
// NPC Made by Velox Cruentus
function onactionserverside()
{
  switch (
params[0])
  {
    case 
"title":
    {
      
serverr.radio[0] := params[1];
      break;
    }
    case 
"chat":
    {
       
serverr.radio[1] := params[1];
       break;
    }
    case 
"song":
    {
       
serverr.radio[2] := params[1];
       break;
    }
  }
  for (
pallplayers){
    
with (p)
    {
       
triggeraction(0,0,"clientside","Radio","update");
    }
  }
}
//#CLIENTSIDE
function onplayerchats()
{
  if (
clientr.radioon == true)
  {
    
tok := player.chat.tokenize();
    switch (
tok[0])
    {
       case 
"radiooff":
       {
         
hideimgs(201,202);
         
stopsound();
         
client.radio := false;
         break;
       }
       case 
"chat":
       case 
"title":
       case 
"song":
       {
          
triggeraction(0,0,"serverside",this.name,tok[0],player.chat.substring(tok[0].length(),-1).Trim());
         break;
       }
    }
  } else if (
player.chat == "radioon")
  {
    
client.radio := true;
    
onactionclientside("update");
  }
}

function 
onactionclientside()
{
  if (
params[0] == "update")
  {
    if (
client.radio == true)
    {
      
showtitle(serverr.radio[0]);
      
showchat(serverr.radio[1]);
      
play(serverr.radio[2]);
    }
  }
}
function 
showtitle(text) {
  
showtext(201,100,0,"Arial","b","Song: "text);
  
changeimgvis(201,4);
}
function 
showchat(text) {
  
showtext(202,100,30,"Arial","b","Chat: " text);
  
changeimgvis(202,4);

__________________
In a world of change... Who'll you believe?
Reply With Quote