Blockland Forums > Modification Help

Return and Else Scripts

Pages: (1/5) > >>

Gordo12699:

Hey, I was working on something for my City RPG and this problem came along. It seems as if I'm doing the else part wrong.

--- Code: --- function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);

if (!%client.isAdmin)
return;
// Message about Stats
messageClient('', "<color:ffffff>Your stats have been preserved because you are admin.");
%client.RPData.value["tools"] = "";
else;##
                ##
// Lose tools and Clear Stats
if (isObject(%client) && %client.isInRP())
return;
%client.RPData.value["tools"] = "";
%client.RPData.clear();
}
--- End code ---
Obviously the ## is where the problem starts and ends. Thanks for reading!

Lugnut:


--- Code: --- function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);

if (!%client.isAdmin)
return;
// Message about Stats
messageClient('', "<color:ffffff>Your stats have been preserved because you are admin.");
%client.RPData.value["tools"] = "";
// Lose tools and Clear Stats
if (isObject(%client) && %client.isInRP())
return;
%client.RPData.value["tools"] = "";
%client.RPData.clear();
}
--- End code ---
Fixed, now tell me what I changed.

elm:

Oh no, not another cityrpg! Lol..

Gordo12699:

Actually I've had this City RPG. Also, thanks for the code fix!

Gordo12699:


--- Quote from: Lugnut1206 on June 09, 2012, 10:08:32 PM ---
--- Code: --- function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);

if (!%client.isAdmin)
return;
// Message about Stats
messageClient('', "<color:ffffff>Your stats have been preserved because you are admin.");
%client.RPData.value["tools"] = "";
// Lose tools and Clear Stats
if (isObject(%client) && %client.isInRP())
return;
%client.RPData.value["tools"] = "";
%client.RPData.clear();
}
--- End code ---
Fixed, now tell me what I changed.

--- End quote ---

Well see, I want the if(isObject) part to be non admin. So if you fixed that, thanks. But we are working on preventing admins from clearing their stats when they die.

Pages: (1/5) > >>

Go to full version