Is this possible? +REP
#1

Is it possible converting this to ZCMD?:

pawn Код:
if (strcmp("/copmessage", cmdtext, true, 11) == 0)
    {
        if(strlen(cmdtext) <= 11)
        {
            SendClientMessage(playerid,red,"USAGE: /copmessage (message)  -  Enter A Valid Cop Message.");
            return 1;
        }
        else
        {
            new output[255];
            new pname[24];
            GetPlayerName(playerid, pname, 24);
            strmid(output,cmdtext,12,strlen(cmdtext));
            format(string, sizeof(string), "COP MESSAGE: %s(%d) %s",pname,playerid,output);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(Team == TEAM_COP)
                {
                    format(string, sizeof(string), "COP MESSAGE: %s (%d): %s",pname,playerid,output);
                    MessageToCops(blue,string);
                    //SendClientMessage(i,blue,string);
                    return 1;
                }
                else
                {
                    if(isnull(cmdtext)) return SendClientMessage(playerid,red,"You Are Not A Cop. You May Not Use The Cop Radio Device.");
                    SendClientMessage(playerid,red,"You Are Not A Cop. You May Not Use The Cop Radio Device.");
                    return 1;
                }
            }
        }
    }
I have tried but no luck. Here is what I did:

pawn Код:
CMD:cm(playerid, params[])
    {
        if(strlen(cmdtext) <= 11)
        {
            SendClientMessage(playerid,red,"USAGE: /cm (message) - sends a message out to all Cops.");
            return 1;
        }
        else
        {
            new output[255];
            new pname[24];
            GetPlayerName(playerid, pname, 24);
            strmid(output,cmdtext,12,strlen(cmdtext));
            format(string, sizeof(string), "[COP MESSAGE] %s(%d) %s",pname,playerid,output);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(Team == TEAM_COP)
                {
                    format(string, sizeof(string), "[COP MESSAGE] %s (%d): %s",pname,playerid,output);
                    MessageToCops(blue,string);
                    //SendClientMessage(i,blue,string);
                    return 1;
                }
                else
                {
                    if(isnull(cmdtext)) return SendClientMessage(playerid,red,"You Are Not A Cop. You Cannot Use The Cop Radio.");
                    SendClientMessage(playerid,red,"You Are Not A Cop. You Cannot Use The Cop Radio.");
                    return 1;
                }
            }
        }
    }
Or can someone tell me what I'm doing wrong?
Reply
#2

What is the problem ?
Reply
#3

It will not compile. It comes up with these errors:

Код:
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8872) : error 017: undefined symbol "TEAM_COP"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8880) : error 017: undefined symbol "cmdtext"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8882) : error 017: undefined symbol "red"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8890) : error 017: undefined symbol "cmdtext"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8891) : error 017: undefined symbol "string"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8891) : error 017: undefined symbol "string"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8891) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(8891) : fatal error 107: too many error messages on one line
Reply
#4

Deleted
Reply
#5

as its showen in errors you forget many things for ex.

you forget to add

for cop error you should define the team #define TEAM_COP 1 < top of script
for cmdtext error new cmdtext[256]; < under OnPlayerCommandText
for string error new string[128]; < into command
for the color red error use #define red 0xFF000000 < top of script
Reply
#6

You are not using ZCMD correctly. Instead of cmdtext, use
Код:
params
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)