Merksk8

calling client-side functions

Recommended Posts

Hello,

I started some days ago scripting a new server, lot of information is missing or need to be found in some external examples, but anyway, the most part I found it. But when started with clientside, I can't understand the way it works.

So then, from JS called from HTML, you need to use mp.triggers(). Ok.

If you call from (for example) client package "Test", file "Index.js", you can use mp.game.player object to access to the local player that triggered that event, ok.

But the weird thing is, and my questions are :

1. In the Wiki, there are two sections on player commands, the top one (related with entities) and the bottom one ( related with ?? ), this last ones ( bottom) works well with mp.game.player, but the other ones I can't get them working ( apparently doesn't exists). So the first question is, how to access the first ones.

2. The second one is, if I want to sync a local even, for example an animation, from each local clientside player, do I have to do like this?? :

/* Event call from server to all players */
mp.events.add('playerStartedAnim', function(targetPlayer, animation1, animation2){
	/* loop through players until find the one that wants to play animation */
	mp.players.forEach(function(pl){
		if(pl.name == targetPlayer){
			/* play animation ??*/
			pl.taskPlayAnim(animation1,animation2,8.0,1,-1,49,1.0,false,false,false);
			
		}
    });
});

Well, above code is not working because the question 1, so take it like an example for what I'm asking.

 

Thanks a lot for reading and thanks for advance.

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

  • Recently Browsing   0 members

    No registered users viewing this page.