PDA

View Full Version : object


TuNiSiAnO1
05/03/2015, 01:32 PM
hello how to create object with id so when i create object with command it got his own id

example object id: 10 Model id: 19510 etc...

Kaliber
05/03/2015, 01:35 PM
hello how to create object with id so when i create object with command it got his own id

example object id: 10 Model id: 19510 etc...
The objectid is generated automatically...you can not really controll this.

For more information, read: http://wiki.sa-mp.com/wiki/CreateObject

CalvinC
05/03/2015, 01:43 PM
Use sscanf with a switch to detect what number he wrote, and create objects accordingly.
CMD:object(playerid, params[]) // zcmd command, change after what you use
{
new objectid; // Declares a variable called "objectid"
if(sscanf(params, "i", objectid)) return SendClientMessage( ... ); // If the player writes something after /object, like /object 10, it'll store what he wrote in "objectid"
// Otherwise if he didn't write anything, or wrote something that's not a number (since we defined "i" - integer) will return the message and stop the cmd

switch(objectid) // Checks the value of "objectid", AKA what number he wrote
{
case 10: CreateObject(19510, ... ); // If the number he wrote was 10, it will create object id 19510
// Likewise you can create more "case"'s to check what number he wrote, and create different objects
default: return SendClientMessage( ... ); // If the number he wrote isn't in the switch, it'll return and send him a msg
}
return 1;
}