[REQUEST] Item

Place for sharing your game modifications for Life is Feudal: Your Own

Nothing_Personal
Zealous Believer
 
Posts: 52
Joined: 16 Mar 2016, 18:25

Re: [REQUEST] Item

Post by Nothing_Personal » 05 Jun 2017, 18:40

Sebbbbyocum wrote:This is not working for me, whenever i try to execute
Code: Select all
addItemToAllPlayerInventory(1061, 10, 10, 0, 0);



in-game it says unable to find the function addItemToAllPlayerInventory

yes i have exec(“mods/itemInventory.cs”); in my main.cs

This is what my /mods/iteminventory.cs looks like btw:
Code: Select all
//Searches through the player list and tries to find the player with the given id
function getPlayer(%pid)
{
   for(%id = 0; %id < ClientGroup.getCount(); %id++)
   {
      %client = ClientGroup.getObject(%id);
     
      if(%pid == %client.getCharacterId())
      {
         return %client;
      }
   }
   return 0;
}

// add a item to the player inventory
function addItemToPlayerInventory(%pid, %itemType, %quantity, %quality, %durability, %createdDurability)
{
   %client = getPlayer(%pid);
   if(%client != 0)
      %client.player.inventoryAddItem(%itemType, %quantity, %quality, %durability, %createdDurability );
}

// add a item to all player inventory
function addItemToAllPlayerInventory(%itemType, %quantity, %quality, %durability, %createdDurability)
{
   for(%id = 0; %id < ClientGroup.getCount(); %id++)
   {
      %client = ClientGroup.getObject(%id);
     
             if(%client != 0)
             {
                   %client.player.inventoryAddItem(%itemType, %quantity, %quality, %durability, %createdDurability );
             }
     }
}

//Remove the item to the player inventory (remove full stack)
function removeItemToPlayerInventory(%pid, %itemType)
{
   %client = getPlayer(%pid);
   if(%client != 0)
      %client.player.inventoryRemoveItem(%itemType);
}


That's because you don't run this cs or these commands from a game client, you run them from server scripting or the server console window.


Sebbbbyocum
 
Posts: 12
Joined: 03 Jun 2017, 06:32

Re: [REQUEST] Item

Post by Sebbbbyocum » 05 Jun 2017, 23:25

Nothing_Personal wrote:
Sebbbbyocum wrote:This is not working for me, whenever i try to execute
Code: Select all
addItemToAllPlayerInventory(1061, 10, 10, 0, 0);



in-game it says unable to find the function addItemToAllPlayerInventory

yes i have exec(“mods/itemInventory.cs”); in my main.cs

This is what my /mods/iteminventory.cs looks like btw:
Code: Select all
//Searches through the player list and tries to find the player with the given id
function getPlayer(%pid)
{
   for(%id = 0; %id < ClientGroup.getCount(); %id++)
   {
      %client = ClientGroup.getObject(%id);
     
      if(%pid == %client.getCharacterId())
      {
         return %client;
      }
   }
   return 0;
}

// add a item to the player inventory
function addItemToPlayerInventory(%pid, %itemType, %quantity, %quality, %durability, %createdDurability)
{
   %client = getPlayer(%pid);
   if(%client != 0)
      %client.player.inventoryAddItem(%itemType, %quantity, %quality, %durability, %createdDurability );
}

// add a item to all player inventory
function addItemToAllPlayerInventory(%itemType, %quantity, %quality, %durability, %createdDurability)
{
   for(%id = 0; %id < ClientGroup.getCount(); %id++)
   {
      %client = ClientGroup.getObject(%id);
     
             if(%client != 0)
             {
                   %client.player.inventoryAddItem(%itemType, %quantity, %quality, %durability, %createdDurability );
             }
     }
}

//Remove the item to the player inventory (remove full stack)
function removeItemToPlayerInventory(%pid, %itemType)
{
   %client = getPlayer(%pid);
   if(%client != 0)
      %client.player.inventoryRemoveItem(%itemType);
}


That's because you don't run this cs or these commands from a game client, you run them from server scripting or the server console window.


Unfortunately i am using bluefang and their console is read-only. Can you explain to me what server scripting is? Maybe that is a way i can accomplish it. Thank you


Nothing_Personal
Zealous Believer
 
Posts: 52
Joined: 16 Mar 2016, 18:25

Re: [REQUEST] Item

Post by Nothing_Personal » 06 Jun 2017, 00:06

Do you have access to the server to at least add files to it? If you can't place files in the server and the console is read only I don't know what you can do.


Sebbbbyocum
 
Posts: 12
Joined: 03 Jun 2017, 06:32

Re: [REQUEST] Item

Post by Sebbbbyocum » 06 Jun 2017, 00:18

Nothing_Personal wrote:Do you have access to the server to at least add files to it? If you can't place files in the server and the console is read only I don't know what you can do.


Yes i have access to the mySQL DB and the server files. I can add files too it if necessary/needed. That's how i was able to place the mods/itemInventory.cs folder and file.


Sebbbbyocum
 
Posts: 12
Joined: 03 Jun 2017, 06:32

Re: [REQUEST] Item

Post by Sebbbbyocum » 09 Jun 2017, 02:16

bump, would really appreciate if anyone can help me resolve this issue im having or help me to find another way to execute the script without console access.

Return to Game mods