Author Topic: spawnitem except with datablock names instead of UI names  (Read 703 times)





Unfortunately you would need a server-side and a client-side add-on to do this. Datablock names are not sent. Why do you really need this?

Unfortunately you would need a server-side and a client-side add-on to do this. Datablock names are not sent.
LAME
Why do you really need this?
*long inhale* i want to make a specific item unspawnable except by admins and i would make it so it has no UI name and then it could only be spawned with this event and not the vanilla spawnitem event and then i could get an event restriction addon so non-admins cant use this event but now that doesnt work so i guess i need another method do you have any ideas

Could just make it admin only to pickup or equip

Could just make it admin only to pickup or equip
i dont want it admin only to pick up and it doesnt have an image to be equipped with

i gotchu
Code: [Select]
registerOutputEvent(“fxDtsBrick”, “spawnItemDatablock”, “string 100 200”);

function fxDtsBrick::spawnItemDatablock(%self, %datablockName) {
    if (!isObject(%datablockName) || %datablockName.getClassName() !$= ItemData) {
        return;
    }
    %self.spawnItem(%datablockName.getID());
}

MEGA upvote
mega downvote what did it mean by this
Code: [Select]
base/server/scripts/allGameScripts.cs (22261): Register object failed for object (null) of class Item.
« Last Edit: July 11, 2018, 07:23:49 PM by TableSalt »

wtf why not just make a script that prevents a certain item from being spawned through events or on bricks by people who aren't admins this is an awful approach

I am failing to understand what you are trying to do.
If you only want admins to spawn it you just need to get restricted events.

wtf why not just make a script that prevents a certain item from being spawned through events or on bricks by people who aren't admins this is an awful approach
yes pls

I am failing to understand what you are trying to do.
If you only want admins to spawn it you just need to get restricted events.
instead of typing out a whole paragraph explaining what i want again im just going to say: go away

I am failing to understand what you are trying to do.
If you only want admins to spawn it you just need to get restricted events.
Read the posts from OP. It's not that hard.

Unfortunately you would need a server-side and a client-side add-on to do this. Datablock names are not sent. Why do you really need this?
What in the world made you think this?
Events are purely server-sided. Sure the client doesn't have a list of datablock names, but you could just make it a regular list by cycling through the datablocks.

MEGA upvote
mega downvote what did it mean by this
Code: [Select]
base/server/scripts/allGameScripts.cs (22261): Register object failed for object (null) of class Item.
It almost seems like you attempted to spawn something that wasn't an item datablock.