View Commands problem -
ScottCFR - 14.12.2010
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;
}
}
Re: View Commands problem -
The_Gangstas - 14.12.2010
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
Re: View Commands problem -
ScottCFR - 14.12.2010
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..
Re: View Commands problem -
The_Gangstas - 14.12.2010
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?
Re: View Commands problem -
ScottCFR - 14.12.2010
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.
Re: View Commands problem -
XePloiT - 14.12.2010
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;
}
}
Re: View Commands problem -
The_Gangstas - 14.12.2010
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.
Re: View Commands problem -
XePloiT - 14.12.2010
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
Re: View Commands problem -
The_Gangstas - 14.12.2010
sorry, didn't see that :P
Re: View Commands problem -
XePloiT - 14.12.2010
no prop... happens to the best :P...
anyway where is scott to tell us if it works