Author Topic: Stuck on scripting  (Read 3449 times)

No no no. You're wrong too.
You don't message %name, or set %name's trust.
It's %target.
Code: [Select]
if(%client.isAdmin)
{
%target = findClientByName(%name);
if(isObject(%target))
{
messageClient(%target, '', "\c6You can now build on this server.");
$Pref::Server::HasTrust[%target.bl_ID] = 1;
}
}
« Last Edit: October 20, 2009, 08:58:02 PM by Chrono »

/facepalm
Thanks for clarifying that for me, I really wasn't sure :/

Oh my. I told him to take something out then I left it in there.
:X

Can someone post the whole script put together. I am seeing adding and removing things and it is kind of confusing. Can someone just paste the whole thing so I can see what I did wrong?

Code: [Select]
function serverCmdAddTrust(%client, %name)
{
if(%client.isAdmin)
{
%target = findClientByName(%name);
if(isObject(%target))
{
messageClient(%client, '', '\c6%1 can now build on this server.', %target.getPlayerName());
messageClient(%target, '', "\c6You can now build on this server.");
$Pref::Server::HasTrust[%target.bl_ID] = 1;
}
}
else
{
messageClient(%client, '', "\c6You must be an admin to use this command.");
}
}

package ServerVIPBuild
{
function serverCmdPlantBrick(%client)
{
if($ServerVIPBuild::Enabled)
{
if($Pref::Server::HasTrust[%client.bl_id])
{
centerPrint(%client,"You are not allowed to build on this server.",2,2);
return;
}
}
Parent::serverCmdPlantBrick(%client);
}
};
activatePackage(ServerVIPBuild);

Make it invert the $Pref::Server::HasTrust[%client.bl_id]. Right now it's set to let people build who don't have trust.
Also, why are their two args after the string on centerPrint? I thought it was just the time, what's the other number for?
« Last Edit: October 20, 2009, 09:20:22 PM by lilboarder32 »

I didn't notice that, as it was copied from his code.

Though in v0002 that used to represent the number of lines.

And about inverting the trust thing, I already suggested him to make a remove trust command.

Could I make it

f($Pref::Server::HasTrust[%client.bl_id])
         {
            Parent::serverCmdPlantBrick(%client);
         }

Of course. But that wouldn't make much of a difference.

Ok, I wanna make an alliance mod where you type /alliance name to form one. People type /joinalliance name to join one and /disband alliance name to disband. Also, /checkalliances to see which ones there are? Where would I start?

What is the code for adding the sword item?

Like mounting the imiage to the player?

Like mounting the imiage to the player?
No, like simulating walking over a brick with an item. Adding the item to the players inventory.

Destiny's addItem function:
Code: [Select]
function Player::addItem(%player,%image,%client)
{
   for(%i = 0; %i < %player.getDatablock().maxTools; %i++)
   {
      %tool = %player.tool[%i];
      if(%tool == 0)
      {
         %player.tool[%i] = %image;
         %player.weaponCount++;
         messageClient(%client,'MsgItemPickup','',%i,%image);
         break;
      }
   }
}

Destiny's addItem function:
Code: [Select]
function Player::addItem(%player,%image,%client)
{
   for(%i = 0; %i < %player.getDatablock().maxTools; %i++)
   {
      %tool = %player.tool[%i];
      if(%tool == 0)
      {
         %player.tool[%i] = %image;
         %player.weaponCount++;
         messageClient(%client,'MsgItemPickup','',%i,%image);
         break;
      }
   }
}
Note: It purposely doesn't check if the player already has the tool first.