MessageSent *Error Thread*

Author Topic: MessageSent *Error Thread*  (Read 6165 times)


rudyman

  • Guest
I still don't understand what's wrong with the forward slash.

You can fix how it only does the first word with this fix:

Code: [Select]
function NMH_Type::send(%this)
{
%msg=%this.getValue();
if(getSubStr(%msg,0,1) $= "\/")
{
%cmd=getSubStr(firstWord(%msg),1,strLen(firstWord(%msg))-1);
%cmd="\'"@%cmd@"\'";
%arg=restWords(%msg);
commandToServer(%cmd,%arg);
}
else
{
if(%this.isTeamMessage)
{
commandToServer('teamMessageSent',%msg);
}
else
{
commandToServer('messageSent',%msg);
}
}
}
« Last Edit: March 10, 2007, 10:39:09 PM by rudyman »

I'm trying to find server side fixes.

BTW:

>>> Advanced script error report.  Line 229.
>>> Some error context, with ## on sides of error halt:
^^if(strStr(strLwr(%string),strLwr($pref::server::curse[%i])>=0)

^^{##
##
^^^return 1;

^^}

^}

^for(%i=0;%i<getWordCount(%string);%i++)
« Last Edit: March 10, 2007, 11:16:38 PM by Jookia »

There's a extra } and
Code: [Select]
function serverCmdMessageSent(%client, %text) {
if(%client.isMuted == 1 || %text $= "")
  return;
%obj = %client.player;
%text = trim(%text);
//fwar play talk animation
//   if (!%obj.sitting) {
// %obj.playthread(0, talk);
// %obj.schedule(strlen(%text) * 50, stopthread, 0);
//   }
if(strlen(%text) >= $Pref::Server::MaxChatLen)
  %text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
%hostname = getlocal().name;
if(strstr(%text,"$") == 0) {
  %text = getsubstr(%text,1,strlen(%text));
  %command = getword(%text,0);
  %text = getsubstr(%text, strlen(%command),strlen(%text));
  eval("servercmd" @ %command @ "(" @ %client @ ",\"" @ %text @ "\");");
  return;
}
else
  chatMessageAll(%client, '\c7%1\c3%2\c7%3\c6: %4', %client.ClanPrefix, %client.name, %client.ClanSuffix, %text);
}
That makes it so that if a client does $ with a command they do a command, but also allows for more then one text after the command for use in the command. If I could make the clients have the / fix I have, I would, but not everyone is willing to download somethign....so....


Code: [Select]
function isClean(%string)
{
%curses=$pref::server::CurseList;
%etards=$pref::server::ETardList;

%curses=splitBy(%curses, "," ,"Curse","CurseCount");
%etards=splitBy(%etards, "," ,"ETard","ETardCount");

for(%i=1;%i<=$pref::server::curseCount;%i++)
{
if(strStr(strLwr(%string),strLwr($pref::server::curse[%i])>=0)
{
return 1;
}
}

for(%i=0;%i<getWordCount(%string);%i++)
{
for(%t=1;%i<=$pref::server::ETardCount;%t++)
{
if(getWord(%string,%i) $= $pref::server::Etard[%t])
{
return 1;
}
}
}
return 0;
}

Still a synax error.

Dude, what do you use to write torque in? If it's notepad then you're very neat cause everything is tabbed out n stuff

I use notepad, I have OCD. It makes me have to have everything just prefect. I even convert scripts like rudy's to make it the same style.

rudyman

  • Guest
Code: [Select]
function isClean(%string)
{
%curses=$pref::server::CurseList;
%etards=$pref::server::ETardList;

%curses=splitBy(%curses, "," ,"Curse","CurseCount");
%etards=splitBy(%etards, "," ,"ETard","ETardCount");

for(%i=1;%i<=$pref::server::curseCount;%i++)
{
if(strStr(strLwr(%string),strLwr($pref::server::curse[%i]))>=0)
{
return 1;
}
}
for(%i=0;%i<getWordCount(%string);%i++)
{
for(%t=1;%i<=$pref::server::ETardCount;%t++)
{
if(getWord(%string,%i) $= $pref::server::Etard[%t])
{
return 1;
}
}
}
return 0;
}
I left out a )  :panda:

Oh, and here's your serverCmdMessageSent() function so far:

Code: [Select]
$AnnouncementChar="^";  //<-- use this to make an announcement. You can change it to whatever you want.
function serverCmdMessageSent(%client,%text)
{
if(getSubStr(%text,0,1) $= $AnnouncementChar)
{
%cmd=getSubStr(firstWord(%text),1,strLen(firstWord(%text))-1);
%rest=restWords(%text);
eval("serverCmd"@%cmd@"("@%client@",\""@%rest@"\");");
return;
}
if(!isClean(%text)){return;}
if(strLen(%text) >=0 $Pref::Server::MaxChatLen)
{
%text=getSubStr(%text,0,$Pref::Server::MaxChatLen);
}
messageAll('','\c7%1\c3%2\c7%3\c6: %4',%client.ClanPrefix,%client.name,%client.ClanSuffix, %text);
}

In addition:

Code: [Select]
$spaceFix="_";  //<--- This is the character you want people type in place of a space for people's names.
function serverCmdPM(%client,%string)
{
%name=strReplace(firstWord(%string),$spaceFix," ");
%msg=restWords(%string);
for(%i=0;%i<clientGroup.getCount();%i++)
{
%c=clientGroup.getObject(%i);
if(isObject(%c) && %c.name $= %name)
{
messageClient(%c,'PM','\c3%1[PM]: %2',%client.name,%msg);
}
else if(isObject(%c) && %c.name $= %client.name)
{
messageClient(%c,'PM','\c3You[PM - %1]: %2',%name,%msg);
}
}
messageClient(%client,'Warning','That player does not exist!');
}

And

Code: [Select]
function serverCmdAnnounce(%client, %text)
{
if(%client.isSuperAdmin || %client.isAdmin)
{
%text=StripMLControlChars(%text);
if(strlen(%text) <= 1)
{
return;
}
if(strlen(%text) >= $Pref::Server::MaxChatLen)
{
%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
}
messageAll('','\c3Announcement: \c0%1', %text);
echo("Announcement: ", %text);
}
}

:)
« Last Edit: March 11, 2007, 10:44:42 AM by rudyman »

rudyman

  • Guest
I use notepad, I have OCD. It makes me have to have everything just prefect. I even convert scripts like rudy's to make it the same style.

I have to make sure that all the brackets line up and it looks like a neat block of code  :cookieMonster:

:/
Notepad 2 is perfect for script code.
Code: [Select]
function servercmdpm(%client,%text) {
%pmclient = findclientintextpm(%text);
%text = Strreplace(%text, %pmclient.name @ " ", "");
if (isobject(%pmclient)) {
  Messageclient(%pmclient, '', '\c5(PM)\c3%1\c6: %2', %client.name, %text);
  Messageclient(%client, '', '\c5(PM to \c3%1\c5)\c3%2\c6: %3', %pmclient.name, %client.name, %text);
}
return;
}
Code: [Select]
function servercmdme(%client,%text) {
chatMessageAll(%client, '\co\c1*\c7%1\c3%2\c7%3 \c6%4', %client.ClanPrefix, %client.name, %client.ClanSuffix, %text);
}
lol I made that like a day or 2 ago.....being on a computer all day makes you forget the passage of time :O!

I use to have notepad2. Too lazy to downlaod it. I love the line numbers and when you clcik a bracket it shows you the bracket that goes with it.

By the way, would

Code: [Select]
if(getSubStr(%text,0,9) $= /announce)
{
%cmd=getSubStr(firstWord(%text),9,strLen(firstWord(%text))-1);
%rest=restWords(%text);
eval("serverCmd"@%cmd@"("@%client@",\""@%rest@"\");");
return;
}

Work?
« Last Edit: March 11, 2007, 04:35:38 PM by Jookia »

Code: [Select]
if(getSubStr(%text,0,9) $= "/announce")
{
%cmd=getSubStr(%text,0,9);
%rest=restWords(%text);
eval("serverCmd"@%cmd@"(\'"@%client@"\',\""@%rest@"\");");
return;
}

But rudy set it with a firstword method...