object
#1

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...
Reply
#2

Quote:
Originally Posted by TuNiSiAnO1
Посмотреть сообщение
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: https://sampwiki.blast.hk/wiki/CreateObject
Reply
#3

Use sscanf with a switch to detect what number he wrote, and create objects accordingly.
pawn Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)