COnvert to zcmd
#1

Hello world i want to convert to zcmd anybody can help me please?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
        new sendername[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
        new cmd[256];
        new tmp[256];
        new idx;
        cmd = strtok(cmdtext, idx);
        if(strcmp(cmd, "/referee", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(!IsPlayerAdmin(playerid))
                {
                SendClientMessage(playerid, COLOR_WHITE, "You are not logged into RCON");
                return 1;
                }
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /referee [playerid/PartOfName]");
                                return 1;
                        }
                        new para1;
                        para1 = ReturnUser(tmp);
                        tmp = strtok(cmdtext, idx);
            if(IsPlayerConnected(para1))
                            {
                                if(para1 != INVALID_PLAYER_ID)
                                {
                                                GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                                arbitro[para1] = 1;
                                                printf("%s chooses %s as referee.", sendername, giveplayer);
                                                format(string, sizeof(string), "   %s chooses you as referee", sendername);
                                                SendClientMessage(para1, COLOR_WHITE, string);
                                                format(string, sizeof(string), "   You choose %s as referee.", giveplayer);
                                                SendClientMessage(playerid, COLOR_WHITE, string);
                                                format(string, sizeof(string), " %s is the referee for the next match! Go to the stadium!", giveplayer);
                                                SendClientMessageToAll(COLOR_GROVE, string);
                                                skin[para1] = GetPlayerSkin(para1);
                                                SetPlayerSkin(para1, 72);
                                        }
                                }
                }
                return 1;
        }

        if(strcmp(cmd, "/rcmds", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        if(arbitro[playerid] == 1)
        {
        format(string, sizeof(string), "%s\n%s\nAnnounce\nStuart\nStart Match\nBall at centre\nBall here\nFire\nGoal\nStop Game\nEnd Match\nCoin", squadra1, squadra2);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Referee Commands", string, "Select", "Exit");
        }
        }return 1;
        }
        return 0;
}
Reply
#2

pawn Код:
#include <zcmd>

//try this
new string[256];
        new sendername[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
        CMD:referee(playerid,params[])
        {
            if(IsPlayerConnected(playerid))
            {
                if(!IsPlayerAdmin(playerid))
                {
                SendClientMessage(playerid, COLOR_WHITE, "You are not logged into RCON");
                return 1;
                }
                        if ( sscanf( params, "us[128]", giveplayer ) )
                        {
                                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /referee [playerid/PartOfName]");
                                return 1;
                        }
                        new para1;
                        para1 = ReturnUser(tmp);
                       if(IsPlayerConnected(para1))
                        {
                                if(para1 != INVALID_PLAYER_ID)
                                {
                                                GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                                arbitro[para1] = 1;
                                                printf("%s chooses %s as referee.", sendername, giveplayer);
                                                format(string, sizeof(string), "   %s chooses you as referee", sendername);
                                                SendClientMessage(para1, COLOR_WHITE, string);
                                                format(string, sizeof(string), "   You choose %s as referee.", giveplayer);
                                                SendClientMessage(playerid, COLOR_WHITE, string);
                                                format(string, sizeof(string), " %s is the referee for the next match! Go to the stadium!", giveplayer);
                                                SendClientMessageToAll(COLOR_GROVE, string);
                                                skin[para1] = GetPlayerSkin(para1);
                                                SetPlayerSkin(para1, 72);
                                        }
                                }
                }
                return 1;
        }

      CMD:rcmds(playerid,params[])
    {
        if(IsPlayerConnected(playerid))
        {
        if(arbitro[playerid] == 1)
        {
        format(string, sizeof(string), "%s\n%s\nAnnounce\nStuart\nStart Match\nBall at centre\nBall here\nFire\nGoal\nStop Game\nEnd Match\nCoin", squadra1, squadra2);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Referee Commands", string, "Select", "Exit");
        }
        }return 1;
        }
        return 0;
}
Reply
#3

C:\Users\Marian\Desktop\Gamemode-uri\Quit GF-RP\filterscripts\football.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\Marian\Desktop\Gamemode-uri\Quit GF-RP\filterscripts\football.pwn(612) : error 017: undefined symbol "cmd_referee"
C:\Users\Marian\Desktop\Gamemode-uri\Quit GF-RP\filterscripts\football.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\Marian\Desktop\Gamemode-uri\Quit GF-RP\filterscripts\football.pwn(612) : fatal error 107: too many error messages on on
Reply


Forum Jump:


Users browsing this thread: