dtg

event playerCreateWaypoint register after can not call

Recommended Posts

mp.events.add("playerCreateWaypoint",function(player,position){
    player_location = position;
    mp.game.graphics.notify(`Press ~r~G ~w~if you want teleport to the waypoint.`);
});

call in client_resources

 

Edited by dtg

Share this post


Link to post
Share on other sites
function(player,position){

player ?
This is a client script ? For client you don't have player as pattern
And make sure that you using call arguments in array.

See this exemple: 

/* ServerSide Script*/
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
function playerEnterColshapeHandler(player, shape) {
  if(shape == someColShape) {
    console.log(`${player.name} entered the colshape`);
    //ZancudoBunker
    player.call("playerCreateWaypoint", [-3058.714, 3329.19, 12.5844])
    /* I can only use numbers, string or boolean. 
    If I need send object to client I have to convert in JSON format
    */
  }
}

mp.events.add("playerEnterColshape", playerEnterColshapeHandler);
/* ClientSide script*/
var player_location = null;
mp.events.add("playerCreateWaypoint",function(x, y, z) {
    player_location = new mp.Vector3(x, y, z);
    mp.game.graphics.notify(`Press ~r~G ~w~if you want teleport to the waypoint.`);
});
//Get keycode here -> http://keycode.info/
mp.keys.bind(71/*G*/, true, function() {
	if(player_location !== null)
    {      
      mp.players.local.position = player_location;
      player_location = null;
    }
});



https://wiki.rage.mp/index.php?title=Player::call

 

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.