gta.createObject: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 14: Line 14:
     object.heading = 1.5922862291336
     object.heading = 1.5922862291336
end
end
|exampleJSSS = addCommandHandler("object", (command, text, client) =>
{
    if (!client.player)
    {
        messageClient('You are not spawned!', client);
        return;
    }
let model = text.length > 0 ? parseInt(text) : 583;
    if (isNaN(model))
    {
        messageClient('Invalid model ID: ' + text, client);
        return;
    }
   
let object = gta.createObject(model, client.player.position.addPolar(15.0, client.player.heading + (Math.PI/2.0)));
    object.heading = client.player.heading;
message(client.name + ' added an object with model ID ' + model, COLOUR_GREEN)
});
|exampleJSCS = addCommandHandler("object", (command, text) =>
{
    if (!localClient.player)
    {
        message('You are not spawned!');
        return;
    }
let model = text.length > 0 ? parseInt(text) : 583;
    if (isNaN(model))
    {
        message('Invalid model ID: ' + text);
        return;
    }
let object = gta.createObject(model, localPlayer.position.addPolar(15.0, localPlayer.heading + (Math.PI/2.0)));
    object.heading = localPlayer.heading;
message('You added an object with model ID ' + model, COLOUR_GREEN)
});
}}
}}
7,072

edits

Navigation menu