Author Topic: Admin Jets  (Read 1092 times)

In my server everyone is set to no jets, but is there a command i can put in the script to make admins have jets? I'm very new to scripting and dont get mad for totally screwing up but what will this do?

{
if(!%client.isAdmin)
{
playerDatablock = PlayerJumpJet
}
}
« Last Edit: April 08, 2009, 11:28:39 PM by lilboarder32 »

why don't you just make a admin only room with a change datablock event?

two reasons
1. I'm trying to learn to script.
2. Its for a city rp

The ! symbol infront of a conditional inverts the conditional, so you're checking if the client is not an admin. (If you're making the default player type standard, and then setting non admins to jump jet, disregard this bit)

To set the datablock of a player use %client.player.changeDataBlock(PlayerJumpJet);

Thanks so will this work?

{if(%client.isAdmin)
{
%client.player.changeDataBlock(PlayerJumpJet);
}
}

Thanks so will this work?

{if(%client.isAdmin)
{
%client.player.changeDataBlock(PlayerJumpJet);
}
}



Code: [Select]
function serverCmdadminjets(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%client.player.changeDataBlock(PlayerJumpJet);
messageClient(%client,'',"\c3You now have jets.");
}
}

That, Or you could do this
Code: [Select]
package Jetz
{
function ServerCmdAdminJets(%client, %victimName)
{
   if(!%client.isAdmin && !%client.isSuperAdmin)
   {
      centerPrint(%client, "You are not an admin.", 3);
      return;
   }

   %victim = findClientByName(%victimName);
   if(!%victim || !isObject(%victim.player))
   {
      centerPrint(%client, "Unable to find player: \c6" @ %victimName @ "\c0.", 3);
      return;
   }

%victim.player.setDataBlock(PlayerStandardArmor);
%victim.player.CanJet = 0;
messageClient(%client,'',"\c3You now have jets.");

}
};
ActivatePackage(Jetz);

If you put a blank name in it should give you jets.

Why are you putting it in a package? It's unlikely anyone else is going to use servercmdAdminJets except for exactly the same purpose and you're not calling Parent::servercmdAdminJets (which would cause a "can't find function" error anyway) so it will still overwrite anyone else's servercmdAdminJets.

I would do it this way.
Code: [Select]
function GameConnection::OnSpawn(%client)
{
      Parent::OnSpawn(%client);
      if(%client.isAdmin | %client.isSuperAdmin)
      {
            %client.player.ChangeDatablock("StandardPlayerArmor");
      }
      else
      {
            %client.player.ChangeDatablock("NoJetPlayerArmor");
       }
}

%client.isAdmin | %client.isSuperAdmin
%client.isAdmin || %client.isSuperAdmin

?

I would do it this way.
Code: [Select]
function GameConnection::OnSpawn(%client)
{
      Parent::OnSpawn(%client);
      if(%client.isAdmin | %client.isSuperAdmin)
      {
            %client.player.ChangeDatablock("[b]PlayerStandard[/b]Armor");
      }
      else
      {
            %client.player.ChangeDatablock("NoJetPlayerArmor");
       }
}

It's PlayerStandardArmor, not StandardPlayerArmor


Code: [Select]
function serverCmdadminjets(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%client.player.changeDataBlock(PlayerJumpJet);
messageClient(%client,'',"\c3You now have jets.");
}
}

The best code here in my opinion.

The best code here in my opinion.

Tried it, failed epicly