Blockland Forums > Modification Help
Return and Else Scripts
Lugnut:
try
if(%client.isAdmin)
{
instead of
if (%client.isAdmin)
{
otherwise I dunno.
Space Guy:
It will only attempt to clear the client's data if they either don't exist or they're not part of the RP.
Gordo12699:
--- Quote from: Space Guy on June 10, 2012, 02:34:27 AM ---It will only attempt to clear the client's data if they either don't exist or they're not part of the RP.
--- End quote ---
Why is that and how can I fix it?
Headcrab Zombie:
--- Quote from: Gordo12699 on June 10, 2012, 12:58:16 AM ---There is no Syntax.
--- End quote ---
Now here's a pet peeve of mine
Lesson 1: What the term syntax means. It's basically the structure of arranging your code; like grammar. If you say your code has no syntax, it wouldn't make sense at all. The term you're looking for is syntax error
--- Quote from: Lugnut1206 on June 10, 2012, 01:06:49 AM ---try
-snip-
otherwise I dunno.
--- End quote ---
I don't see what you did other than remove a space, which doesn't make a difference.
--- Quote from: Gordo12699 on June 10, 2012, 11:52:47 AM ---Why is that and how can I fix it?
--- End quote ---
Because of this:
--- Code: ---if (isObject(%client) && %client.isInRP())
return;
--- End code ---
Remove the return and put the next two lines in brackets.
Try this code. I put it in an if..else structure like you were attempting to do, so you can learn from that
--- Code: ---function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
if (%client.isAdmin)
{
// Message about Stats
messageClient('', "<color:ffffff>Your stats have been preserved because you are admin.");
}
else
{
// Lose tools and Clear Stats
if (isObject(%client) && %client.isInRP())
{
%client.RPData.value["tools"] = "";
%client.RPData.clear();
}
}
}
--- End code ---
(These two only apply if your code is all original, if you're working off an already made RP, ignore these)
Post the GameConnection::isInRP function
Is %client.RPData even an object, or are you trying to just arbitrarily create field names?
Lugnut:
--- Quote from: Headcrab Zombie on June 10, 2012, 12:30:13 PM ---I don't see what you did other than remove a space, which doesn't make a difference.
--- End quote ---
I didn't think it did, I was trying to be safe rather than sorry