SA-MP Forums Archive
/admin command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admin command (/showthread.php?tid=279542)



/admin command - Trucker[UK] - 28.08.2011

Hello

Does anyone know how to make a /admin command that only allows you to contact an admin and not see the admins online

e.g.

Code:
Usage: \"/admin <message>\
thanks


Re: /admin command - =WoR=Varth - 28.08.2011

Admin chat?
pawn Code:
CMD:adminchat(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,SRed,"Only admin can use this command.");
    if(isnull(params)) return SendClientMessage(playerid,SYellow,"Usage: /a(adminchat) <text> ~To talk in admin chat.");
    CostumFormat(params,"(([Admin]%s: %s))",SUName(playerid),params);
    return AdminChat(params);
}

stock AdminChat(stringtext[])
{
    foreach(Player,i)
    {
        if(IsPlayerAdmin(playerid)) SendClientMessage(i,SOrange,stringtext);
    }
    return 1;
}



Re: /admin command - Trucker[UK] - 28.08.2011

not like that like this

but in

Code:
 Usage: \"/admin <message>\
Code:
COMMAND:pm(playerid, params[])
{
	// Setup local variables
	new OtherPlayer, Message[128], Msg1[128], Msg2[128], YourName[24], OtherPlayerName[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/pm", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		if (sscanf(params, "us[128]", OtherPlayer, Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pm <OtherPlayer> <Message>\"");
		else
		{
			// Check if that other player is online
			if (IsPlayerConnected(OtherPlayer))
			{
			    // Check if the player isn't muted
			    if (APlayerData[playerid][Muted] == false)
			    {
				    // Get both names
					GetPlayerName(playerid, YourName, sizeof(YourName));
					GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
				    // Construct the message that is sent to yourself
					format(Msg1, 128, "{808080}PM to %s{FFFFFF}: %s", OtherPlayerName, Message);
					// Construct the message that is sent to the other player
					format(Msg2, 128, "{A0A0A0}PM by %s{FFFFFF}: %s", YourName, Message);
					// Send the messages
					SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
					SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg2);
				}
				else
				    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
			}
			else
			    SendClientMessage(playerid, 0xFF0000FF, "Player is not online");
		}
	}
	else
	 return 0;

	// Let the server know that this was a valid command
	return 1;
}
but as admin it is going into an include file (PlayerCommands)


Re: /admin command - =WoR=Varth - 28.08.2011

?? You mean report command?


Re: /admin command - Trucker[UK] - 28.08.2011

yh something like that but u can talk to admins privately if there pm is disabled


Re: /admin command - =WoR=Varth - 28.08.2011

pawn Code:
COMMAND:admin(playerid, params[])
{
    // Setup local variables
    new OtherPlayer, Message[128], Msg1[128], Msg2[128], YourName[24], OtherPlayerName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/admin", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (sscanf(params, "us[128]", OtherPlayer, Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/admin <OtherPlayer> <Message>\"");
        else
        {
            // Check if that other player is online
            if (IsPlayerConnected(OtherPlayer))
            {
                // Check if the player is admin
                if (IsPlayerAdmin(OtherPlayer))
                {
                    // Get both names
                    GetPlayerName(playerid, YourName, sizeof(YourName));
                    GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
                    // Construct the message that is sent to yourself
                    format(Msg1, 128, "{808080}PM to %s{FFFFFF}: %s", OtherPlayerName, Message);
                    // Construct the message that is sent to the other player
                    format(Msg2, 128, "{A0A0A0}PM by %s{FFFFFF}: %s", YourName, Message);
                    // Send the messages
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
                    SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg2);
                }
                else
                    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}He isn't admin");
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Player is not online");
        }
    }
    else
     return 0;

    // Let the server know that this was a valid command
    return 1;
}