Author Topic: Admin Only Vehicle  (Read 1949 times)

Hey guys especially space guy (who is very helpful at times).
Would this work for a vehicle:
Code: [Select]
function lightTankVehicle::onMount(%this,%client)
{
       if(%client.isAdmin || %client.isSuperAdmin)
       {
              return;
       }
       else
       {
              %client.unmount
       }
}
« Last Edit: December 24, 2010, 12:33:39 PM by thaky »

Is any one gonna help me?

Correct me if I am wrong, because im not a perfect scripter; But if the user trys to mount the vehicle without admin he cannot mount the vehicle. The user is not mounted on anything we try to unmount the user when hes not mounted in a vehicle?

No if he's not admin he unmounts but if he is he mounts.

How about just try it and see what happens rather than asking whether it would work or not.

Code: [Select]
function lightTankVehicle::onMount(%client,%obj,%player)
{
       if(%client.isAdmin || %client.isSuperadmin)
       {
              messageClient(%obj.client,"","Well you are admin so have fun.");
              Parent::onMount(%client,%obj,%player);
       }
       else
       {
              messageClient(%obj.client,"","Hey you aren't admin What are you trying to do?");
              %obj.player.unmount();
       }
}

I just want to make sure that the bold letters are correct.
« Last Edit: December 27, 2010, 10:33:54 AM by thaky »

It would be better to completely prevent the player from even mounting in the first place - maybe packaging getTrustLevel or minigameCstar fishe? You just have to deal with the unfitting messages.

Hey guys especially space guy (who is very helpful at times).
Would this work for a vehicle:
Code: [Select]
function lightTankVehicle::onMount(%this,%client)
{
       if(%client.isAdmin || %client.isSuperAdmin)
       {
              return;
       }
       else
       {
              %client.unmount

i see the problem, i aint tellin though, it's to do with
<Hint>
%client
       }
}

@Venus try the 2nd post

For %client.unmount, wouldn't it be %client.player.dismount or something?

Code: [Select]
function lightTankVehicle::onMount(%this,%obj,%mnt) {
       if(!isObject(%cl = %mnt.client))
              return;
       if(%cl.isAdmin || %c.isSuperAdmin)
              Parent::onMount(%this,%obj,%mnt);
       else
              commandToClient(%mnt.client,'centerPrint',"This vehicle is admin-only.",2);
}

In a package, of course.

Code: [Select]
function lightTankVehicle::onMount(%this,%obj,%mnt) {
       if(!isObject(%cl = %mnt.client))
              return;
       if(%cl.isAdmin || %c.isSuperAdmin)
              Parent::onMount(%this,%obj,%mnt);
       else
              commandToClient(%mnt.client,'centerPrint',"This vehicle is admin-only.",2);
}

In a package, of course.
I thought it was
Code: [Select]
function lightTankVehicle::onMount(%client,%obj,%player) {
       if(!isObject(%client = %mnt))
              return;
       if(%client.isAdmin || %client.isSuperAdmin)
              Parent::onMount(%client,%obj,%player);
       else
              commandToClient(%client,'centerPrint',"This vehicle is admin-only.",2);
}



Code: [Select]
function lightTankVehicle::onMount(%client,%obj,%player) {
       if(!isObject(%client = %mnt))
              return;
       if(%client.isAdmin || %client.isSuperAdmin)
              Parent::onMount(%client,%obj,%player);
       else
              commandToClient(%client,'centerPrint',"This vehicle is admin-only.",2);
}

Look at the logic there. Can't you see that %client is going to be the vehicle DATABLOCK?
"lightTankVehicle".