object
#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


Messages In This Thread
object - by TuNiSiAnO1 - 05.03.2015, 13:32
AW: object - by Kaliber - 05.03.2015, 13:35
Re: object - by CalvinC - 05.03.2015, 13:43

Forum Jump:


Users browsing this thread: 1 Guest(s)