Author Topic: admin only scripting  (Read 2318 times)

i dont know if there is a post on the forum already but can someone tell me how i could edit a cs. file to make the item admin only?

ty

You make things admin only by checking the clients variables isAdmin/isSuperAdmin.
If you want to do this for a weapon id suggest you change the Item::OnFire function using a package.

For example (Makes the gun admin-only to use) :
Code: [Select]
package GunAdminOnly
{
function gunImage::OnFire(%this,%obj,%slot)
{
if(%obj.client.isAdmin||%obj.client.isSuperAdmin)
{
Parent::OnFire(%this,%obj,%slot);
}
else
{
messageclient(%obj.client,"","You are not an admin!");
}
}
};Activatepackage(GunAdminOnly);

However it will still play the firing animation for non-admins, it wont shoot any projectile.

Hope this solves your problem ;D

thanks due this helped alot :D

No problem , but 1 word of advice, lock this topic so no noob will bump this topic in a month.

i was messing around with the scripts with the admin code you gave me (on the tool_splitter cs.) but when i start the game the items dont show up, it makes the regular ones. (i did rename the cs after i coppied it.)

if anyone could make an edited version and name it something like tool_adminsplitter so its unlimited and can only be used admins. (by the way i wanted it to work with the originals as well).(if you could name the items so they show up as something like admin shovel, admin dirt and stuff tha'd be great too :) )



i dont know if this is too much to ask but it would help because im just starting to take interest in scripting and stuff.

ty

~nano~

There is no need of making a new Item, just edit it to check if he is admin , if so he can place dirt unlimited times and shovel unlimited times.

i want to make a new item so that way i can have a server with admin stuff for unlimited and regular with limited...
« Last Edit: May 31, 2008, 02:44:06 PM by nano »

i want to make a new item so that way i can have a server with admin stuff for unlimited and regular with limited...
But don't post them. It's against the rules.

i just want to know how then

You would want to copy the file , and rename all datablocks , give them a new UIName.

i want to make a new item so that way i can have a server with admin stuff for unlimited and regular with limited...
But don't post them. It's against the rules.

How's that against any rule?

ok ill try that  ( i diod that a for the dirt,shovel and splitter  but now ill chnage them all)

ty i tell you if i need anything else

...so far it isnt working well...

i tryed changeing all the data blocks and all the admin only stuff but it didnt make the 2 items.

(i might have done the data blocks wrong:heres what it was as an example: datablock: something (splitteritem)i made the (splitter item) part (splitteritem2) or somrhting did i do it wrong?)

can someone reply please? i really need some help here

You have to make sure that the uiname has been changed too.