[AJUDA] Comando /pm [ID] Mensagem
#1

Eu peguei esse code em um GM velho, ai eu fui por no meu deu esses erros

Код:
.pwn(2549) : error 021: symbol already defined: "OnPlayerText"
.pwn(2558) : error 017: undefined symbol "cmdtext"
.pwn(2563) : error 017: undefined symbol "cmdtext"
.pwn(2571) : error 017: undefined symbol "strrest"
.pwn(2571) : error 033: array must be indexed (variable "gMessage")
.pwn(2601) : error 030: compound statement not closed at the end of file (started at line 2550)
Pawn compiler 3.2.3664              Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Comando:
pawn Код:
public OnPlayerText(playerid, text[])
{
new cmd[256];
    new    tmp[256];
    new Message[256];
    new gMessage[256];
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
    new    idx;

    cmd = strtok(cmdtext, idx);

    // PM Command
    if(strcmp("/pm", cmd, true) == 0)
    {
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp) || strlen(tmp) > 5) {
            SendClientMessage(playerid,COLOR_YELLOW,"[INFO]: /pm (id) (mensagem)");
            return 1;
        }

        new id = strval(tmp);
        gMessage = strrest(cmdtext,idx);

        if(!strlen(gMessage)) {
            SendClientMessage(playerid,COLOR_YELLOW,"[INFO]: /pm (id) (mensagem)");
            return 1;
        }

        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,COLOR_YELLOW,"[INFO] Player nгo conectado!");
            return 1;
        }

        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,COLOR_YELLOW,Message);
            format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
            SendClientMessage(id,COLOR_YELLOW,Message);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);

            printf("PM: %s",Message);

        }
        else {
            SendClientMessage(playerid,COLOR_YELLOW,"Vocк nгo pode mandar PM para vocк mesmo");
        }
        return 1;
    }
alguem conssegue arrumar ?
Reply
#2

1: pq vc colocou isso no OnPlayerText? O certo й no OnPlayerCommandText
2: tem duas public OnPlayerText. Move esse /PM pro OnPlayerCommandText e remove a OnPlayerText onde tava ela
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)