I'm doing tests to make communications from the server to the client through RPC, I have made a test plugin for it, but for some reason I can not get it to work, when I try to send something to rpc I get this error:
No receiver found for RPC 'Saludos' at uLinkNetworkView "Player POMPEYO (76561197960761348)" (ViewID 60969)
Here I leave the complete project, and I will also put the code directly, I need someone to help me find where my error is
PruebaServer:
PruebaServerRPC:
No receiver found for RPC 'Saludos' at uLinkNetworkView "Player POMPEYO (76561197960761348)" (ViewID 60969)
Here I leave the complete project, and I will also put the code directly, I need someone to help me find where my error is
PruebaServer:
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Fougerite;
using Fougerite.Events;
using RustBuster2016Server;
using UnityEngine;
namespace PruebaServer
{
public class PruebaServer : Fougerite.Module
{
private PruebaServerRPC rpc;
private GameObject myGameObject;
public const string red = "[color #FF0000]";
public const string yellow = "[color yellow]";
public const string green = "[color green]";
public const string orange = "[color #ffa500]";
public override string Author
{
get { return "Pompeyo"; }
}
public override string Name
{
get { return "PruebaServer"; }
}
public override Version Version
{
get { return new Version("1.0"); }
}
public override string Description
{
get { return "Testing RPC System"; }
}
public override void DeInitialize()
{
// Hooks.OnPlayerSpawned -= OnPlayerSpawned;
Hooks.OnCommand -= OnCommand;
if (myGameObject != null)
{
UnityEngine.Object.Destroy(myGameObject);
}
}
public override void Initialize()
{
//Hooks.OnPlayerSpawned += OnPlayerSpawned;
Hooks.OnCommand += OnCommand;
myGameObject = new GameObject();
rpc = myGameObject.AddComponent<PruebaServerRPC>();
UnityEngine.GameObject.DontDestroyOnLoad(myGameObject);
}
public void OnCommand(Fougerite.Player pl, string cmd, string[] args)
{
if (cmd == "test")
{
pl.MessageFrom(Name, green + "Probando RPC!!!");
rpc.SendMessageToPlayer(pl, "Saludos", true);
pl.MessageFrom(Name, red + "Probando RPC!!!");
}
}
}
}
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PruebaServer
{
public class PruebaServerRPC : UnityEngine.MonoBehaviour
{
//2 paso
public void SendMessageToPlayer(Fougerite.Player pl, string function, bool Inicio)
{
if (pl.NetworkPlayer != null && pl.PlayerClient.networkView != null)
{
//Supongo q para enviar Server -> Client
//networkView.RPC(function, UnityEngine.RPCMode.Others, Inicio);
//Supongo q para enviar Server -> Especific Client
uLink.NetworkView.Get(pl.PlayerClient.networkView).RPC(function, pl.NetworkPlayer, Inicio);
}
}
}
}
Last edited: