client.player.position

Started by tucson913, December 21, 2024, 11:05:50 AM

Previous topic - Next topic

tucson913

Hi all!

I have problem with the player position.

I wrote a simple vehicle spawn command and I get this error message:
QuoteTypeError: client.player is null

The client.player exists only on client side? Or how can I get the player position?
Thank you!

Code:
addEventHandler('OnPlayerCommand', (event, client, command, parameters) => {

    console.log(`(Command) ${client.name} has used the command '/${command} ${parameters}'.`);
   
      switch(command){
        case "v":
            case "veh":
                case "vehicle":
                    var veh = gta.createVehicle(parseInt(parameters), client.player.position);
                    addToWorld(veh);
                    client.player.warpIntoVehicle(veh, 0);
        break;

        default:
            message("UNK CMD");
        break;
      }
});