Author Topic: Admin Only Vehicle  (Read 1967 times)

Look at the logic there. Can't you see that %client is going to be the vehicle DATABLOCK?
"lightTankVehicle".
You're right. I forgot.... I don't script much anymore.

Look at the logic there. Can't you see that %client is going to be the vehicle DATABLOCK?
"lightTankVehicle".
you have a small error in yours i can't help but noticing:

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

In a package, of course.

silly bauklotz switching his %c and %cl s

i might be wrong :D

can someone get me the code?

We have, you should just have read the topic.

We have, you should just have read the topic.
Ya i tryed all of them

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);
}

instead of parent:: can i use return::

instead of parent:: can i use return::

Why would you do that, parent works just fine.

Code: [Select]
package Light_Tank
{
function lightTankVehicle::onMount(%this,%obj,%player)
{
if(%obj.client.isAdmin || %obj.client.isSuperAdmin)
{
Parent::onMount(%this,%obj,%player);
}
else
{
commandToClient(%obj.client,'centerPrint',"\c6This vehicle is admin-only.",2);
}
}
};
ActivatePackage(Light_Tank);

would this work?

i think, %obj.client needs to be changed to %player.client


No.

I believe onMount is called after the player is already mounted, it doesn't check before mounting. Thus, all you're doing with that is telling them that they're not supposed to be using the vehicle and not actually doing anything to get them off of it.

I still think packaging gettrustlevel or minigamecstar fishe would be the best way as it would prevent them from mounting in the first place. You use a centerprint with a different message (might need a small schedule) to replace the "Not in minigame" or "not enough trust"

I tryed that and it still didn't work...
do i right teh script or get it?
« Last Edit: December 31, 2010, 02:50:37 PM by thaky »

I tryed that and it still didn't work...

i'm sure you didn't "try" it correctly, but keep trying we'll help you

edit: write it, we'll help
« Last Edit: December 31, 2010, 02:54:02 PM by howtoshotbillwetellyou »

Code: [Select]
package Light_Tank
{
function lightTankVehicle::onMount(%this,%obj,%player)
{
if(%player.client.isAdmin || %player.client.isSuperAdmin)
{
Parent::onMount(%this,%obj,%player);
}
else
{
commandToClient(%player.client,'centerPrint',"\c6This vehicle is admin-only.",2);
}
}
};
ActivatePackage(Light_Tank);

there it is

Code: [Select]
package AdminVehicle
{
function getTrustLevel(%player,%obj)
{
%client = %player.client;
if(!%client.isAdmin && !%client.isSuperAdmin && %obj.getDatablock().getName() $= "JeepVehicle")
{
%client.schedule(25,centerPrint,"This vehicle is admin only!",3);
return 0;
}
else
Parent::getTrustLevel(%player,%obj);
}
};
ActivatePackage(AdminVehicle);

Tested and it works, change JeepVehicle to the datablock name of your vehicle