Author Topic: trying to make a messagebox appear when you join a server.[solved]  (Read 1497 times)

i'm attempting to make a add-on where when you join a server it displays a message box and says what you are to the server, and when you join and it won't work.

function GameConnection::autoadmincheck(%client)
{
if(%client.isSuperAdmin)
   {
      commandtoclient(%client,'messageboxOK',"What are you?","You are a super admin!");
}
else if(%client.isadmin)
{
      commandtoclient(%client,'messageboxOK',"What are you?","You are an admin!");
}
else
{
      commandtoclient(%client,'messageboxOK',"What are you?","you ain't nothing.");
   }
}


thanks.
« Last Edit: August 21, 2012, 08:13:27 AM by wound »

you need to package it
so it'd be
package blah
{
function ....
{
parent::autoadmincheck(%client);
...
}
};activatepackage(blah);

Is that your whole code? You have to package functions like this.

Code: [Select]
package messageBoxOnEnter {
function GameConnection::autoadmincheck(%client)
{
%return = parent::autoAdminCheck(%client);
if(%client.isSuperAdmin)
   {
      commandtoclient(%client,'messageboxOK',"What are you?","You are a super admin!");
}
else if(%client.isadmin)
{
      commandtoclient(%client,'messageboxOK',"What are you?","You are an admin!");
}
else
{
      commandtoclient(%client,'messageboxOK',"What are you?","you ain't nothing.");
}
return %return;
}
};
activatePackage(messageBoxOnEnter);
« Last Edit: August 22, 2012, 01:36:10 PM by TripNick »

oh whoops, i did try to package it but i guess i put the parent in the wrong place, thanks.

i was trying to teach wound packages but then he sent me code back that was a mess and i had to go offline

pardon my failure to help him with this

i was trying to teach wound packages but then he sent me code back that was a mess and i had to go offline

pardon my failure to help him with this
you asked for questions so i asked one, guess i was wrong, thought you were 'helping' me. oh well, guess i know them now.

I was trying then I had to go
I've been busy ever since :(

You need to return parent::autoAdminCheck(%client); or you will break the auto admin system.

You need to return parent::autoAdminCheck(%client); or you will break the auto admin system.
Torque automatically returns the last line of a function.

Torque automatically returns the last line of a function.
Qtf
That seems like something everyone should have known long ago, unless I'm the only one this is news to...

Is that your whole code? You have to package functions like this.

Code: [Select]
package messageBoxOnEnter {
function GameConnection::autoadmincheck(%client)
{
if(%client.isSuperAdmin)
   {
      commandtoclient(%client,'messageboxOK',"What are you?","You are a super admin!");
}
else if(%client.isadmin)
{
      commandtoclient(%client,'messageboxOK',"What are you?","You are an admin!");
}
else
{
      commandtoclient(%client,'messageboxOK',"What are you?","you ain't nothing.");
}
parent::autoAdminCheck(%client);
}
};
activatePackage(messageBoxOnEnter);
You might wanna call the parent first, otherwise everyone's going to get called nothing.

Then return the value of the parent after doing everything.

You might wanna call the parent first, otherwise everyone's going to get called nothing.

Then return the value of the parent after doing everything.
Oh stuff, you're right. I didn't even read the content of the post, I just saw the lack of package.

Torque automatically returns the last line of a function.
holy loving stuff how did i not know this

You need to return parent::autoAdminCheck(%client); or you will break the auto admin system.
yep i figured that out the hard way but now it works since i made the parent.