/ahelp (not admin commands) (help)
#1

hye guys i need help with a system for members to type /ahelp [message] and then all admins on the server will get the message and the admin can do /aresponde [id] [message] to the message and the requesting member gets the response message
Reply
#2

Just an example, might be a few errors & warnings (Not tested). It's just an example.
pawn Код:
new aReqHelp[MAX_PLAYERS];

OnPlayerConnect(playerid)
{
    aReqHelp[playerid] = 0;
    return 1;
}

CMD:ahelp(playerid, params[])
{
    new string[128];
    if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, -1, "USAGE: /ahelp [message]");
    for(new i = 0; i < MAX_PLAYERS; ++I)
    {
        if(PInfo[i][pAdmin] >= 1) // Admin variable Usually along the lines of PInfo[i][pAdmin] >= 1
        {
            SendClientMessage(playerid, -1, string);
        }
    }
    aReqHelp[playerid] = 1;
    return 1;
}

CMD:arespond(playerid, params[])
{
    new pID, string[128];
    if(sscanf(params, "us[128]", pID, string)) return SendClientMessage(playerid, -1, "USAGE: /arespond [id] [message]");
    if(PInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "You're not allowed to use this command.");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "Player not connected");
    if(aReqHelp[pID] == 0) return SendClientMessage(playerid, -1, "That player does not require help.");
    else SendClientMessage(pID, -1, string); aReqHelp[pID] = 0;
    return 1;
}
Reply
#3

Quote:
Originally Posted by ryansheilds
Посмотреть сообщение
Just an example, might be a few errors & warnings (Not tested). It's just an example.
pawn Код:
new aReqHelp[MAX_PLAYERS];

OnPlayerConnect(playerid)
{
    aReqHelp[playerid] = 0;
    return 1;
}

CMD:ahelp(playerid, params[])
{
    new string[128];
    if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, -1, "USAGE: /ahelp [message]");
    for(new i = 0; i < MAX_PLAYERS; ++I)
    {
        if(PInfo[i][pAdmin] >= 1) // Admin variable Usually along the lines of PInfo[i][pAdmin] >= 1
        {
            SendClientMessage(playerid, -1, string);
        }
    }
    aReqHelp[playerid] = 1;
    return 1;
}

CMD:arespond(playerid, params[])
{
    new pID, string[128];
    if(sscanf(params, "us[128]", pID, string)) return SendClientMessage(playerid, -1, "USAGE: /arespond [id] [message]");
    if(PInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "You're not allowed to use this command.");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "Player not connected");
    if(aReqHelp[pID] == 0) return SendClientMessage(playerid, -1, "That player does not require help.");
    else SendClientMessage(pID, -1, string); aReqHelp[pID] = 0;
    return 1;
}
if you could create me one without errors or warning's that would be grate
Reply
#4

You suggest you to look on the include zcmd.

Basicly this is how the code will look:

pawn Код:
for(new pID; pID < MAX_PLAYERS; pID++; )
{
     if(PlayerInfo[pID][Admin])
     {
          SendClientMessage(pID, 0x0, "Admin Message here!");
     }
}
Reply
#5

pawn Код:
new aReqHelp[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    aReqHelp[playerid] = 0;
    return 1;
}

CMD:ahelp(playerid, params[])
{
    new string[128];
    if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, -1, "USAGE: /ahelp [message]");
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(PlayerInfo[i][pAdmin] >= 1) // CHANGE ME (To your admin varibale - If its not that already)
        {
            SendClientMessage(playerid, -1, string);
        }
    }
    aReqHelp[playerid] = 1;
    return 1;
}

CMD:arespond(playerid, params[])
{
    new pID, string[128];
    if(sscanf(params, "us[128]", pID, string)) return SendClientMessage(playerid, -1, "USAGE: /arespond [id] [message]");
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "You're not allowed to use this command."); // CHANGE ME (To your admin varibale - If its not that already)
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "Player not connected");
    if(aReqHelp[pID] == 0) return SendClientMessage(playerid, -1, "That player does not require help.");
    else SendClientMessage(pID, -1, string); aReqHelp[pID] = 0;
    return 1;
}
It should work anyway, tested. Change the admin variable if its different (Marked by 'CHANGE ME'). Remember it was only an example and if you want efficient code I'm sure there's a better way to make it (Only took like 8 - 10 minutes to make).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)