[ACS] Running script as soon as a player connects
[ACS] Running script as soon as a player connects
I have a little problem with running a script on a client's end as soon as they connect to the server. The catch is that I can't use ENTER script because that implies they joined the game. I need this to run on connecting to server, which includes spectators as well.
Is this possible? If so how?
Is this possible? If so how?
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
Re: [ACS] Running script as soon as a player connects
You can define an OPEN CLIENTSIDE script, which should execute on the client's end as soon as they've connected to the server.
Code: Select all
Script "PlayerConnect" OPEN CLIENTSIDE
{
// Execute code when client joins the server.
}
Re: [ACS] Running script as soon as a player connects
Server runs the open script. It wouldn't matter if it's clientside or not AFAIK.Kaminsky wrote: ↑Sun Oct 08, 2017 1:54 amYou can define an OPEN CLIENTSIDE script, which should execute on the client's end as soon as they've connected to the server.
Code: Select all
Script "PlayerConnect" OPEN CLIENTSIDE { // Execute code when client joins the server. }
EDIT: Nevermind, it works apparently.
EDIT 2: Although it works, it doesn't have what I need. I need the connecting player's playernumber.
EDIT 3: Ok, PlayerNumber() is meaningless apparently. ConsolePlayerNumber() however has meaning.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
- Combinebobnt
- Retired Staff / Community Team Member
- Posts: 1893
- Joined: Mon Jun 04, 2012 3:37 am
- Location: Erth
- Contact:
Re: [ACS] Running script as soon as a player connects
lol ivan he gave u the solution and u didnt even try it at first
code master c+++?
code master c+++?
SUPERFAST: DUEL DM CTF DOM
Zdoomwars Kosher Maps
Naturemod LMS
Re: [ACS] Running script as soon as a player connects
Does that work? I'm almost 100% sure that isn't supposed to work, because this was asked before actually, and it should do the same as OPEN, but for clients.
Alternatively, you could loop a script that keeps checking if an unique id is taken, and should it, make it execute a script with that id as activator.
Alternatively, you could loop a script that keeps checking if an unique id is taken, and should it, make it execute a script with that id as activator.
Re: [ACS] Running script as soon as a player connects
Fused wrote: ↑Sun Oct 08, 2017 7:09 amDoes that work? I'm almost 100% sure that isn't supposed to work, because this was asked before actually, and it should do the same as OPEN, but for clients.
Alternatively, you could loop a script that keeps checking if an unique id is taken, and should it, make it execute a script with that id as activator.
I have used this method before and it has worked for me, but I should mention that just like OPEN scripts that are executed on the server, the activator of an OPEN CLIENTSIDE script is the world and not the client, which is why PlayerNumber() wasn't working before.
You can however return the local id of the client using ConsolePlayerNumber(), so using SetActivatorToPlayer(ConsolePlayerNumber()) should properly set the activator of the script to the client if necessary.
Fused's method will more or less get you to the same place, but then you would also have a script on the server with a while loop that constantly checks for clients every tic (through some combination of PlayerIsSpectator() and PlayerInGame() to see if the client wasn't playing the game before and actually just joined), which can be quite cumbersome. As far as I know, OPEN CLIENTSIDE scripts also execute only for the client that connected and not everyone, so no need to do an additional check to see whether the script needs to be terminated for certain clients or not.
Re: [ACS] Running script as soon as a player connects
Yeah bob zandronum keeps amazing me that's why I plan to never touch it in the future :)Combinebobnt wrote: ↑Sun Oct 08, 2017 5:53 amlol ivan he gave u the solution and u didnt even try it at first
code master c+++?
Yes, it does work with ConsolePlayerNumber. It makes some sense too, because the activator of the OPEN scripts is the server. So, PlayerNumber makes sense to return -1, but ConsolePlayerNumber returns the client's id, which does make sense. I had my usual "ConsolePlayerNumber() == PlayerNumber()" check for the script and that's why it wasn't working.Fused wrote: ↑Sun Oct 08, 2017 7:09 amDoes that work? I'm almost 100% sure that isn't supposed to work, because this was asked before actually, and it should do the same as OPEN, but for clients.
Alternatively, you could loop a script that keeps checking if an unique id is taken, and should it, make it execute a script with that id as activator.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
Re: [ACS] Running script as soon as a player connects
No, I'm referring to OPEN CLIENTSIDE triggering when someone connects. Are you 100% sure it doesn't trigger when the map loads, like a regular OPEN script? Good thing it was the solution to your problem though.
Re: [ACS] Running script as soon as a player connects
Yep, connected multiple times in different instances, each got a different number on their screen and only once.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
Re: [ACS] Running script as soon as a player connects
It triggers when the map loads on that specific client, the server never knows of the script.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread