A little help
#1

I've been away from coding for a year or two and i've forgot a few things but ill catch up
I would like someone to tell me how to create an /admin [question] command
What it does ?
It sends a questions to online admins and they can answer with a /reply [id] [response] to him .
NOTE: All admins can see it .

I would only like the commands , i will make the admin only .

And a /report command that saves into reports.txt

I know its too much but i really need those.
Reply
#2

/admin [question] command using ZCMD & SSCANF2
pawn Код:
CMD:admin(playerid, params[])
{
    new string[128];
    new sName[MAX_PLAYER_NAME];
    if(sscanf(params, "s", string)) return SendClientMessage(playerid, -1, "Usage /admin [question]");
    GetPlayerName(playerid, sName, sizeof(sName));
    new Message[128];
    format(Message, sizeof(Message), "QUESTION from %s: %s", sName, string);
    for(new i; i < MAX_PLAYERS; i++){
        //if(IsPlayerAdmin(i)){
            SendClientMessage(i, -1, Message);
        //}
    }
    return 1;
}
/reply
pawn Код:
CMD:reply(playerid, params[])
{
    //if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You don't have permission to use this command");
    new
        to,
        message[128],
        aName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aName, sizeof(aName));
    if(sscanf(params, "is", to, string)) return SendClientMessage(playerid, -1, "Usage /reply [id] [response]");
    if(!IsPlayerConnected(to)) return SendClientMessage(playerid, -1, "Player is not online");
    format(message, sizeof(message), "Response from %s: %s", aName, message);
    SendClientMessage(to, -1, message);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Nathan_Taylor
Посмотреть сообщение
/admin [question] command using ZCMD & SSCANF2
pawn Код:
CMD:admin(playerid, params[])
{
    new string[128];
    new sName[MAX_PLAYER_NAME];
    if(sscanf(params, "s", string)) return SendClientMessage(playerid, -1, "Usage /admin [question]");
    GetPlayerName(playerid, sName, sizeof(sName));
    new Message[128];
    format(Message, sizeof(Message), "QUESTION from %s: %s", sName, string);
    for(new i; i < MAX_PLAYERS; i++){
        //if(IsPlayerAdmin(i)){
            SendClientMessage(i, -1, Message);
        //}
    }
    return 1;
}
/reply
pawn Код:
CMD:reply(playerid, params[])
{
    //if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You don't have permission to use this command");
    new
        to,
        message[128],
        aName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aName, sizeof(aName));
    if(sscanf(params, "is", to, string)) return SendClientMessage(playerid, -1, "Usage /reply [id] [response]");
    if(!IsPlayerConnected(to)) return SendClientMessage(playerid, -1, "Player is not online");
    format(message, sizeof(message), "Response from %s: %s", aName, message);
    SendClientMessage(to, -1, message);
    return 1;
}
Thanks . +rep for the help
Reply
#4

Quote:
Originally Posted by Johnson_Brooks
Посмотреть сообщение
Thanks . +rep for the help
Not a problem
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)