Show commands typed by players to admins
#1

Hello, I'm a newbie and I want a command like that it will tell the commands typed by players, even it is /slfjadflksajdl;a, or /heyhowareyoubrotherblahblah. I want it command to be named as /listen, for level 6 admins and must be in strcmp format.

if (adlvl[playerid] != 6) return 0;
Reply
#2

that's impossible to do, unless you add at every scripted command a function that sends it to every alevel6 admins, i recommend you use zcmd, with that it is possible.
Reply
#3

I dont know how to convert it to ZCMD, can you do it for me?
Reply
#4

Код:
CMD:listen(playerid, params[])
{
	if (adlvl[playerid] < 6) return 0;
	if(CListen[playerid] == 0)
	{
		CListen[playerid] = 1;
		SendClientMessage(playerid, -1, "You have started listening to commands.");
	}
	else
	{
		CListen[playerid] = 0;
		SendClientMessage(playerid, -1, "You have stopped listening to commands.");
	}
	return 1;
}
Here you Go
Reply
#5

Quote:
Originally Posted by ProDude
Посмотреть сообщение
Код:
CMD:listen(playerid, params[])
{
	if (adlvl[playerid] < 6) return 0;
	if(CListen[playerid] == 0)
	{
		CListen[playerid] = 1;
		SendClientMessage(playerid, -1, "You have started listening to commands.");
	}
	else
	{
		CListen[playerid] = 0;
		SendClientMessage(playerid, -1, "You have stopped listening to commands.");
	}
	return 1;
}
Here you Go
This command is not working in my script
Reply
#6

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
that's impossible to do, unless you add at every scripted command a function that sends it to every alevel6 admins, i recommend you use zcmd, with that it is possible.
What ?
Reply
#7

Quote:
Originally Posted by MIDO007
Посмотреть сообщение
This command is not working in my script
Make sure you've included ZCMD
https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#8

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
that's impossible to do, unless you add at every scripted command a function that sends it to every alevel6 admins, i recommend you use zcmd, with that it is possible.
How is that impossible?
Reply
#9

PHP код:
enum PlayerInfo
{
     
bool:Listening
}
new 
pInfo[MAX_PLAYERS][PlayerInfo];

CMD:listen(playeridparams[])
{
    if(
pInfo[playerid][Listening] == false)
    {
        
pInfo[playerid][Listening] = true;
        
SendClientMessage(playerid, -1"You have started listening to commands.");
    }
    else
    {
        
pInfo[playerid][Listening] = false;
        
SendClientMessage(playerid, -1"You have stopped listening to commands.");
    }
    return 
1;
}

public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if (!
IsPlayerConnected2(playerid)) return 0;
    new 
cstring[100],playerids[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayeridssizeof(playerids));
    
format(cstringsizeof(cstring), "[cmd] [%s]: %s"playeridscmdtext);
    foreach(new 
iPlayer)
    {
        if(
adminvariable >= && Listen(i) == 1)
        {
            if(
adminvariable <= adminvariable)
            {
                  if(
!= playeridSendClientMessage(i, -1cstring);
            }
        }
    }
return 
1;
}
forward Listen(playerid);
public 
Listen(playerid)
{
    return 
pInfo[playerid][Listening];

here
Reply
#10

Quote:
Originally Posted by CaptainBoi
Посмотреть сообщение
PHP код:
enum PlayerInfo
{
     
bool:Listening
}
new 
pInfo[MAX_PLAYERS][PlayerInfo];
CMD:listen(playeridparams[])
{
    if(
pInfo[playerid][Listening] == false)
    {
        
pInfo[playerid][Listening] = true;
        
SendClientMessage(playerid, -1"You have started listening to commands.");
    }
    else
    {
        
pInfo[playerid][Listening] = false;
        
SendClientMessage(playerid, -1"You have stopped listening to commands.");
    }
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if (!
IsPlayerConnected2(playerid)) return 0;
    new 
cstring[100],playerids[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayeridssizeof(playerids));
    
format(cstringsizeof(cstring), "[cmd] [%s]: %s"playeridscmdtext);
    foreach(new 
iPlayer)
    {
        if(
adminvariable >= && Listen(i) == 1)
        {
            if(
adminvariable <= adminvariable)
            {
                  if(
!= playeridSendClientMessage(i, -1cstring);
            }
        }
    }
return 
1;
}
forward Listen(playerid);
public 
Listen(playerid)
{
    return 
pInfo[playerid][Listening];

here
And where have you defined adminvariable? Where is the explanation? Are you just posting code to gain reputation without even explaining it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)