How i change from scratch to ZCMD ?
#10

Make sure you have the ZCMD include (if not, download it from the SA:MP forums).
Then you can simply do this:

pawn Код:
#include <zcmd>

COMMAND:creategarage(playerid, params[])
    {
            if(PlayerInfo[playerid][pAdmin] >= 99999)
        {
            tmp = strtok(cmdtext, idx);
            if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]");
            new price = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]");
            new size = strval(tmp);
            if (size < 1 || size > 3) return SendClientMessage(playerid, GREY, "Invalid size.");
            new location[32];
            new Float:x, Float:y, Float:z;
            new id = GetAvailableID(TYPE_GARAGE);
            if (id == -1) return SendClientMessage(playerid, GREY, "    Garages are at their maximum. Cannot continue.");
            GarageIDTaken[id] = 1;
            GetPlayerPos(playerid, x, y, z);
            GarageInfo[id][GarageEnterX] = x;
            GarageInfo[id][GarageEnterY] = y;
            GarageInfo[id][GarageEnterZ] = z;
            GarageInfo[id][GaragePickup] = CreateDynamicPickup(1239, 23, x, y, z);
            GarageInfo[id][GarageOwned] = 0;
            GarageInfo[id][GaragePrice] = price;
            GarageInfo[id][GarageVirtual] = id;
            GarageInfo[id][GarageInsideX] = 0;
            GarageInfo[id][GarageInsideY] = 0;
            GarageInfo[id][GarageInsideZ] = 0;
            GarageInfo[id][GarageInsideA] = 0;
            GarageInfo[id][GarageExitX] = 0;
            GarageInfo[id][GarageExitY] = 0;
            GarageInfo[id][GarageExitZ] = 0;
            GarageInfo[id][GarageExitA] = 0;
            strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255);
            GarageInfo[id][GarageSize] = 0;
            Get2DZone(location, MAX_ZONE_NAME,  x, y, z);
            format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}None\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", location);
            GarageInfo[id][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, x, y, z, 10.0, 0);
            SendClientMessage(playerid, LIGHTBLUE, "Garage created, now use /editgarage [id] to edit it.");
            format(string, sizeof(string), "The garage ID is: %d (you can use this id to /editgarage with it).", id);
            SendClientMessage(playerid, LIGHTBLUE, string);
            SetGarageSize(id, size);
            SaveGarages();
            garages++;
            return 1;
        }
        else
        {
            SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
        }
        return 1;
    }
To summarize, to convert from string-compare (strcmp) to ZCMD, just follow this:

pawn Код:
COMMAND:yourcmdhere(playerid, params[])
    {
        //yourcommand
    }
   
    return 1;
Reply


Messages In This Thread
How i change from scratch to ZCMD ? - by botak - 28.12.2013, 08:19
Re: How i change from scratch to ZCMD ? - by iZN - 28.12.2013, 08:21
Re: How i change from scratch to ZCMD ? - by botak - 28.12.2013, 08:24
Re: How i change from scratch to ZCMD ? - by botak - 28.12.2013, 08:56
Re: How i change from scratch to ZCMD ? - by PrivatioBoni - 28.12.2013, 09:17
Re: How i change from scratch to ZCMD ? - by botak - 28.12.2013, 09:32
Re: How i change from scratch to ZCMD ? - by PrivatioBoni - 28.12.2013, 09:51
Re: How i change from scratch to ZCMD ? - by Excelize - 28.12.2013, 10:17
Re: How i change from scratch to ZCMD ? - by botak - 28.12.2013, 10:19
Re: How i change from scratch to ZCMD ? - by Twizted - 28.12.2013, 10:19

Forum Jump:


Users browsing this thread: 1 Guest(s)