Jump to content

Client Event Trigger


ihatetn931

Recommended Posts

This is prolly a stupid question but how do you use csharp

onClientEventTrigger

these days, I've searched for several hours and gave up now a few days later here I am trying to figure it out again.

Edited by ihatetn931
typos
Link to comment
Share on other sites

Serverside:

NAPI.ClientEvent.TriggerClientEvent(client, "name_of_the_event");

Clientside:

// Constructor of some class.
public MyClass()
{
     RAGE.Events.Add("name_of_the_event", eventHandlerFunction); // eventHandlerFunction is just a placeholder name, you name it
     RAGE.Events.Add("name_another_event", anotherEventHandler);
}

public void eventHanderFunction(object[] args)
{
 	/*
     *	CODE TO EXECUTE WHEN THE EVENT GETS TRIGGERED
     */
  	Events.CallRemote("name_of_server_event"); // This is the way you trigger server events, from clientside
}

 

Example of Remote event (Called from client)

[RemoteEvent("name_of_server_event")]
public void functionHandlerName(Client client, int sex)
{
  	/*
	*	CODE TO EXECUTE ON TRIGGER
	*/
}

 

Hope this helps.

There are tutorials on this forum about this already ;)

Edited by Soul
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...