Guest User

Untitled

a guest
Mar 28th, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. class test_Class: SCR_BaseTriggerEntity
  2. {
  3.     // This just filters for players
  4.     override bool ScriptedEntityFilterForQuery(IEntity ent) {
  5.         SCR_ChimeraCharacter cc = SCR_ChimeraCharacter.Cast(ent);
  6.         if (!cc) return false;
  7.         if (!IsAlive(cc)) return false;
  8.         return true;
  9.     }
  10.    
  11.     // This fires when a player enters the trigger
  12.     override void OnActivate(IEntity ent)
  13.     {
  14.         if (!Replication.IsServer()) return;
  15.        
  16.         GetGame().GetCallqueue().CallLater(SendHintRpc, 200, false, "Global", "Hint", 10);
  17.     }
  18.    
  19.     // This *should* send an Rpc to every client
  20.     void SendHintRpc(string a, string b, int c)
  21.     {
  22.         Rpc(GlobalHint, a, b, c);
  23.     }
  24.    
  25.     // This locally shows a custom hint
  26.     [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
  27.     void GlobalHint(string msg, string hl, int dur)
  28.     {
  29.         SCR_HintManagerComponent.ShowCustomHint(msg, hl, dur);
  30.     }
  31.  
  32. };
Add Comment
Please, Sign In to add comment