View Commands problem
#1

I set up a view commands system in my server. Problem is, you can see passwords when people register, login, etc.. I thought if I used strfind to pickout the text it would stop it. I was wrong, now I need help.

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    GetPlayerName(playerid, pname, sizeof(pname));
    new string1[256], string2[256], pname[MAX_PLAYER_NAME];
    format(string1, sizeof(string1), "[View Commands]: %s(%d): %s",pname,playerid,cmdtext);
   
    format(string2, sizeof(string2), "Command Text: %s by: %s",cmdtext,pname);
    if(strfind("/login", "/login") || strfind("/register", "/register") || strfind("/changepass", "/changepass"))
    {
        return 1;
    }else{
        SendClientMessageToAdmins(GREY, string1, 3);
        CMDLog(string2);
    }
    if(success) {
        return 1;
    }else{
        return 0;
    }
   
}
Reply
#2

try
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    printf("%s(%d) Used Command - %s",Playername(playerid),playerid,cmdtext);
    return 1;
}
onplayercommandrecieved for logging and other stuff. i use that
Reply
#3

That still doesn't stop them from seeing the login and register commands. It's the passwords I want to hide from it, it sends fine..
Reply
#4

are you sure you switched to onplayercommandrecieved and its still sending the message to admins?
how about, formatting the cmdtext if you find login, register etc?
Reply
#5

Okay, It is supposed to send the command and params to the admins. I just am trying to make it so that Login, Register, and Changepass will not show up.
Reply
#6

try this maybe
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    GetPlayerName(playerid, pname, sizeof(pname));
    new string1[256], string2[256], pname[MAX_PLAYER_NAME],cmd[128],idx;
    format(string1, sizeof(string1), "[View Commands]: %s(%d): %s",pname,playerid,cmdtext);
    cmd= strtok(cmdtext,idx);
    format(string2, sizeof(string2), "Command Text: %s by: %s",cmdtext,pname);
    if(!strcmp(cmd,"/login",true) || !strcmp(cmd,"/register",true) || !strcmp(cmd,"/chengepass",true)) // edited this
    {
        return 1;
    }else{
        SendClientMessageToAdmins(GREY, string1, 3);
        CMDLog(string2);
    }
    if(success) {
        return 1;
    }else{
        return 0;
    }
   
}
Reply
#7

i've been trying to tell you what to do..
try this
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[],success)
{
    GetPlayerName(playerid, pname, sizeof(pname));
    new string1[256], string2[256], pname[MAX_PLAYER_NAME];
    format(string1, sizeof(string1), "[View Commands]: %s(%d): %s",pname,playerid,cmdtext);

    format(string2, sizeof(string2), "Command Text: %s by: %s",cmdtext,pname);
    if(strfind(cmdtext, "/login", true) != -1 || strfind(cmdtext, "/register", true) != -1 || strfind(cmdtext, "/changepass", true) != -1)
    {
        return 1;
    }
    else
    {
        SendClientMessageToAdmins(GREY, string1, 3);
        CMDLog(string2);
    }
    return 1;
}
(untested)

edit - i dont think you can use strcmp, because cmdtext is the entire param sent.
Reply
#8

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
i've been trying to tell you what to do..
try this
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[],success)
{
    GetPlayerName(playerid, pname, sizeof(pname));
    new string1[256], string2[256], pname[MAX_PLAYER_NAME];
    format(string1, sizeof(string1), "[View Commands]: %s(%d): %s",pname,playerid,cmdtext);

    format(string2, sizeof(string2), "Command Text: %s by: %s",cmdtext,pname);
    if(strfind(cmdtext, "/login", true) != -1 || strfind(cmdtext, "/register", true) != -1 || strfind(cmdtext, "/changepass", true) != -1)
    {
        return 1;
    }
    else
    {
        SendClientMessageToAdmins(GREY, string1, 3);
        CMDLog(string2);
    }
    return 1;
}
(untested)

edit - i dont think you can use strcmp, because cmdtext is the entire param sent.
look at my code... (message above yours) i added cmd=strtok(cmdtext,idx) its takes only the first work/string...
which is /something
Reply
#9

sorry, didn't see that :P
Reply
#10

no prop... happens to the best :P...
anyway where is scott to tell us if it works
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)