Page 1 of 1

Final scoring notification issue

Posted: 30 March 2024, 17:40
by _Maestro_
Hi all,
I have a very annoying error on my final scoring. Once the game ends the game goes to its final stage.
In this stage the players can still get bonus points or penalty points.
I want to show these bonus/penalty points as notification to the players... but each time i get errors that it does not recognize the variable.

In the notification code, I have both ${player_name} (which works) and ${alive_score} (which does not work). On the latter it says the variable does not exist. Now I also give this variable to javascript and in the console I can see it has there the correct amount of points in. It is just not willing to show it to me.

Any ideas?

Code: Select all

self::notifyAllPlayers("justConsole","${player_name} receives ${alive} points.", array("player_name" => $player_name, "alive" => $alive_score) );


The error shown to me:
Server syntax error: Notice: Undefined variable: alive in ...

As notification it shows me the full message, but without the variable in it:
ZZZ receives points

But as mentioned in the console I can see in the "justConsole" the variable is filled with a number.

Thanks
Maurice

Re: Final scoring notification issue

Posted: 30 March 2024, 18:18
by thoun
In the message, replace " by ' and it will work. Because PH try to parse alive var, and you don't want that.
And you'll need to surround it with clienttranslate so it can be translated, but it's not related ;)

Re: Final scoring notification issue

Posted: 30 March 2024, 19:27
by _Maestro_
Yes! it works. Thanks i was struggling with this one.
The client translates will al be added... thanks for that reminder