Author Topic: miniGameCstar fishe messages  (Read 495 times)

What decides the message that is displayed when you cannot use a vehicle? Returning 0 from a check for miniGameCstar fishe will variously centerprint "Space Guy does not trust you enough to ride", "Space Guy does not trust you enough to do that", "This vehicle is not part of the mini-game", etc. when I am trying to check whether a client is on the correct team, in a minigame where I have my own trust. I've been using this code:

Code: [Select]
function miniGameCstar fishe(%obj1,%obj2)
 {
  %mini1 = getMinigameFromObject(%obj1);
  %mini2 = getMinigameFromObject(%obj1);
  if(%mini1 != %mini2 || %mini1 == -1) 
   return Parent::miniGameCstar fishe(%obj1,%obj2);
 
  if((%obj2.getClassName() $= "AIPlayer" || %obj2.getType() & $TypeMasks::VehicleObjectType) &&
     %obj2.dataBlock.numMountPoints > 0 && isObject(%obj2.spawnBrick) && %obj2.spawnBrick.tdmAlliedTeam !$= "") //using a vehicle with team
  {
   if(%obj1.getType() & $TypeMasks::PlayerObjectType && isObject(%obj1.client)) //player with team
   {
    if(%obj2.spawnBrick.tdmAlliedTeam-1 != %obj1.client.tdmTeam)
    {
     if(%obj1.client.getClassName() $= "GameConnection") //only send the message to real clients
      %obj1.client.schedule(0,centerPrint,"\c5Only members of " @ teamName(%mini1,%obj2.spawnBrick.tdmAlliedTeam-1) @ "\c5 can use this \c3" @ %obj2.dataBlock.uiName @ "\c5.",2); //Scheduled
     return 0;
    }
   }
  }
 
  return Parent::miniGameCstar fishe(%obj1,%obj2);
 }

... but doing that causes the message to flicker from one of the wrong errors to "Only members of [team] can use this [vehicle], which doesn't look right. Removing the schedule just causes the other error to occur, but not my one.

I tried disabling wrong vehicle use through WheeledVehicleData/Armor::onCollision, but this also disables vehicle damage for people who cannot "use" the vehicle, which I don't want as then you cannot run down enemies.