Quote:
Originally Posted by sssssssssss
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(1, 32, 32);
}
function onPlayerEnters()
{
CheckSparList();
if (InSpar(player))
{
player.x = 30.5;
player.y = 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.x = 30.5;
player.y = 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(1, 31, 25);
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.x = 30.5;
player.y = 47;
CheckSparList();
}
}
function CheckSparList()
{
if (this.spar_list.size() > 0)
{
if (GetSparNumber() < 2)
{
findplayer(this.spar_list[0]).x = 30.5;
findplayer(this.spar_list[0]).y = 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 |17, 47| && pl.y+2 in |15, 37|)
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(1, 32, 32);
}
function onPlayerDies()
{
freezeplayer(.5);
}
function onTimeout()
{
enableweapons();
disablemap();
if (player.x+1.5 in |17, 47| && player.y+2 in |15, 37|)
{
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.