SendAdminsMessage
#1

How to do this?
Example:

/help How I can I join the minigame?


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

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;
}
Reply
#3

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

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;
}
Reply
#5

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;
}
Reply
#6

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;
}
Reply
#7


Reply
#8

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;
}
Reply
#9

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

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

This.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)