Hi,
First, the function that you're trying to call seems to be undefined. You want to get the number of active players, I see also that you have a function getActivePlayers who returns an array of the active players. If you want to get the number of active players you can do like this:
if(#getActivePlayers() <= 1)then
Second, If I understood right you want to end the map when the last player reach the Hunter. If you read the Wiki, you will see that the race gamemode gives you some usefull events like this one:
onPlayerPickUpRacePickup
int/string pickupID, string pickupType, int vehicleModel
(source: https://wiki.multitheftauto.com/index.ph ... ource:Race)
That events actives himself when a player pick up a racepickup like nitro, vehiclechange or repair.
So, for your script, what you need to do is: when we have 1 active player, we add the event using addEventHandler per example. If the event is activated, we check if the pickup is the hunter pickup like this: if pickupType == "vehiclechange" and vehicleModel == "HUNTERID" then
If this is right, then you can call the function RaceMode.endMap() to end the map.
Hope that helps you.
Regards.