Script callbacks

Moderator: NADEO

MuNgLo
Posts: 316
Joined: 12 Jul 2012, 03:37

Re: Script callbacks

Post by MuNgLo »

About that Alt menu disable.

I wanted to test it so I added this under my onPlayerConnect()

Code: Select all

$this->connection->TriggerModeScriptEvent("LibXmlRpc_DisableAltMenu", $login);
It returns (bool) TRUE* but the scoreboard still pops up.

Would it matter which S_Mode or so you run?


* or atleast not FALSE. :/
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: Script callbacks

Post by reaby »

you have to enable the scriptCallbacks in matchsettings :)

Code: Select all

<mode_script_settings>
		 <setting name="S_UseScriptCallbacks" type="boolean" value="1"/> 
</mode_script_settings>
after that i got it working :)
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Script callbacks

Post by Eole »

@MuNgLo:
I can't control what the TriggerModeScriptEvent() function will return. So the true/false it returns doesn't match the result of the hide/show function on the server.

When you received the onPlayerConnect() event the player is not yet added in the Players array of the script. And because it's the script that manage the hide/show function of the scores table, it fails.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
MuNgLo
Posts: 316
Joined: 12 Jul 2012, 03:37

Re: Script callbacks

Post by MuNgLo »

K. What is the limitation of this way. Will it just work for alive players? Will it stop working for players that go spec and so on?
Reason I ask is cause if it only works for alive players in active turns for example, then it's a pretty useless fix.
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Script callbacks

Post by Eole »

It works for players and spectators, alive or eliminated. Before, during and after the turn.
But as it's managed by the script there's indeed some limitations. The function that waits the callbacks in the script must be called at each frame to not miss any event. So as long as the script is executed and the function called it works. I checked the official modes but I might have miss some cases where the function is not called, do not hesitate to report them and I'll try to fix them.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
MuNgLo
Posts: 316
Joined: 12 Jul 2012, 03:37

Re: Script callbacks

Post by MuNgLo »

Well it works just fine for me now. Thx for the help.
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Script callbacks

Post by Eole »

By default the "BeginMap" callback come just after the LoadMap() in the script. So, unless the mode specifically delays it, I can't put it earlier. Before the LoadMap(), the Players array is empty in the script, that's what you need?
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 3 guests