convert dcmd to zcmd..
#1

Could someone convert this to zcmd? (Not sure if it's zcmd or what.. it should be like command:weather(playerid,params)
Please.

Code:
dcmd_w(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /w [ID] or /weather [ID]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_WEAT_ID || idx > MAX_WEAT_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF, "{0xFF4040FF}[ERROR]{0xFFFFFFFF}: Invalid WEATHERID");
            return true;
        }

        SetPlayerWeather(playerid, idx);

        format(iString, 128, "Weather changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}

dcmd_weather(playerid, params[])
        return dcmd_w(playerid, params);
        
        
        
dcmd_t(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /t [NUM] or /time [NUM]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_TIME_ID || idx > MAX_TIME_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF,  "{0xFF4040FF}[ERROR]{0xFFFFFFFF} Invalid HOUR");
            return true;
        }

        SetPlayerTime(playerid, idx, 0)

        format(iString, 128, "Time changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}

dcmd_time(playerid, params[])
        return dcmd_t(playerid, params);
Reply
#2

dcmd_w(playerid, params[])
change this to this--
CMD:w(playerid, params[])
and like this so on for others
Reply
#3

Do what BroZeus said but also remove OnPlayerCommandText
Reply
#4

pawn Code:
CMD:w(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /w [ID] or /weather [ID]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_WEAT_ID || idx > MAX_WEAT_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF, "{0xFF4040FF}[ERROR]{0xFFFFFFFF}: Invalid WEATHERID");
            return true;
        }

        SetPlayerWeather(playerid, idx);

        format(iString, 128, "Weather changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}
CMD:weather(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /w [ID] or /weather [ID]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_WEAT_ID || idx > MAX_WEAT_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF, "{0xFF4040FF}[ERROR]{0xFFFFFFFF}: Invalid WEATHERID");
            return true;
        }

        SetPlayerWeather(playerid, idx);

        format(iString, 128, "Weather changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}
       
       
CMD:t(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /t [NUM] or /time [NUM]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_TIME_ID || idx > MAX_TIME_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF,  "{0xFF4040FF}[ERROR]{0xFFFFFFFF} Invalid HOUR");
            return true;
        }

        SetPlayerTime(playerid, idx, 0)

        format(iString, 128, "Time changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}
CMD:time(playerid, params[]) {
        new idx, iString[128];
        iString = strtok(params, idx);

        if (!strlen(iString)) {
            SendClientMessage(playerid, 0xFFFFFFFF, "[USAGE]: /t [NUM] or /time [NUM]");
            return true;
        }

        idx = strval(iString);

        if (idx < MIN_TIME_ID || idx > MAX_TIME_ID) {
            SendClientMessage(playerid, 0xFFFFFFFF,  "{0xFF4040FF}[ERROR]{0xFFFFFFFF} Invalid HOUR");
            return true;
        }

        SetPlayerTime(playerid, idx, 0)

        format(iString, 128, "Time changed to %d", idx);
        SendClientMessage(playerid, 0xFFFFFFFF, iString);

        return true;
}
+rep me if I helped.
Reply
#5

Thank you very much guys!
Reply
#6

I don't think giving ready code for + rep is a good idea, And a little clucker's rep doesn't count.
Read this Click
Reply
#7

inshal, you're doing the alternative command system wrong.


Instead of copying the entire command, you can simply do;
pawn Code:
CMD:weather(playerid, params[])
    {
        return cmd_w(playerid, params[]);
    }
Reply
#8

Quote:
Originally Posted by sammp
View Post
inshal, you're doing the alternative command system wrong.


Instead of copying the entire command, you can simply do;
pawn Code:
CMD:weather(playerid, params[])
    {
        return cmd_w(playerid, params[]);
    }
or
pawn Code:
CMD:weather(playerid,params[]) return cmd_w(playerid,params);
not params[]
and You can use ctrl + h and in search for type dcmd_ and replace with CMD: or COMMAND:
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)