AJUDA com bloquear pm
#1

e ae gente,fiz um bloquear pm para se os players nгo quiserem receber pm,basta digitar /bpm


Porem ele nгo funcionou ¬¬

/PM
pawn Код:
new recieverid;
new h, mi, s;
new y1, m, d;
gettime(h,mi,s);
getdate(y1, m, d);
new string[256];
new string5[256];
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[70];
new temp[256];
new iName[70];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);

if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
return 1;
}

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

if(!strlen(gMessage)) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
return 1;
}

if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : ID Errado");
return 1;
}
if(PMBlocked[recieverid] == 1) //aqui estб a parte quando o cara bloqueia o pm dele.
{
SendClientMessage(playerid, 0x00FFFFFF, "[ERRO]: Este player nгo estб querendo receber PM'S no momento!");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),"PM enviado para %s(%d): %s",iName,id,gMessage);
GameTextForPlayer(id, "~w~MENSAGEM ENVIADA", 5000, 5);
SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
format(Message,sizeof(Message),"PM recebido de %s(%d): %s",pName,playerid,gMessage);
GameTextForPlayer(id, "~w~MENSAGEM RECEBIDA", 5000, 5);
SendClientMessage(id,PM_INCOMING_COLOR,Message);
TextDrawHideForPlayer(recieverid, OtrzymalesPM);
TextDrawShowForPlayer(recieverid, OtrzymalesPM);
SetTimerEx("HideTDFromPlayer", 5000, 0, "di", recieverid, _:OtrzymalesPM);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
format(string5, sizeof(string5), "[Data:%d/%d/%d] [Hora:%d:%d:%d] PM de %s para %s: %s",d,m,y1,h,mi,s, pName,iName, gMessage);
PMLog(string5);
format(string5, sizeof(string5), "PM de %s(ID:%d) para %s(ID:%d): %s" , pName, playerid,iName, id, gMessage);
SendPMToAdmins(0x00ffaaFF, string5, 6);
printf("PM: %s",Message);
}else {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"[ERRO]: Vocк nгo pode mandar pm pra vocк mesmo.");
}
return 1;
}
e o comando:

pawn Код:
if(strcmp(cmd, "/bpm", true) == 0)
{
PMBlocked[playerid] = 1;
SendClientMessage(playerid, 0x00FFFFFF, "[INFO]: Recebimento de PM'S Bloqueado com sucesso.");
return 1;
}

if(strcmp(cmd, "/dpm", true) == 0)
{
PMBlocked[playerid] = 0;
SendClientMessage(playerid, 0x00FFFFFF, "[INFO]: Recebimento de PM'S Desbloqueado com sucesso.");
return 1;
}
o tem de errado?
Reply
#2

Troque recieverid por id na verificaзгo que comentou.
Reply
#3

pawn Код:
new recieverid;
new h, mi, s;
new y1, m, d;
gettime(h,mi,s);
getdate(y1, m, d);
new string[128];
new string5[128];
new cmd[128];
new tmp[128];
new Message[128];
new gMessage[128];
new pName[70];
new temp[128];
new iName[70];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/pm", cmd, true) == 0)
{
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp) || strlen(tmp) > 5) {
        SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
        return 1;
    }

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

    if(!strlen(gMessage)) return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");

    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : ID Errado");
    if(PMBlocked[id] == 1) return SendClientMessage(playerid, 0x00FFFFFF, "[ERRO]: Este player nгo estб querendo receber PM'S no momento!");
    {
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),"PM enviado para %s(%d): %s",iName,id,gMessage);
            GameTextForPlayer(id, "~w~MENSAGEM ENVIADA", 5000, 5);
            SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
            format(Message,sizeof(Message),"PM recebido de %s(%d): %s",pName,playerid,gMessage);
            GameTextForPlayer(id, "~w~MENSAGEM RECEBIDA", 5000, 5);
            SendClientMessage(id,PM_INCOMING_COLOR,Message);
            TextDrawHideForPlayer(recieverid, OtrzymalesPM);
            TextDrawShowForPlayer(recieverid, OtrzymalesPM);
            SetTimerEx("HideTDFromPlayer", 5000, 0, "di", recieverid, _:OtrzymalesPM);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
            format(string5, sizeof(string5), "[Data:%d/%d/%d] [Hora:%d:%d:%d] PM de %s para %s: %s",d,m,y1,h,mi,s, pName,iName, gMessage);
            PMLog(string5);
            format(string5, sizeof(string5), "PM de %s(ID:%d) para %s(ID:%d): %s" , pName, playerid,iName, id, gMessage);
            SendPMToAdmins(0x00ffaaFF, string5, 6);
            printf("PM: %s",Message);
        }
        else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"[ERRO]: Vocк nгo pode mandar pm pra vocк mesmo.");
        }
        return 1;
    }
