Home   Help Search Login Register  

Author Topic: USING HINT FROM A SERVERSCRIPT  (Read 952 times)

0 Members and 1 Guest are viewing this topic.

Offline ZNorQ

  • Members
  • *
  • ehr... uhm... duh...
USING HINT FROM A SERVERSCRIPT
« on: 30 Jun 2004, 15:31:34 »
What is the EASIEST way to broadcast 'hint' messages to all client from a 'server only' script?

ZNorQ

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:USING HINT FROM A SERVERSCRIPT
« Reply #1 on: 30 Jun 2004, 16:24:40 »
have another script running on all clients and in the server script use publicvariable to tell the client script to proseed from a check loop to the hint message.
Not all is lost.

Offline ZNorQ

  • Members
  • *
  • ehr... uhm... duh...
Re:USING HINT FROM A SERVERSCRIPT
« Reply #2 on: 30 Jun 2004, 22:45:59 »
Yes, I did something like that. Just that it's getting very long and complicated.

This is what the code looks like... (PS! I'm not a very good programmer, so pls dont laugh too loud! :D )

Code: [Select]
; *********************************************
; SCRIPT for Operation Flashpoint: Resistance *
; NSF Clan Coop missions                      *
; By ZNorQ           *
; Version vDF30p                              *
; *********************************************

;   This script waits for the 'vBroadcastMsg' to be set at a specific number other than ZERO.
;   Special variables _vNumKits and _vRevKitProdTime; Use this to change the number of minutes
;   for recreating revival kits - and how many. (Hospital messages) PS! APPLIES ONLY FOR SHOWN
;   MESSAGES - won't change the outcome of actual revival kits given/produced and the time it
;   takes!

#ClientScript
   ?(Local Server) and (vDedicatedServer): Exit

#DefineStandardVariables
   _vMedicDesert      = "BAS_JRangerMedicSDES"
   _vMedicWoodland    = "BAS_JRangerMedicS"
   _vRadioID          = "BAS_Satcom"
   _vIsMedic       = false
   _vIsGameMaster   = false
   _vCarriesRadio   = false
   _vInLion      = false
   _vInSnake      = false
   _vInShark      = false
   _vInEagle      = false
   _vNumKits      = 10
   _vRevKitProdTime    = 30

;   yLion   = [aLI1, aLI2, aLI3, aLI4, aLI5, aLI6]
;   ySnake   = [aSN1, aSN2, aSN3, aSN4, aSN5, aSN6]
;   yShark   = [aSH1, aSH2, aSH3, aSH4, aSH5, aSH6]
;   yEagle   = [aEA1, aEA2, aEA3]

#DoSomeSettings
   ?(player in yLion):  _vInLion  = true
   ?(player in ySnake): _vInSnake = true
   ?(player in yShark): _vInShark = true
   ?(player in yEagle): _vInEagle = true
   ?(typeOf player == _vMedicWoodland) or (typeOf player == _vMedicDesert): _vIsMedic = true
   ?(player == aLI6): _vIsGameMaster = true

#WaitForMessageSignal
   ~0.1
   ?(vBroadcastMsg == 0): goto "WaitForMessageSignal"

#CopyAndClearMessageSignal
   _vMessageCode = vBroadcastMsg
   vBroadcastMsg = 0

#PlayerCarryingRadio
   _vCarriesRadio = false
   ?(secondaryWeapon player == _vRadioID): _vCarriesRadio = true

#WhichMessageReceived
   _vPause   = false
   _vSender   = ""
   _vReceiver   = ""
   _vMsgType   = ""
   _vMsg       = ""
   ?(_vMessageCode ==  1) and !(vBroadcastHospitalMsg) : goto "MsgRewardRevKits"
   ?(_vMessageCode ==  2)                              : goto "MsgStatusRevKit"
   ?(_vMessageCode ==  3)                              : goto "MsgHospitalRKReady"
   ?(_vMessageCode ==  4) and (vBroadcastHospitalMsg)  : goto "MsgHospitalRKGiven"
   ?(_vMessageCode ==  5)                              : goto "MsgRespawnAH6J"
   ?(_vMessageCode ==  6)                              : goto "MsgDestroyedAH6J"
   ?(_vMessageCode ==  7)                              : goto "MsgDestroyedAbrams"
   ?(_vMessageCode ==  8)                              : goto "MsgRespawnAbrams"
   ?(_vMessageCode ==  9)                              : goto "MsgDestroyedBradley"
   ?(_vMessageCode == 10)                              : goto "MsgRespawnBradley"
   ?(_vMessageCode == 11)                              : goto "MsgHospitalRKDestroyed"
   ?(_vMessageCode == 12)                              : goto "MsgHospitalRKProduction"
   ?(_vMessageCode == 13)                              : goto "MsgGameMasterKitsGiven"

#FormatMessage
   _vMessage = ""
   ?(_vSender == "SBO"): _vMsgFrom = "FROM: Supplyboat"
   ?(_vSender == "FAC"): _vMsgFrom = "FROM: Factory"
   ?(_vSender == "YOU"): _vMsgFrom = "FROM: Myself"
   ?(_vSender == "MED"): _vMsgFrom = "FROM: Medic"
   ?(_vSender == "HOS"): _vMsgFrom = "FROM: Hospital"
   ?(_vSender == "NHQ"): _vMsgFrom = "FROM: Nato HQ"
   ?(_vReceiver == "TEM"): _vMsgTo = "TO: Team"
   ?(_vReceiver == "SQD"): _vMsgTo = "TO: Squad"
   ?(_vReceiver == "MED"): _vMsgTo = "TO: Medic"
   ?(_vReceiver == "GME"): _vMsgTo = "TO: Gamemaster"
   ?(_vReceiver == "RAD"): _vMsgTo = "TO: Radio operator"
   ?(_vMsgType == "REW"): _vMsgTyp = "REWARD"
   ?(_vMsgType == "STS"): _vMsgTyp = "STATUS"
   ?(_vMsgType == "LST"): _vMsgTyp = "LOST EQUIPMENT"
   ?(_vMsgType == "SUP"): _vMsgTyp = "SUPPLIES"
   _vMessage = format["#MESSAGE#\n\n%1\n%2\n\n%3\n\n%4\n\n#MESSAGE_END#", _vMsgFrom, _vMsgTo, _vMsgTyp, _vMsg]

#WhoCanSeeTheMessage
   _vShowMessage = false
   ?(_vReceiver == "SQD"):             _vShowMessage = true
;   ?(_vReceiver == "TEM") and #NOTDEFINED#:         _vShowMessage = true
   ?(_vReceiver == "MED") and (_vIsMedic):         _vShowMessage = true
   ?(_vReceiver == "RAD") and (_vCarriesRadio):    _vShowMessage = true
   ?(_vReceiver == "GME") and (_vIsGameMaster):    _vShowMessage = true
   ?!(_vShowMessage): goto "WaitForMessageSignal"

#DisplayMessage
   ?(_vPause):  hintC _vMessage
   ?!(_vPause): hint  _vMessage
   goto "WaitForMessageSignal"

;######################### MESSAGES BELOW #######################################################################################

#MsgRewardRevKits
   _vPause    = false
   _vSender   = "NHQ"
   _vReceiver = "RAD"
   _vMsgType  = "REW"
   _vMsg = format["The squad have been rewarded with %1 new revival packs!", vRevKitAmount]
   goto "FormatMessage"

#MsgStatusRevKit
   _vPause    = false
   _vSender   = "YOU"
   _vReceiver = "MED"
   _vMsgType  = "STS"
   _vMsg = format["Squad revival pack reserves left : %1.", vRevivalPackReserve]
   goto "FormatMessage"

#MsgHospitalRKReady
   _vPause    = false
   _vSender   = "HOS"
   _vReceiver = "RAD"
   _vMsgType  = "SUP"
   _vMsg = format["We have managed to produce %1 new revival packs for the squad. ", _vNumKits]
   _vMsg = _vMsg + "Bring 2 medics to pick them up from the white barrel outside the front door!\n\n"
   _vMsg = _vMsg + "Be aware that due to space limitations, we can not start producing more untill "
   _vMsg = _vMsg + "you have picked up this load!\n\n"
   goto "FormatMessage"

#MsgHospitalRKGiven
   _vPause    = false
   _vSender   = "HOS"
   _vReceiver = "RAD"
   _vMsgType  = "STS"
   _vMsg = format ["Medics have picked up the revival kits. %1 minutes till next supply!", _vRevKitProdTime]
   vBroadcastHospitalMsg = false
   goto "FormatMessage"

#MsgHospitalRKDestroyed
   _vPause    = false
   _vSender   = "HOS"
   _vReceiver = "RAD"
   _vMsgType  = "LST"
   _vMsg = "Oh my god! Some fucking idiot destroyed the bloddy hospital revival kit supplies! It will take us "
   _vMsg = _vMsg + "atleast 5 extra minutes fixing the damn barrel - it's the only one we've got!"
   goto "FormatMessage"

#MsgHospitalRKProduction
   _vPause    = false
   _vSender   = "HOS"
   _vReceiver = "RAD"
   _vMsgType  = "STS"
   _vMsg = format["Penalty time over - revival kit production resumed and will be finished in %1 minutes.", _vRevKitProdTime]
   goto "FormatMessage"

#MsgGameMasterKitsGiven
   _vPause    = false
   _vSender   = "YOU"
   _vReceiver = "GME"
   _vMsgType  = "STS"
   _vMsg = "Gamemaster cheat activated! 5 kits given!"
   goto "FormatMessage"

#MsgRespawnAH6J
   _vPause    = false
   _vSender   = "FAC"
   _vReceiver = "RAD"
   _vMsgType  = "SUP"
   _vMsg = "A new AH6J helicopter is now available at base!"
   goto "FormatMessage"

#MsgDestroyedAH6J
   _vPause    = false
   _vSender   = "NHQ"
   _vReceiver = "RAD"
   _vMsgType  = "LST"
   _vMsg = "We lost the AH6J helicopter!"
   goto "FormatMessage"

#MsgDestroyedAbrams
   _vPause    = false
   _vSender   = "NHQ"
   _vReceiver = "RAD"
   _vMsgType  = "LST"
   _vMsg = "We lost the M1A1 abrams heavy tank!"
   goto "FormatMessage"

#MsgRespawnAbrams
   _vPause    = false
   _vSender   = "FAC"
   _vReceiver = "RAD"
   _vMsgType  = "SUP"
   _vMsg = "A new M1A1 is now available at the base!"
   goto "FormatMessage"

#MsgDestroyedBradley
   _vPause    = false
   _vSender   = "NHQ"
   _vReceiver = "RAD"
   _vMsgType  = "LST"
   _vMsg = "The Bradley was destroyed. It will take around 5 minutes till we can resupply you with a new one!"
   goto "FormatMessage"

#MsgRespawnBradley
   _vPause    = false
   _vSender   = "SBO"
   _vReceiver = "RAD"
   _vMsgType  = "SUP"
   _vMsg = "A new Bradley have been supplied! Check the beach!"
   goto "FormatMessage"

Exit