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

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.


  • Recently Browsing   0 members

    No registered users viewing this page.