SA-MP Forums Archive
SendAdminsMessage - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendAdminsMessage (/showthread.php?tid=234512)



SendAdminsMessage - Alex_Obando - 03.03.2011

How to do this?
Example:

/help How I can I join the minigame?


MSG to admin: %s: How Can I join the minigame?


Re: SendAdminsMessage - Antonio [G-RP] - 03.03.2011

pawn Код:
forward SendAdminsMessage(color, string[]);
public SendAdminsMessage(color, string[])
{
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerAdmin(i)) {
            if(IsPlayerConnected(i)) {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}



Respuesta: SendAdminsMessage - Alex_Obando - 03.03.2011

Im kinda noob xD, Can you send me the script with all added? (CMD = /help [Text]


Re: SendAdminsMessage - Antonio [G-RP] - 03.03.2011

Try that out.

pawn Код:
if(strcmp(cmdtext, "/help", true) == 0)
{
    new name[24], string[128];
    GetPlayerName(playerid, name, 24);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /help [message]");
   
    format(string, 128, "%s is requesting help: %s", name, tmp);
    SendAdminsMessage(-1, string);
    SendClientMessage(playerid, -1, "You've requested help.");
    return 1;
}



Respuesta: SendAdminsMessage - Alex_Obando - 03.03.2011

When I do /help The console closes.


Код:
#include <a_samp>

forward SendAdminsMessage(color, string[]);
public SendAdminsMessage(color, string[])
{
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerAdmin(i)) {
            if(IsPlayerConnected(i)) {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/help", true) == 0)
{
    new name[24], string[128];
    GetPlayerName(playerid, name, 24);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /help [message]");

    format(string, 128, "%s is requesting help: %s", name, tmp);
    SendAdminsMessage(-1, string);
    SendClientMessage(playerid, -1, "Report Sent Thanks ;)");
    return 1;
}
	return 0;
}



Re: SendAdminsMessage - Antonio [G-RP] - 03.03.2011

Wow. I just suck at using strcmp and old functions.

Search up ZCMD and sscanf, and do this:

pawn Код:
CMD:help(playerid, params[])
{
    new help[64], string[128];
    if(sscanf(params, "s[64]", help)) return SendClientMessage(playerid, -1, "USAGE: /help [message]");
     format(string, 128, "%s is requesting help: %s", name, help);
    SendAdminsMessage(-1, string);
    SendClientMessage(playerid, -1, "You've requested help.");
    return 1;
}



Respuesta: SendAdminsMessage - Alex_Obando - 03.03.2011





Re: SendAdminsMessage - [L3th4l] - 03.03.2011

pawn Код:
CMD:help(playerid, params[])
{
    new
        iStr[128],
        pName[MAX_PLAYER_NAME];

    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Help < Message >");

    GetPlayerName(playerid, pName, sizeof(pName));

    format(iStr, sizeof(iStr), "%s(%d) requesting help: %s", pName, playerid, params);

    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i)) SendClientMessage(i, -1, iStr);
        }
    }
    return 1;
}



Re: SendAdminsMessage - Antonio [G-RP] - 03.03.2011

pawn Код:
for(new i = 0; i < MAX_PLAYERS; ++i)
++i ?


Respuesta: SendAdminsMessage - Alex_Obando - 03.03.2011

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение

This.