Author Topic: Simple Script Help  (Read 2735 times)

Paranoid? What?
Last time you said to use that because you were worried some stuffhead host would impersonate players joining.
Total paranoia.

What should the final code end up looking like?

Last time you said to use that because you were worried some stuffhead host would impersonate players joining.
Total paranoia.

It's primarily efficiency.

What should the final code end up looking like?

Something like this:

Code: [Select]
if(!$JoinMessage::Binds)
{
$remapDivision[$remapCount]="Join Message";
$remapName[$remapCount]="Toggle On/Off";
$remapCmd[$remapCount]="toggleJoinMessage";
$remapCount++;
$JoinMessage::Binds=1;
}

package JoinMessage
{
function onServerMessage(%Message)
{
if(%Message $= "")
return;

newChatHud_addLine(%Message);

if(getWord(%Message, getWordCount(%Message)-1) $= "connected." && getWordCount(%Message) > 1)
commandtoServer('messageSent', "Hello," SPC getWords(%Message, getWordCount(%Message)-2));
}

};
activatePackage(JoinMessage);

function toggleJoinMessage(%a)
{
if(!%a)
return;
if($JoinMessage::On)
{
$JoinMessage::On = false;
clientcmdcenterPrint("\c6Join message disabled.", 2);
}
else
{
$JoinMessage::On = true;
clientcmdcenterPrint("\c6Join Message enabled.", 2);
}
}

I got this
Code: [Select]
if(!$JoinMessage::Binds)
{
$remapDivision[$remapCount]="Join Message";
$remapName[$remapCount]="Toggle On/Off";
$remapCmd[$remapCount]="toggleJoinMessage";
$remapCount++;
$JoinMessage::Binds=1;
}

function onServerMessage(%Message)
{
if(%Message $= "")
return;
newChatHud_addLine(%message);
if(getWord(%Message, getWordCount(%Message)-1) $= "connected.") {
commandToServer('messageSent', "Welcome," SPC %client);
}
}

function toggleJoinMessage(%a)
{
if(!%a)
return;
if($JoinMessage::On)
{
$JoinMessage::On = false;
clientcmdcenterPrint("\c6Join message disabled.", 2);
}
else
{
$JoinMessage::On = true;
clientcmdcenterPrint("\c6Join Message enabled.", 2);
}
}


Someone kill me.

Thank you Ipquarx

You need to package onServerMessage, like ip did

I have the exact same thing as Ipquarx, but for some reason mine is saying

Golden God connected.

Yola: Welcome, God connected.

I have the exact same thing as Ipquarx, but for some reason mine is saying

Golden God connected.

Yola: Welcome, God connected.
Just copy-paste mine, yours screwed up.

Code: [Select]
if(!$JoinMessage::Binds)
{
$remapDivision[$remapCount]="Join Message";
$remapName[$remapCount]="Toggle On/Off";
$remapCmd[$remapCount]="toggleJoinMessage";
$remapCount++;
$JoinMessage::Binds=1;
}

package JoinMessage
{
function onServerMessage(%Message)
{
if(%Message $= "")
return;

newChatHud_addLine(%Message);

if(getWord(%Message, getWordCount(%Message)-1) $= "connected." && getWordCount(%Message) > 1)
commandtoServer('messageSent', "Hello," SPC getWords(%Message, getWordCount(%Message)-2));
}

};
activatePackage(JoinMessage);

function toggleJoinMessage(%a)
{
if(!%a)
return;
if($JoinMessage::On)
{
$JoinMessage::On = false;
clientcmdcenterPrint("\c6Join message disabled.", 2);
}
else
{
$JoinMessage::On = true;
clientcmdcenterPrint("\c6Join Message enabled.", 2);
}
}

I still get this issue

Agent Cookie connected.
Yola: Welcome, Cookie connected.

Code: [Select]
if(!$JoinMessage::Binds)
{
$remapDivision[$remapCount]="Join Message";
$remapName[$remapCount]="Toggle On/Off";
$remapCmd[$remapCount]="toggleJoinMessage";
$remapCount++;
$JoinMessage::Binds=1;
}

package JoinMessage
{
function onServerMessage(%Message)
{
if(%Message $= "")
return;

newChatHud_addLine(%Message);

if(getWord(%Message, getWordCount(%Message)-1) $= "connected." && getWordCount(%Message) > 1)
commandtoServer('messageSent', "Hello," SPC getWords(%Message, 0, getWordCount(%Message)-2));
}

};
activatePackage(JoinMessage);

function toggleJoinMessage(%a)
{
if(!%a)
return;
if($JoinMessage::On)
{
$JoinMessage::On = false;
clientcmdcenterPrint("\c6Join message disabled.", 2);
}
else
{
$JoinMessage::On = true;
clientcmdcenterPrint("\c6Join Message enabled.", 2);
}
}
Try that.

Worked,
Thanks everyone!

One more quick question,
Is their a simple way to add relative velocity to a player?

One more quick question,
Is their a simple way to add relative velocity to a player?
Not client sided.

Worked,
Thanks everyone!

One more quick question,
Is their a simple way to add relative velocity to a player?

Try looking at the "addRelativeVelocity" event add-on. It should be in the Events section of the RTB Mod Manager.

Try looking at the "addRelativeVelocity" event add-on. It should be in the Events section of the RTB Mod Manager.
Thanks.


And also,
Apparently ipquarx's is still broken
:/

Thanks.


And also,
Apparently ipquarx's is still broken
:/
'broken' how

also in his code you may as well remove all the keybind stuff (or actually use it)