Help me converting to ZCMD :p
#1

hi guys i need to convert this to ZCMD.. im not lazy but im afraid if i will make it all go wrong..
here is the CMDS:
pawn Код:
if(IsPlayerAdmin(playerid))
    {
        if(!strcmp("/gotomb", cmdtext, true))
        {
            SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
            return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}money bag");
        }
        if(!strcmp("/startmb", cmdtext, true)) return MoneyBag();
        if(!strcmp("/togglemb", cmdtext, true))
        {
            if(Timer[0] == 0)
            {
                KillTimer(Timer[1]);
                Timer[0] = 1;
                SendClientMessage(playerid, -1, "Money bag turned {FF0000} off!");
                return 1;
            }
            if(Timer[0] == 1)
            {
                Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
                Timer[0] = 0;
                SendClientMessage(playerid, -1, "Money bag turned {33FF66} on!");
                return 1;
            }
            return 1;
        }

    }
    if(!strcmp("/moneybag", cmdtext, true))
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
Reply
#2

See this? This is your command using STRING COMPARE (STRCMP)
pawn Код:
if(!strcmp("/moneybag", cmdtext, true))
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
and here's a ZCMD example of your command:
pawn Код:
CMD:moneybag(playerid, params[])
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
Do the rest on your own. It's just changing a one line.
Reply
#3

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
See this? This is your command using STRING COMPARE (STRCMP)
pawn Код:
if(!strcmp("/moneybag", cmdtext, true))
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
and here's a ZCMD example of your command:
pawn Код:
CMD:moneybag(playerid, params[])
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
Do the rest on your own. It's just changing a one line.
Bro, thanks for your help but i know that one i cant convert the upper one with the Timer/Timekiller idk how?
if u were nice , please help me
Any help apreciated!
Reply
#4

Quote:
Originally Posted by Mzake
Посмотреть сообщение
Bro, thanks for your help but i know that one i cant convert the upper one with the Timer/Timekiller idk how?
if u were nice , please help me
Any help apreciated!
The timer won't affect it, just leave everything else alone inside of the command brackets.

pawn Код:
if(IsPlayerAdmin(playerid))
    {
       CMD:gotomb(playerid, params[])
        {
            SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
            return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}money bag");
        }
        CMD:startmb(playerid, params[]) return MoneyBag();
        CMD:togglemb(playerid, params[])
        {
            if(Timer[0] == 0)
            {
                KillTimer(Timer[1]);
                Timer[0] = 1;
                SendClientMessage(playerid, -1, "Money bag turned {FF0000} off!");
                return 1;
            }
            if(Timer[0] == 1)
            {
                Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
                Timer[0] = 0;
                SendClientMessage(playerid, -1, "Money bag turned {33FF66} on!");
                return 1;
            }
            return 1;
        }

    }
    CMD:moneybag(playerid, params[])
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
Reply
#5

Removed, as there are others in the pawn code I posted which I CBF to change aswell.
Reply
#6

Quote:
Originally Posted by rymax99
Посмотреть сообщение
The timer won't affect it, just leave everything else alone inside of the command brackets.

pawn Код:
if(IsPlayerAdmin(playerid))
    {
       CMD:gotomb(playerid, params[])
        {
            SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
            return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}money bag");
        }
        CMD:startmb(playerid, params[]) return MoneyBag();
        CMD:togglemb(playerid, params[])
        {
            if(Timer[0] == 0)
            {
                KillTimer(Timer[1]);
                Timer[0] = 1;
                SendClientMessage(playerid, -1, "Money bag turned {FF0000} off!");
                return 1;
            }
            if(Timer[0] == 1)
            {
                Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
                Timer[0] = 0;
                SendClientMessage(playerid, -1, "Money bag turned {33FF66} on!");
                return 1;
            }
            return 1;
        }

    }
    CMD:moneybag(playerid, params[])
    {
        new string[150];
        if(!MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!", MoneyBagLocation);
        if(MoneyBagFound) format(string, sizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return SendClientMessage(playerid, -1, string);
    }
Well better then IceCube's 8 Errors :
pawn Код:
C:\Users\DEMSOFT\Desktop\my server 3z 2\gamemodes\xF.pwn(7498) : error 010: invalid function or declaration
C:\Users\DEMSOFT\Desktop\my server 3z 2\gamemodes\xF.pwn(7525) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

2nd closing brace under return 1?... Delete it. (3rd command I think).

ZCMD, also can't be placed inside an if function BTW. This also means you need to check if a player is an admin for EVERY admin command.

Also, you had 8 errors as I couldn't read your code, the commands were right on top of each other. There were no spaces, I realised after and removed my post due to being too lazy to fix it.
Reply
#8

We can't tell which line is what error. And yeah, as said, you're gonna need to check if the player is an admin inside every command. You might want to add a stock for that if you're gonna be repeatedly replicating it.
Reply
#9

Well guys what can i say? thank you , problem fixed, ITS TESTING TIME!
if there is any problem i will tell ya ! thnx again
Reply
#10

Quote:
Originally Posted by Mzake
Посмотреть сообщение
hi guys i need to convert this to ZCMD.. im not lazy but im afraid if i will make it all go wrong..
If you dont do stuff yourself because youre afraid you might make mistakes, you wont ever learn anything.
Learning something is ALL about making mistakes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)