Author Topic: (VERY) Noobeh Scripting Question  (Read 715 times)

Why does this script not work? I know it's something very obvious since it's just a few messageclients, but I'd like to know what I'm doing wrong :3 I'm obviously not a scripter in any way.
Code: [Select]
//---------------------------------
//- Script_Help
//- For Survival RP
//- By LegoEggo
//---------------------------------

function serverCmdHelp(%client)
{
messageclient(%client, ", '\c6Help categories: /radios, /heat, /hunger, /material.');
 };

function serverCmdRadios(%client)
{
messageclient(%client, ", '\c6Radios are bricks. You don't have one with you. To talk over a radio that you're near, end your chat with ", over" (without the quotes). That's SPACE COMMA OVER. The number above a radio indicates which channel it's on. You can only hear people on your channel, and only they can hear you.');
 };

function servercmdHeat(%client)
{
messageclient(%client, ", '\c6If you don't sit by a fire for long enough, you'll freeze to death. Fires cost material to place. They're called "Heat Bricks" and they're under the "Special" category in the brick cart.');
 };

function servercmdHunger(%client)
{
messageclient(%client, ", '\c6If you go too long without eating, you'll starve to death. Kill horses to gain food (lol). To eat food, type /eatfood amount.');
 };

function servercmdMaterial(%client)
{
messageclient(%client, ", '\c6Material is needed to place most bricks. There are different kinds of material. Salvage material from the plane wreck by activating the bricks. They'll get fakekilled, and come back after (quite) a while. Might want to leave some for other people. Also, advanced material is required for vehicles and weapons. Advanced material is hard to find.');
 };


Don't use a }; at the end of function declarations.

Please state what does not work about it. Also,
Code: [Select]
//---------------------------------
//- Script_Help
//- For Survival RP
//- By LegoEggo
//---------------------------------

function serverCmdHelp(%client)
{
messageclient(%client, '', "\c6Help categories: /radios, /heat, /hunger, /material.");
}

function serverCmdRadios(%client)
{
messageclient(%client, '', "\c6Radios are bricks. You don't have one with you. To talk over a radio that you're near, end your chat with ", over" (without the quotes). That's SPACE COMMA OVER. The number above a radio indicates which channel it's on. You can only hear people on your channel, and only they can hear you.");
}

function servercmdHeat(%client)
{
messageclient(%client, '', "\c6If you don't sit by a fire for long enough, you'll freeze to death. Fires cost material to place. They're called "Heat Bricks" and they're under the "Special" category in the brick cart.");
}

function servercmdHunger(%client)
{
messageclient(%client, '', "\c6If you go too long without eating, you'll starve to death. Kill horses to gain food (lol). To eat food, type /eatfood amount.");
}

function servercmdMaterial(%client)
{
messageclient(%client, '', "\c6Material is needed to place most bricks. There are different kinds of material. Salvage material from the plane wreck by activating the bricks. They'll get fakekilled, and come back after (quite) a while. Might want to leave some for other people. Also, advanced material is required for vehicles and weapons. Advanced material is hard to find.");
}

This may work. Fixes:
"};" is only needed at the end of packages; functions only need "}".
Your messageClient args were wrong; it's messageClient(%client, '', "text");
(' ' is second arg; " is outside of chats)

Ninjaedit: fu rky :(

also ' is different from "
your doing messageClient(%client," istead of '' which is double '
Also Placid, you can use ' as the message holder =\

Also Placid, you can use ' as the message holder =\
orlynao :(
see, i'm novice too. :\

Lets see, if you use " 's you use a messageClient(%client'',"BL Player " @ %victim @  " was killed"); for that
But if you use ' 's you can do messageClient(%client,'','BL Player %1 was killed',%victim); %1 acts as a place holder for the variable

Code: [Select]
function serverCmdRadios(%client)
{
messageclient(%client, ", '\c6Radios are bricks. You don\'t have one with you. To talk over a radio that you're near, end your chat with \", over\" (without the quotes). That\'s SPACE COMMA OVER. The number above a radio indicates which channel it\'s on. You can only hear people on your channel, and only they can hear you.');
 }
ALSO you have to put \ before things such as " or '

"};" is only needed at the end of packages; functions only need "}".
A "};" is not only needed at the end of packages. It is also for adding new objects such as %brick = new fxDtsBrick(){blablafields}; and at the end of declaring datablocks.

A "};" is not only needed at the end of packages. It is also for adding new objects such as %brick = new fxDtsBrick(){blablafields}; and at the end of declaring datablocks.

Datablocks and packages ARE objects, which is why they need the semicolon.

Datablocks and packages ARE objects, which is why they need the semicolon.
Oh, so just for adding objects in general?

Oh, so just for adding objects in general?

That's usually the case, or at least the easiest way to remember it for most people.

I got it working guys. No semicolons. thanks muccccch

Lets see, if you use " 's you use a messageClient(%client'',"BL Player " @ %victim @  " was killed"); for that
But if you use ' 's you can do messageClient(%client,'','BL Player %1 was killed',%victim); %1 acts as a place holder for the variable
It's bad to get into the habit because you can't edit strings across a network, atleast that's what I've read.