Page 1 of 1

[ACS] Behavior of Giveinventory in multiplayer

Posted: Wed Dec 13, 2017 8:59 pm
by skaarjman
I am trying to give player a shotgun with this NET script:

Code: Select all

GiveActorInventory(256, "Shotgun",1);
Player TID is changed with enter script:

Code: Select all

Thing_ChangeTID(0,256+Playernumber());
Now, nor GiveActorInventory, nor GiveInventory (executed from clientside by server) gives the shotgun !
What am I missing ?

I've ended up with

Code: Select all

Script 1000 (Void) NET
{
	SpawnForced ("Shotgun",getactorx(256),getactory(256),getactorz(256),0,0);
	consoleCommand("+forward");
	delay(3);
	consoleCommand("-forward");
}
But it's really tedious for such a simple task. Is there are any other way to give player item in multiplayer by script ?

[ACS] Re: Behavior of Giveinventory in multiplayer

Posted: Wed Dec 13, 2017 9:40 pm
by Ivan
You should never give any inventory that would otherwise affect the gamesim through clientside scripts. If server must give something to a player, and it is the client who triggers it, you have options:

1. Give an inventory to the player from server side that triggers a script.
2. RequestScriptPuke. (From clientside to serverside script request)

[ACS] Re: Behavior of Giveinventory in multiplayer

Posted: Wed Dec 13, 2017 9:53 pm
by skaarjman
Sort of what I thought, just needed to set the activator for a script, otherwise it gives item for all players.
Thanks