[HELP] Admin CMD Spy -
Nucky - 19.03.2014
Okay, so I made a script where I can spy on other people's CMD. The problem is, I have anonymous admins on server. They're not going to be logged in this command, so I want to make a certain admin level to not take any influence in this.
Heres some code:
Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerTemp[i][admincmdspy] == 1)
if(PlayerInfo[playerid][power] < 19) return if(IsPlayerConnected(i) && PlayerTemp[i][admincmdspy] == 0)
{
format(iStr, sizeof(iStr), "[ CMD ] %s[%d]: %s", PlayerName(playerid), playerid, cmdtext);
SendClientMessage(i, COLOR_ORANGE, iStr);
}
}
return 1;
}
In the code above I got 2 errors. Invalid expression, assumed zero ... What I'm trying here is to make all admin levels above 19 to be invisible in the /togcmds command, where I spy on command echos.
Here is the command script:
Код:
COMMAND:togcmds(playerid, params[])
{
if(PlayerInfo[playerid][power] < 10) return SendClientError(playerid, CANT_USE_CMD);
if(PlayerTemp[playerid][admincmdspy] == 0)
{
SendClientMessage(playerid,COLOR_GREENYELLOW, "[ENABLED] You will now see every command.");
PlayerTemp[playerid][admincmdspy] = 1;
}
else if(PlayerTemp[playerid][admincmdspy] == 1)
{
SendClientMessage(playerid,COLOR_RED, "[DISABLED] You will nolonger see every command.");
PlayerTemp[playerid][admincmdspy] = 0;
}
return 1;
}
What I basically want is to make this command able to work for all admin levels above 10, which I've done properly here. Nothing is wrong with this code.
Now to what I'm asking for: How can I make admin levels above 19 invisible when some admin hit /togcmds.
Re: [HELP] Admin CMD Spy -
thomaswilliams - 19.03.2014
Show us what line it's on
Re: [HELP] Admin CMD Spy -
Matess - 19.03.2014
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerTemp[i][admincmdspy] == 1)
if(PlayerInfo[playerid][power] < 19) //if someone got lower power then 19 his commands will be reported..
{
format(iStr, sizeof(iStr), "[ CMD ] %s[%d]: %s", PlayerName(playerid), playerid, cmdtext);
SendClientMessage(i, COLOR_ORANGE, iStr);
}
}
return 1;
}
Re: [HELP] Admin CMD Spy -
Nucky - 19.03.2014
Matess, it didn't work. I can still see admin levels above 19's commands.
Shouldn't it be:
Код:
if(PlayerInfo[playerid][power] > 19)
Instead of
Код:
if(PlayerInfo[playerid][power] < 19)
< = more than
> = less than
(?)
Re: [HELP] Admin CMD Spy -
Matess - 19.03.2014
Well if i understand right then
is only for power 10 and higher right?
And in this code you are searching every admin which have enabled admincmdspy and then send him message. But message won't be send if the player power is more than 19.
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerTemp[i][admincmdspy] == 1)
if(PlayerInfo[playerid][power] < 19) //if someone got lower power than 19 his commands will be reported..
{
format(iStr, sizeof(iStr), "[ CMD ] %s[%d]: %s", PlayerName(playerid), playerid, cmdtext);
SendClientMessage(i, COLOR_ORANGE, iStr);
}
}
return 1;
}
Again
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerTemp[i][admincmdspy] == 1)
if(PlayerInfo[playerid][power] < 19) //if this is true then it sends message, if not then not
{
format(iStr, sizeof(iStr), "[ CMD ] %s[%d]: %s", PlayerName(playerid), playerid, cmdtext);
SendClientMessage(i, COLOR_ORANGE, iStr);
}
}
return 1;
}
Re: [HELP] Admin CMD Spy -
Nucky - 19.03.2014
So admin with lower admin level than 19 won't be able to see the command those who is above 19 is typing, right?
Your code was right. But in the first place it didn't work. Maybe because he was above level admin 19 and didn't re-connect with lower admin level. (I was testing on someone)
Re: [HELP] Admin CMD Spy -
Matess - 19.03.2014
Yeah. And for future:
Код HTML:
x>5 means 6, 7, 8, ..., infinity
x>=5 means 5, 6, 7, ..., infinity
x<5 means 4, 3, 2, ..., -infinity
x<=5 means 5, 4, 3, 2, ..., -infinity
But in samp is inifinity 2^32 -1 i think.. just for info
Re: [HELP] Admin CMD Spy -
MrHamediT - 06.08.2016
please convert /togcmds to dcmd!