ASKQ and RESPOND from admins
#1

Soo... I need simple cmd so player can ask admins help about the server /asq and a cmd /respond so admins can answer the players question. Tnx in advance who helps (not for a RP server)
Reply
#2

Quote:
Originally Posted by NexySamp
Посмотреть сообщение
Soo... I need simple cmd so player can ask admins help about the server /asq and a cmd /respond so admins can answer the players question. Tnx in advance who helps (not for a RP server)
Hello there.
Obviously, noone's gonna write everything for You (well, unless they get paid) such script, because it is rather complex. But, however, I can show You how You can do it yourself

First, You want to have something that will store questions. Let's make an enum.
pawn Код:
#define MAX_ADMIN_MESSAGES (0) // How many messages there can be in queue?
enum _aMessages {
    mStatus, // is active?
    mFrom, // Who is the sender?
    mTime, // When it was sent?
    mCont[128] // Message itself
    // and You can carry on and add as much details as You want.
    // for example purposes, we'll stick with those.
}   new questionsForAdmins[ MAX_ADMIN_MESSAGES ][ _aMessages ];
Okay, we're done with that part.

Now, just to prevent some headaches:
pawn Код:
public OnGameModeInit() {
    // begin of the block
    for( new MessageId = 0; MessageId < MAX_ADMIN_MESSAGES; MessageId++ ) {
        questionsForAdmins[ MessageId ][ mFrom ] = INVALID_PLAYER_ID;
        questionsForAdmins[ MessageId ][ mTime ] = 0;
        questionsForAdmins[ MessageId ][ mStatus ] = 0;
        format( questionForAdmins[ MessageId ][ mCont ], 128, "\0");
    }
    // rest of the code
}
Pretty simple, huh?
The worst is behind us for now. Now, all You need to do is to make commands that will be able to write/read from this enumerator, I hope You'll figure that out yourself. If You won't - then apparently You are not ready to write such things..

Just a little motivation for You..:
pawn Код:
stock NewQuestion( IssuerId, const Message[] ) {
    if( IssuerId > MAX_PLAYERS || !IsPlayerConnected(IssuerId))
        return false;
   
    new MessageId = 0;
   
    while( questionForAdmins[ MessageId ][ mStatus ] > 0 ) // Find first free 'slot'
        MessageId ++;
   
    questionsForAdmins[ MessageId ][ mTime ] = gettime();
    questionsForAdmins[ MessageId ][ mFrom ] = IssuerId;
    questionsForAdmins[ MessageId ][ mStatus ] = 1;
    format( questionForAdmins[ MessageId ][ mCont ], 128, "%s", Message );
   
    new _str[128];
    format( _str, 128, " * New message from id %d!", IssuerId ); // Notification for all RCON admins
    for( new PlayerId = 0; PlayerId < MAX_PLAYERS; PlayerId++ )
        if( IsPlayerAdmin( PlayerId ) )
            SendClientMessage( PlayerId, -1, _str );
    return true;
}
That's it, now, everything is up to You. Good luck!

Greetings.
Reply
#3

ok thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)