-------------------------------------------------------------- -- Foot Race script that -- updated mrb... 1/18/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') function onStartup(self) SetupActivity(self, 9999) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK print(msg.identifier .. ' ' .. msg.iButton .. ' ' .. self:GetActivityID().activityID) if msg.identifier == "Foot_Race_Stop" and msg.iButton == 1 then -- remove the user UpdatePlayer(self, msg.sender, true) --UpdatePlayer(self, player, removePlayer) StopFootRace(self, msg.sender) -- Response to Start activity dialog and ok is pressed and player is not in activity elseif msg.identifier == "Foot_Race_Start" and msg.iButton == 1 and not IsPlayerInActivity(self, msg.sender) then --print('startRace') -- add the new user UpdatePlayer(self, msg.sender) --UpdatePlayer(self, player, removePlayer) -- start the activity for the new user InitialActivityScore(self, msg.sender, 10) --InitialActivityScore(self, player, scoreVar) StartFootRace(self, msg.sender) end print(tostring(IsPlayerInActivity(self, msg.sender))) end function StartFootRace(self, player) local spawnerObj = LEVEL:GetSpawnerByName("FootRace01") if spawnerObj then spawnerObj:SpawnerActivate() spawnerObj:SpawnerReset() end end function StopFootRace(self, player) local spawnerObj = LEVEL:GetSpawnerByName("FootRace01") if spawnerObj then --print('kill the goals') spawnerObj:SpawnerDestroyObjects() spawnerObj:SpawnerDeactivate() end end