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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.