Is there a way to call this from HumanNPC
and get the return to send this call?Code:var humanPlayer = npc.GetComponent<HumanPlayer>();
Code:HumanNPC?.CallHook("humanPlayer.StartAttackingEntity", player);
Send call for npc.GetComponent<HumanPlayer>()
Discussion in 'Rust Development' started by Ts3hosting, Feb 14, 2017.
-
Wulf Community Admin
No, you cannot call variables with .Call / .CallHook, only private methods. If you use the // Requires: HumanNPC (this goes at the top of your plugin, makes your plugin reliant on the other plugin) method, you should be able to access any public variables or methods.
-
what im trying to do is call this.
Code:void OnEnterNPC(BasePlayer npc, BasePlayer player) { if (player.userID < 76560000000000000L) return; var humanPlayer = npc.GetComponent<HumanPlayer>(); if (humanPlayer.info.message_hello != null && humanPlayer.info.message_hello.Count > 0) SendMessage(humanPlayer, player, GetRandomMessage(humanPlayer.info.message_hello)); if (humanPlayer.info.hostile && player.GetComponent<NPCEditor>() == null && !(bool)(Vanish?.CallHook("IsInvisible", player) ?? false)) humanPlayer.StartAttackingEntity(player); }
is there any way around this other then adding in new call in HumanNPC
[DOUBLEPOST=1487063585][/DOUBLEPOST]where would i add the Requires: HumanNPC
[DOUBLEPOST=1487063768][/DOUBLEPOST]When adding to the top i receive Error while compiling Npctp.cs(2,0): error CS1525: Unexpected symbol `Requires'
[DOUBLEPOST=1487063818][/DOUBLEPOST]forgot the // lolz i got it thanks