Author Topic: Adding to invent.  (Read 2729 times)

How do you add something to the a person's invent? I tried mountimage(gunImage, 0); But that only mounts the object and if you open your invent you cant get it back.

Example of what i want to do:

Code: [Select]
function serverCmdGiveThing(%arg){
// Something to add to the person's invent.
}

Not very detailed but xD.

Code: [Select]
function servercmdGiveItems(%client,%item,%slot)
{
        if(%client.isSuperAdmin)
        {
                for(%i=0;%i<ClientGroup.getCount();%i++){
               %cl = ClientGroup.getObject(%i);
                 %cl.player.tool[%slot] = nametoID(%item);
                   messageClient(%cl, 'MsgItemPickup', '', %slot, nametoID(%item));
        }
}

%item - hammerItem, wandItem, rocketLauncherItem, etc
%slot - 0 to 4.

The code will loop through all clients and give them item %item in slot %slot if the person who activated it is a Super Admin:

/giveitems gunItem 0 will replace everyone's first slot with a gun.
« Last Edit: May 28, 2007, 08:06:05 AM by Space Guy »

Code: [Select]
%cl.player.tool[4] = nametoID(gunItem);
   messageClient(%cl, 'MsgItemPickup', '', 4, nametoID(gunItem));

Is That right?

Yes, it is. It should work fine.

Thanks. Shall Try.

That works but for my mod it takes 1 person at random and that only gives the item to that person. How would i make it give an item to everyone.
« Last Edit: May 29, 2007, 12:59:50 PM by MrPickel »

for(%i=0;%i<ClientGroup.getCount();%i++){
%cl = ClientGroup.getObject(%i);
%cl.player.tool[4] = nametoID(gunItem);
messageClient(%cl, 'MsgItemPickup', '', 4, nametoID(gunItem));
}


Works! Tyso much I needed it for the Monster-Player Triggers! :cookie: :cookie: :cookie: :cookie:

Of course it does xD