Reply
#4

Quote:
Originally Posted by DraKoN
Посмотреть сообщение
pawn Код:
new recieverid;
new h, mi, s;
new y1, m, d;
gettime(h,mi,s);
getdate(y1, m, d);
new string[128];
new string5[128];
new cmd[128];
new tmp[128];
new Message[128];
new gMessage[128];
new pName[70];
new temp[128];
new iName[70];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/pm", cmd, true) == 0)
{
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp) || strlen(tmp) > 5) {
        SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");
        return 1;
    }

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

    if(!strlen(gMessage)) return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (mensagem)");

    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : ID Errado");
    if(PMBlocked[id] == 1) return SendClientMessage(playerid, 0x00FFFFFF, "[ERRO]: Este player nгo estб querendo receber PM'S no momento!");
    {
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),"PM enviado para %s(%d): %s",iName,id,gMessage);
            GameTextForPlayer(id, "~w~MENSAGEM ENVIADA", 5000, 5);
            SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
            format(Message,sizeof(Message),"PM recebido de %s(%d): %s",pName,playerid,gMessage);
            GameTextForPlayer(id, "~w~MENSAGEM RECEBIDA", 5000, 5);
            SendClientMessage(id,PM_INCOMING_COLOR,Message);
            TextDrawHideForPlayer(recieverid, OtrzymalesPM);
            TextDrawShowForPlayer(recieverid, OtrzymalesPM);
            SetTimerEx("HideTDFromPlayer", 5000, 0, "di", recieverid, _:OtrzymalesPM);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
            format(string5, sizeof(string5), "[Data:%d/%d/%d] [Hora:%d:%d:%d] PM de %s para %s: %s",d,m,y1,h,mi,s, pName,iName, gMessage);
            PMLog(string5);
            format(string5, sizeof(string5), "PM de %s(ID:%d) para %s(ID:%d): %s" , pName, playerid,iName, id, gMessage);
            SendPMToAdmins(0x00ffaaFF, string5, 6);
            printf("PM: %s",Message);
        }
        else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"[ERRO]: Vocк nгo pode mandar pm pra vocк mesmo.");
        }
        return 1;
    }
Deu 3 erros =/

pawn Код:
C:\Users\Marcelo\Desktop\samp03asvr_R7_win32\gamemodes\90.pwn(23251) : error 047: array sizes do not match, or destination array is too small
C:\Users\Marcelo\Desktop\samp03asvr_R7_win32\gamemodes\90.pwn(23254) : error 047: array sizes do not match, or destination array is too small
C:\Users\Marcelo\Desktop\samp03asvr_R7_win32\gamemodes\90.pwn(23262) : error 047: array sizes do not match, or destination array is too small
Linha do erro 1: cmd = strtok(cmdtext, idx);
Linha do erro 2: tmp = strtok(cmdtext,idx);
Linha do erro 3: gMessage = strrest(cmdtext,idx);
Reply
#5

Alguem? =/
Reply
#6

tenta mudar:

pawn Код:
new cmd[128];
new tmp[128];
new gMessage[128];
pra:

pawn Код:
new cmd[256];
new tmp[256];
new gMessage[256];
Reply
#7

Quote:
Originally Posted by Gustavob
Посмотреть сообщение
tenta mudar:

pawn Код:
new cmd[128];
new tmp[128];
new gMessage[128];
pra:

pawn Код:
new cmd[256];
new tmp[256];
new gMessage[256];
ae funcionou perfeitamente,vlw cynic,DraKoN e Gustavob,vlw msm =D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)