Jump to content

keker code /veh not working


Recommended Posts

Posted

Hello. I use keker code. First call /veh vehicle is created and work. When i use command again destroy is called, but vehicle stay and new vehicle not spawned. No errors in console. I dont know what happend. I have not edited the code.

  "veh": (player, args) =>
	{
        if(player.admin < 6) return player.outputChatBox("<span style='color:#ff2d00'>(!) Nu esti administrator!");
        if (typeof args[0] == 'undefined') return player.outputChatBox("<b style='color:#999'>(Syntax)</b> /veh [name]");
        if(!args[0].length) return player.outputChatBox("<b style='color:#999'>(Syntax)</b> /veh [name]");
        
		var pos = player.position;
		pos.x += 2.0;
			
		if(player.veh) {
			player.veh.destroy();
			console.log("destroy");
		} else {
			console.log("nqma");
		}
		

		
		player.veh = mp.vehicles.new(mp.joaat(args[0]), pos);
		player.veh.dimension = player.dimension;
		
		console.log("create");
		console.log(player.veh.engine);
		

        
        player.outputChatBox("You've spawn a " + args[0]);
	}

 

Posted (edited)

Use this:

mp.events.addCommand('v',function(player,args,arg1){
	if(player.admin>=6&&typeof arg1!='undefined') {
      mp.vehicles.new(mp.joaat(arg1),player.position.x+2,player.position.y,player.position.z+2);
      player.outputChatBox('You\'ve spawn a '+arg1);
	}
});

 

Oh, yeah! Error was happend because player.veh only for read!

Use other variable.

Edited by kostya_nad

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...