addToWorld: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
m (Mex moved page AddToWorld to addToWorld)
 
No edit summary
 
Line 5: Line 5:
|parameters = Element element
|parameters = Element element
|parameter1 = Element element The element to add to the game.
|parameter1 = Element element The element to add to the game.
|usage = add the element to the game.<br>Currently, this function only needs to be called for elements created server-side, not for elements created client-side
|usage = add the element to the game.<br>This function no longer needs to be called
|returnTypes = void
|returnTypes = void
|returnFail1 = void
|returnFail1 = void

Latest revision as of 01:41, 12 June 2022

Function Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0

void addToWorld(Element element)

The addToWorld function is used to add the element to the game.
This function no longer needs to be called.

Parameters

1) Element element The element to add to the game.

Return

void This function doesn't return a value.

Notes

Examples

Example 1 - JavaScript - Server-Side:

addCommandHandler('vehicle', function(command, parameters, client) {

   if(client.player && parameters.trim() != ) // ensure player is spawned and input text isn't blank
   {
       var model = parseInt(parameters);
       var vehicle = createVehicle(model, client.player.position);
       addToWorld(vehicle); // currently, if the element is created client-side, this line of code isn't needed.
   }

});

Compatibility

  • This function was previously named game.addToWorld in version 1.0.71.

Related

Server Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addToWorld


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addToWorld
icon-iii.png icon-vc.png icon-sa.png gta.findGroundZCoordinate
icon-iii.png icon-vc.png icon-sa.png gta.findRoofZCoordinate
icon-iii.png icon-vc.png icon-sa.png gta.gravity
icon-iii.png icon-vc.png gta.moonSize
icon-iii.png icon-vc.png icon-sa.png icon-iv.png removeFromWorld