Author Topic: My script wont work for some reason!  (Read 2040 times)

Help please with a new problem.

When doing admin checks, Try doing stuff like this:
Code: [Select]
function serverCmdWhatever(%client)
{
if(!%client.isSuperAdmin)
{
messageClient(%cl,'',"\c6You must be a Super Admin to use this command.");
return;
}
//Code stuff here
}
I find it a lot easier, and more efficient.
Same with stuff like
Code: [Select]
if(!$whisenabled == 1)
{
  //message
  return;
}
//code stuff here


If someone does not exist, it sends it anyway.
Sends it to who?

If I say /whisper without anything after it, it tells me I have no benefit whispering to yourself.
I'm not sure about this one.

Problem 1:
Code: [Select]
%msg = trim(%msg);The reason for the spaces is some of your %a[number] arguments are blank and so blank strings seperated by spaces are added. Just use the trim function to trim off the extra spaces after creating the string.
Problem 2: Instead of your loop, you should just use findClientByName(%name).
Code: [Select]
if(isObject(%client = findClientByName(%name)))
{
   ...
}
else
{
   ...
}
Problem 3:
Code: [Select]
if(%target == %client)
{
   ...
   return;
}
« Last Edit: January 03, 2010, 11:05:46 PM by Amade »

Quote

If someone does not exist, it sends it anyway.
Sends it to who?

I don't know. I don't recieve it, and the server was empty (besides me).


Problem 1:
Code: [Select]
%msg = trim(%msg);The reason for the spaces is some of your %a[number] arguments are blank and so blank strings seperated by spaces are added. Just use the trim function to trim off the extra spaces after creating the string.
Problem 2: Instead of your loop, you should just use findClientByName(%name).
Code: [Select]
if(isObject(%client = findClientByName(%name)))
{
   ...
}
else
{
   ...
}
Problem 3:
Code: [Select]
if(%target == %client)
{
   ...
   return;
}

How would I determine if there were more than one people with whatever in their name?

I don't think you should implement that as you could accidentally send a message to several people without meaning to. There are a bunch of issues you'd end up having with that and it's just simpler to use findClientByName. Besides, your old copy didn't ever message more than one person.

I don't think you should implement that as you could accidentally send a message to several people without meaning to. There are a bunch of issues you'd end up having with that and it's just simpler to use findClientByName. Besides, your old copy didn't ever message more than one person.
What shouldn't I implement?

What shouldn't I implement?
Sending messages to multiple people at once.

Sending messages to multiple people at once.
That is not what I meant at all. I meant how would I check if there were more than one people with whatever name they sent it to. Like Deriboy and Amade both have Ds in them. so if they whispered to "D", it might go to the wrong person.

That is not what I meant at all. I meant how would I check if there were more than one people with whatever name they sent it to. Like Deriboy and Amade both have Ds in them. so if they whispered to "D", it might go to the wrong person.
Oh, I see. That would be a good idea then.

You could just kind of remake a findclientbyname using clientgroup

Why won't %client.dump(); work for me?

%Client is a variable
do, findclientbyname(Deriboy).dump();