SA-MP Forums Archive
object - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: object (/showthread.php?tid=566354)



object - TuNiSiAnO1 - 05.03.2015

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...


AW: object - Kaliber - 05.03.2015

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


Re: object - CalvinC - 05.03.2015

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;
}