SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 05/09/2012, 06:25 PM   #1
zT KiNgKoNg
Gangsta
 
Join Date: Jun 2012
Location: $Location = $this->Location->Finder('United Kingdom');
Posts: 648
Reputation: 23
Default /ahelp (not admin commands) (help)

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
__________________

zT KiNgKoNg is offline   Reply With Quote
Old 05/09/2012, 06:44 PM   #2
ryansheilds
Huge Clucker
 
Join Date: Oct 2011
Posts: 216
Reputation: 27
Default Re: /ahelp (not admin commands) (help)

Just an example, might be a few errors & warnings (Not tested). It's just an example.
pawn Code:
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;
}
__________________


ryansheilds is offline   Reply With Quote
Old 05/09/2012, 06:45 PM   #3
zT KiNgKoNg
Gangsta
 
Join Date: Jun 2012
Location: $Location = $this->Location->Finder('United Kingdom');
Posts: 648
Reputation: 23
Default Re: /ahelp (not admin commands) (help)

Quote:
Originally Posted by ryansheilds View Post
Just an example, might be a few errors & warnings (Not tested). It's just an example.
pawn Code:
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
__________________

zT KiNgKoNg is offline   Reply With Quote
Old 05/09/2012, 06:46 PM   #4
Cameltoe
High-roller
 
Cameltoe's Avatar
 
Join Date: Apr 2010
Location: Norway
Posts: 1,782
Reputation: 24
Default Re: /ahelp (not admin commands) (help)

You suggest you to look on the include zcmd.

Basicly this is how the code will look:

pawn Code:
for(new pID; pID < MAX_PLAYERS; pID++; )
{
     if(PlayerInfo[pID][Admin])
     {
          SendClientMessage(pID, 0x0, "Admin Message here!");
     }
}
__________________

Quote:
Originally Posted by Cameltoe View Post
Share the progress so others who are looking for the same also find's their answer.
Quote:
Originally Posted by teomakedonija View Post
ahaha i don't want
Rep++;
Cameltoe is offline   Reply With Quote
Old 05/09/2012, 08:07 PM   #5
ryansheilds
Huge Clucker
 
Join Date: Oct 2011
Posts: 216
Reputation: 27
Default Re: /ahelp (not admin commands) (help)

pawn Code:
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).
__________________


ryansheilds is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Login/Register using ZCMD SSCANF & Y_INI.( Admin commands + VIP System + VIP Commands! ) Zh3r0 Filterscripts 115 03/06/2013 06:30 AM
[Help] My /ahelp command. JustinAn Scripting Help 10 05/06/2012 11:52 AM
/ahelp shows nothing FabianoC Scripting Help 8 05/12/2011 06:48 PM
Possible /ahelp and /ah with dcmd? Goobiiify Help Archive 6 22/05/2010 11:58 AM


All times are GMT. The time now is 11:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.