Thread: spar script.
View Single Post
  #4  
Old 12-05-2009, 04:09 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by sssssssssss View Post
Sorry, I meant to say its not showing the line. Ive tried this.chat and message(), doesnt do anything. Used to last I checked though... kind of weird.
The issue:

PHP Code:
Script compiler output for Class asdf:
error: function onCreated redefined at line 170: function onCreated()
error: function onPlayerDies redefined at line 177: function onPlayerDies()
Script asdf updated by fowlplay4 
Alright that's a little weird but..

PHP Code:
function onCreated() 

  
this.attr[10] = false

  
this.spar_list ""

  
UpdateList(); 
  
this.setshape(13232); 

function 
onPlayerEnters() 

  
CheckSparList(); 

  if (
InSpar(player)) 
  { 
    
player.30.5
    
player.47
  } 

function 
onPlayerLeaves() 

  if (
GetSparNumber() < 2
    
this.attr[10] = false

function 
onPlayerChats() 

  if (
player.chat.starts("/join")) 
  { 
    if (!(
player.account in this.spar_list)) 
    { 
      if (!
InSpar(player)) 
      { 
        
this.spar_list.add(player.account); 

        
CheckSparList(); 
      } 
    } 
  } 
  if (
player.chat == "/leave"
  { 
    if (
InSpar(player)) 
    { 
      if (
this.attr[10] == false
      { 
        
player.30.5
        
player.47

        
CheckSparList(); 
      } 
    } 
  } 
  if (
player.chat == "start"
  { 
    if (
GetSparNumber() == 2
    { 
      if (
this.attr[10] == false
      { 
        if (
InSpar(player)) 
        { 
          for (
pl:players
          { 
            
pl.hearts 20
            if (
pl.account != player.account && InSpar(pl)) 
            { 
              if (
pl.chat == "start"
                
BeginSpar(); 
            } 
          } 
        } 
      } 
    } 
  } 
  if (
player.chat == "end"
  { 
    if (
GetSparNumber() == 2
    { 
      if (
this.attr[10] == true
      { 
        if (
InSpar(player)) 
        { 
          for (
pl:players
          { 
            if (
pl.account != player.account && InSpar(pl)) 
            { 
              if (
pl.chat == "end"
                
this.attr[10] = false
            } 
          } 
        } 
      } 
    } 
    else 
      
this.attr[10] = false
  } 

function 
BeginSpar() 

  
this.attr[10] = "starting"

  
putbomb(13125); 

  
sleep(3); 

  
this.attr[10] = true

function 
onPlayerDies() 

  for(
pl:players
    
pl.hearts 20

  if (
InSpar(player)) 
  { 
    
this.attr[10] = false

    
player.hearts 20

    
player.30.5
    
player.47

    
CheckSparList(); 
  } 

function 
CheckSparList() 

  if (
this.spar_list.size() > 0
  { 
    if (
GetSparNumber() < 2
    { 
      
findplayer(this.spar_list[0]).30.5
      
findplayer(this.spar_list[0]).24

      
findplayer(this.spar_list[0]).ap 50

      
findplayer(this.spar_list[0]).hearts 20

      
this.spar_list.delete(0); 

      
CheckSparList(); 
    } 
  } 
  
UpdateList(); 

function 
GetSparNumber() 

  
temp.spar_p 0

  for(
pl:players
  { 
    if (
InSpar(pl)) 
      
temp.spar_p ++; 
  } 

  return 
temp.spar_p


function 
InSpar(pl

  if (
pl.x+1.5 in |1747| && pl.y+2 in |1537|) 
    return 
true
  else 
    return 
false


function 
UpdateList() 

  if (
this.spar_list.size() > 0
    
this.chat "Line: " this.spar_list
  else 
    
this.chat "No Line!"
}
 
//#CLIENTSIDE
 
function onCreated() 

  
enablefeatures(allfeatures-0x80); 
  
disableweapons(); 
  
setTimer(.05); 
  
this.setshape(13232); 

function 
onPlayerDies() 
{
  
freezeplayer(.5); 
}

function 
onTimeout() 

  
enableweapons(); 
  
disablemap(); 
  if (
player.x+1.5 in |1747| && player.y+2 in |1537|) 
  { 
    if (
this.attr[10] == true
    { 
      
enablefeatures(allfeatures-1-2-4-0x10-0x20-0x80); 
    } 
    else{ 
      
enablefeatures(allfeatures-0x80); 
      
disableweapons(); 
    } 
  } 
  else{ 
    
enablefeatures(allfeatures-0x80); 
    
disableweapons(); 
  } 
  
setTimer(.05); 

Works fine, but you need to have a blank line after the clientside or else it doesn't compile it properly. Neat huh?

For the sake of the future scripts on your server, I'd recommend having all enablefeatures/showstats get done in a weapon-script system, so you can actually keep track of it before it's too late.
__________________
Quote:
Reply With Quote