Sign in to follow this  
Mariusz

C# client-side event problem

Recommended Posts

Hi.

I want to get something because I dont know have I set up everything right. I have to say I have no idea why it is not compiling. I feel stupid already (I spent few hours on it). I know how to do it in js client side, but no result in c# client side. What am I missing ? Can I get event based little bite of code that is working for c# client-side that I could experiment with ? Hopeless here. Thanks.

using System;
using RAGE;

namespace RageMpRoleplayClient
{
    public class MainClient
    {
		Events.OnPlayerJoin += OnPlayerJoin;
		public void OnPlayerJoin(RAGE.Elements.Player player)
		{
   			RAGE.Chat.Output($"Player {player.Name} has joined");
		}
	}
}

 

Share this post


Link to post
Share on other sites

Found working example.

using System;
using System.Collections.Generic;
using System.Text;
using RAGE;
using RAGE.Ui;


namespace RageMpRoleplayClient
{
    public class TickEvent:RAGE.Events.Script
    {
        public TickEvent()
        {
            RAGE.Events.Tick = Tick;
        }

        private void Tick(List<RAGE.Events.TickNametagData> nametags)
        {
            RAGE.Chat.Show(true);
            RAGE.Chat.Output("Working");
        }
    }
}

 

Share this post


Link to post
Share on other sites

FWIW, everywhere I've seen a similar example, it was Rage.Events.Tick += Tick, which I assume stops you from overwriting every other resource's tick handler.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.