Author Topic: Check my script pweeze  (Read 1967 times)

My script is not working

Code: [Select]
package HostCheck
{
function GameConnection::AutoAdminCheck(%client)
{
if(%client.bl_id $= getNumKeyID())
{
messageAll("",'<color:cccccc>%1 has become \c4Host<color:cccccc> (Auto));
}
}
}
};
« Last Edit: April 07, 2015, 02:35:29 AM by *LugNut* »

You missed a closing bracket.
« Last Edit: April 07, 2015, 12:42:55 AM by Johnny Blockhead »

you have to return the parent

return parent::autoAdminCheck(%client);

at the end of the function

in some cases you may want to do something like %r = parent::autoAdminCheck(%client); at the beginning and return %r; at the end but in this case i guess not?

additionally the way you're detecting host doesn't always work i don't think but i don't know off the top of my head what the more-complete method is

also if it isn't already, make sure the package is active

In addition to what otto said:
-You have an extra closing brace
-You need to use apostrophes for the first argument of messageAll and quotation marks for the 2nd.
-You're missing the closing quotation mark in the 2nd argument

still not there
Code: [Select]
package HostCheck
{
function parent::AutoAdminCheck(%client);
{
if(%client.bl_id $= getNumKeyID())
{
messageAll("",'<color:cccccc>%1 has become \c4Host<color:cccccc> (Auto));
}
}
};

you only fixed one thing??

please go in more detail, im new at scripting

EDIT: Sorry for spoonfeeding but it pains me to see someone not getting help for such a simple script.

To use %1, you need to have %client.name as another argument in messageAll
Not including what they said
you have to return the parent
return parent::autoAdminCheck(%client);
at the end of the function
in some cases you may want to do something like %r = parent::autoAdminCheck(%client); at the beginning and return %r; at the end but in this case i guess not?
additionally the way you're detecting host doesn't always work i don't think but i don't know off the top of my head what the more-complete method is
also if it isn't already, make sure the package is active
-You have an extra closing brace
-You need to use apostrophes for the first argument of messageAll and quotation marks for the 2nd.
-You're missing the closing quotation mark in the 2nd argument

This is the finished code; I've added comments so you can see what is going on in the script:
Code: [Select]
package HostCheck
{
function GameConnection::AutoAdminCheck(%client)
{
%r = parent::AutoAdminCheck(%client); //parent the script to make sure that it doesn't overwrite the original one
if(%client.isLocalConnection() || ($Server::LAN && $Server::Dedicated) || %client.getBLID() $= getNumKeyID()) //are they the host?
{
messageAll('','\c7%1 has become \c4Host \c7(Auto)',%client.name); //message everyone
return;
}
return %r; //return the parent
}
};
activatePackage(HostCheck); //packages need activation, so activate the package
« Last Edit: April 07, 2015, 03:26:15 PM by Darksaber2213 »

Seems like the message will break if they are admin, but aren't the host.

Seems like the message will break if they are admin, but aren't the host.
Nice catch, fixed.

Nice catch, fixed.
Since you're now returning it, it might create 2 messages. Not sure if it can work but putting a return (no parent) in the check.

idk why, but its not working
Code: [Select]
package HostCheck
{
function GameConnection::AutoAdminCheck(%client)
{
if(%client.isLocalConnection() || ($Server::LAN && $Server::Dedicated) || %client.getBLID() $= getNumKeyID()) //are they the host?
{
%r = parent::AutoAdminCheck(%client); //parent the script to make sure that it doesn't overwrite the original one
messageAll('',"\c7%client.name has become \c4Host \c7(Auto)",%client.name); //message everyone
return %r; //return the parent
}
}
}
activatePackage(HostCheck); //packages need activation, so activate the package

Since you're now returning it, it might create 2 messages. Not sure if it can work but putting a return (no parent) in the check.
Fixed again

idk why, but its not working
-code-
Use the one that I just updated.

Fixed again
Use the one that I just updated.
I did exactly that, its still doesnt work, just original default message

Try loading it into BL yourself, maybe it may change