[AJUDA] /pm
#1

Bom eu peguei um /pm de um filterscript, aн coloquei no meu gamemode.

Erros:

Код:
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(602) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(604) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(604) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(606) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(611) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(612) : error 017: undefined symbol "gMessage"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(612) : error 017: undefined symbol "strrest"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(614) : error 017: undefined symbol "gMessage"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(624) : error 017: undefined symbol "iName"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(624) : error 017: undefined symbol "iName"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(624) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(624) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


12 Errors.
Linhas...

pawn Код:
//--------SISTEMA DE MENSAGENS PRIVADAS
        if(strcmp("/pm", cmd, true) == 0)
    {
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp) || strlen(tmp) > 5) {
            SendClientMessage(playerid,COLOR_RED,"Digite /pm [id] [texto].");
            return 1;
        }

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

        if(!strlen(gMessage)) {
            SendClientMessage(playerid,COLOR_RED,"Digite /pm [id] [texto].");
            return 1;
        }

        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,COLOR_RED,"Esse ID nгo existe!");
        }

        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),"• {FF0000}Mensagem Privada enviada para {FFFF00}%s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,COLOR_YELLOW,Message);
            format(Message,sizeof(Message),"• {FF0000}Mensagem Privada de {FFFF00}%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_RED,"Vocк nгo pode mandar Mensagens Privadas para vocк mesmo!");
        }
        return 1;
    }
Ajuda aк galera, valeus...
Reply
#2

Talvez isso resolva.

Coloque no topo do seu OnPlayerCommandText
pawn Код:
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);
Espero ter ajudado.
Reply
#3

Код:
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(63) : error 010: invalid function or declaration
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(614) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(614) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(622) : error 017: undefined symbol "strrest"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(622) : error 033: array must be indexed (variable "gMessage")
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(810) : warning 219: local variable "cmd" shadows a variable at a preceding level
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(995) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#4

Por favor as linhas...
Reply
#5

pawn Код:
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
cmd = strtok(cmdtext, idx);
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#6

pawn Код:
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(28) : error 010: invalid function or declaration
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(606) : error 017: undefined symbol "strrest"
C:\Documents and Settings\Luciano\Desktop\Gaming of Life - Gang War\gamemodes\glgw.pwn(606) : error 033: array must be indexed (variable "gMessage")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
pawn Код:
28. cmd = strtok(cmdtext, idx);
606.         gMessage = strrest(cmdtext,idx);
Reply
#7

Arrumei pra vocк, basta colar tudo abaixo no seu Pawno e compilar

pawn Код:
#include <a_samp>

public OnFilterScriptInit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/pm", cmdtext, true, 3) == 0)
    {
        new ID[258], Mensagem[258];
        ID = KcmD(1, cmdtext);
        Mensagem = KcmD(2, cmdtext);
        if(!strlen(ID))
        {
            SendClientMessage(playerid,0xFF6347AA,"Digite /pm [id] [texto].");
            return 1;
        }
        if(!strlen(Mensagem))
        {
            SendClientMessage(playerid,0xFF6347AA,"Digite /pm [id] [texto].");
            return 1;
        }
        new id = strval(ID);
        if(!IsPlayerConnected(id))
        {
            SendClientMessage(playerid,0xFF6347AA,"Esse ID nгo existe!");
            return 1;
        }
        if(playerid != id)
        {
            new iName[MAX_PLAYER_NAME], nName[MAX_PLAYER_NAME], Message[100];
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,nName,sizeof(nName));
            format(Message,sizeof(Message),"• {FF0000}Mensagem Privada enviada para {FFFF00}%s(%d): %s",iName,id,Mensagem);
            SendClientMessage(playerid,0xFFFF00AA,Message);
            format(Message,sizeof(Message),"• {FF0000}Mensagem Privada de {FFFF00}%s(%d): %s",nName,playerid,Mensagem);
            SendClientMessage(id,0xFFFF00AA,Message);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
            printf("PM: %s",Message);
            return 1;
        }
        else
        {
            SendClientMessage(playerid,0xFF6347AA,"Vocк nгo pode mandar Mensagens Privadas para vocк mesmo!");
        }
        return 1;
    }
    return 0;
}


stock KcmD(param, cmdtext[])
{
    new string[128], pos, var;
    format(string, sizeof(string), "%s ", cmdtext);

    while((pos = strfind(string, " ", true)) != -1)
    {
        if(var == param) return string;
        var++;

        strdel(string, 0, pos + 1);
        if(strcmp(string, " ", true, pos) == 0) goto end;
    }

end:
    string[0] = '\0';
    return string;
}


public OnFilterScriptExit()
{
    return 1;
}

Espero ter ajudado
Reply
#8

sу botar:
pawn Код:
#include "../includes/gcommon"// ACho que o nome йeste.
Reply
#9

Nem precisa peguei 1 negуcio aqui mais ou menos igual ao do rjjj.
Valeus.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)